charon-core  0.3.1
Slot Class Referenceabstract

Commom properties of slot objects. More...

#include <charon-core/Slots.h>

Inheritance diagram for Slot:

Classes

class  DataManager
 interface of data management classes More...
 
class  DataManagerFactory
 interface of data management factories More...
 

Public Types

enum  CacheType { CACHE_INVALID, CACHE_MEM, CACHE_MANAGED }
 slot data cache type More...
 

Public Member Functions

 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)
 
virtual std::set< Slot * > getTargets () const =0
 Get pointers to the connected targets.
 
virtual std::string getType () const =0
 Get slot type. More...
 
virtual std::string guessType () const =0
 Try to guess slot type.
 
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
 
virtual void save (ParameterFile &pf) const
 Save slot connections This function disconnects already established connections in the parameterFile and stores the current one. More...
 

Protected Member Functions

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

Protected Attributes

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.
 

Private Member Functions

 Slot (const Slot &)
 forbid copying
 

Detailed Description

Definition at line 47 of file Slots.h.

Member Enumeration Documentation

this enum selects how output data is stored after execution

Enumerator
CACHE_INVALID 

dumped after execution, not recommended

CACHE_MEM 

stay in memory after execution

CACHE_MANAGED 

cached on disk after execution, save memory

Definition at line 204 of file Slots.h.

Member Function Documentation

virtual bool Slot::_addTarget ( Slot target)
protectedpure virtual

This does not touch the target slot itself.

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

Implemented in VirtualSlot, AbstractSlot< T >, AbstractSlot< double >, AbstractSlot< int >, and AbstractSlot< bool >.

virtual bool Slot::_removeTarget ( Slot target)
protectedpure virtual

This does not touch the target slot itself.

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

Implemented in VirtualSlot, AbstractSlot< T >, AbstractSlot< double >, AbstractSlot< int >, and AbstractSlot< bool >.

bool Slot::connect ( Slot target)
Parameters
targetTarget slot to connect to.
Return values
trueoperation successful

Definition at line 94 of file Slots.cpp.

References _addTarget().

bool Slot::connected ( Slot target) const
Parameters
targetTarget slot to check.
Return values
trueGiven slots are connected.

Definition at line 89 of file Slots.cpp.

References getTargets().

virtual void Slot::finalize ( )
pure virtual

this may be used on input/output slots to save/free data memory

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

virtual std::string Slot::getType ( ) const
pure virtual

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

Implemented in VirtualInputSlot, VirtualOutputSlot, VirtualSlot, OutputSlot< T >, OutputSlot< int >, InputSlot< T >, InputSlot< double >, InputSlot< int >, InputSlot< bool >, AbstractSlot< T >, AbstractSlot< double >, AbstractSlot< int >, and AbstractSlot< bool >.

void Slot::init ( ParameteredObject parent,
std::string  name,
std::string  type 
)
Parameters
parentparent object
nameslot name
typeslot type
Exceptions
std::stringError message if invalid parent set.

Definition at line 35 of file Slots.cpp.

References _displayName, _name, _parent, _type, and StringTool::toLowerCase().

void Slot::init ( ParameteredObject parent,
std::string  name,
std::string  displayname,
std::string  type 
)
Parameters
parentparent object
nameslot name
displaynameslot display name
typeslot type
Exceptions
std::stringError message if invalid parent set.

Definition at line 56 of file Slots.cpp.

References _displayName, and init().

virtual void Slot::load ( const ParameterFile pf,
const PluginManagerInterface man 
)
pure virtual

Input slots set up the connection between slots calling _addTargets() on the partners to be connected via connect(). Output slots load their slot configuration, i.e. set up e.g. their cache type if specified in the parameter file.

Parameters
pfParameterFile to load from
manPluginManager to get the instances from

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

virtual void Slot::prepare ( )
pure virtual

this may be used on input/output slots to allocate memory

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

void Slot::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 in VirtualSlot, AbstractSlot< T >, AbstractSlot< double >, AbstractSlot< int >, and AbstractSlot< bool >.

Definition at line 125 of file Slots.cpp.

Member Data Documentation

bool Slot::_multiSlot
protected

Definition at line 84 of file Slots.h.


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