charon-core  0.3.1
AbstractSlot< T > Class Template Reference

Encapsulation of slot connection handling (type specific) and common code for input and output slots. More...

#include <charon-core/Slots.h>

Inheritance diagram for AbstractSlot< T >:

Public Member Functions

virtual std::set< Slot * > getTargets () const
 Get pointers to the connected targets.
 
virtual std::string getType () const
 Get slot type. More...
 
virtual std::string guessType () const
 Try to guess slot type.
 
virtual void save (ParameterFile &pf) const
 Save slot connections This function disconnects already established connections in the parameterFile and stores the current one. More...
 
Iterators for stl-like usage
std::set< AbstractSlot< T >
* >::const_iterator 
begin () const
 iterator to the beginning of the source list
 
std::set< AbstractSlot< T >
* >::const_iterator 
end () const
 iterator to the end of the source list
 
- Public Member Functions inherited from Slot
 Slot ()
 default constructor
 
bool connect (Slot &target)
 Connect with given slot. More...
 
bool connected () const
 Check if slot is connected.
 
bool connected (Slot &target) const
 Check if slot is connected to given slot. More...
 
bool disconnect ()
 Remove all slot targets.
 
bool disconnect (Slot &target)
 Remove all slot targets.
 
virtual void finalize ()=0
 finalize slot More...
 
virtual std::string getDisplayName () const
 Get slot display name.
 
bool getMulti () const
 return value of _multiSlot;
 
virtual std::string getName () const
 Get slot name.
 
bool getOptional () const
 return value of _optional;
 
ParameteredObjectgetParent ()
 get parent object
 
const ParameteredObjectgetParent () const
 get parent object (const version)
 
void init (ParameteredObject *parent, std::string name, std::string type)
 initialize parent and name More...
 
void init (ParameteredObject *parent, std::string name, std::string displayname, std::string type)
 initialize parent and name and displayname More...
 
virtual void load (const ParameterFile &pf, const PluginManagerInterface *man)=0
 Load slot connections. More...
 
virtual void prepare ()=0
 prepare slot More...
 
void printError (const std::string &msg) const
 print error with slot name and type info to sout
 
void printInfo (const std::string &msg) const
 print info message with slot name to sout
 
void printWarning (const std::string &msg) const
 print warning message with slot name to sout
 
void raise (const std::string &msg) const
 throw runtime error with slot name and type info
 

Protected Member Functions

virtual bool _addTarget (Slot *target)
 Add slot target. More...
 
virtual bool _removeTarget (Slot *target)
 Remove slot target. More...
 

Protected Attributes

std::set< AbstractSlot< T > * > _targets
 Pointer to data of connected output slot.
 
- Protected Attributes inherited from Slot
std::string _displayName
 Slot display name.
 
bool _multiSlot
 flag to mark this slot as a multislot, that can have multiple sources/targets. More...
 
std::string _name
 Slot name.
 
bool _optional
 flag to mark this slot as optional
 
ParameteredObject_parent
 Pointer to parent object.
 
std::string _type
 Slot type.
 

Additional Inherited Members

- Public Types inherited from Slot
enum  CacheType { CACHE_INVALID, CACHE_MEM, CACHE_MANAGED }
 slot data cache type More...
 

Detailed Description

template<typename T>
class AbstractSlot< T >

Definition at line 253 of file Slots.h.

Member Function Documentation

template<class T >
bool AbstractSlot< T >::_addTarget ( Slot target)
protectedvirtual

This does not touch the target slot itself.

Parameters
targetTarget slot to add.
Return values
trueTarget sucessfully connected.
falseTarget was not connected.

Implements Slot.

Definition at line 53 of file Slots.hxx.

References Slot::_multiSlot, Slot::getType(), VirtualOutputSlot::getType(), Slot::printError(), and Slot::raise().

template<class T >
bool AbstractSlot< T >::_removeTarget ( Slot target)
protectedvirtual

This does not touch the target slot itself.

Parameters
targetTarget slot to remove.
Return values
trueTarget sucessfully disconnected.
falseTarget was not connected.

Implements Slot.

Definition at line 82 of file Slots.hxx.

References Slot::raise().

template<typename T >
std::string AbstractSlot< T >::getType ( ) const
inlinevirtual

If "<T>" is found inside the type string, this will be replaced through the template type of the parent ParameteredObject.

Returns
std::string representation of the slot type

Implements Slot.

Reimplemented in OutputSlot< T >, OutputSlot< int >, InputSlot< T >, InputSlot< double >, InputSlot< int >, and InputSlot< bool >.

Definition at line 119 of file Slots.hxx.

References Slot::_type, and Slot::getParent().

template<class T >
void AbstractSlot< T >::save ( ParameterFile pf) const
virtual
Warning
You have to make sure, that this function is only called once in each save run, otherwise the connections will be erased from the target slot.
Parameters
pfParameterFile to save to

Reimplemented from Slot.

Definition at line 105 of file Slots.hxx.

References Slot::_name, Slot::_parent, ParameterFile::erase(), ParameteredObject::getName(), ParameterFile::isSet(), Slot::save(), and ParameterFile::set().


The documentation for this class was generated from the following files: