charon-core  0.3.1
VirtualSlot Class Referenceabstract

VirtualOutputSlot This class holds a pointer to an output if the output is CACHE_MEM, otherwise it loads a config string from a given parameterfile. More...

#include <charon-core/Slots.h>

Inheritance diagram for VirtualSlot:

Public Member Functions

 VirtualSlot (std::string virtType, int num=0)
 
bool _addTarget (Slot *target)
 set _slot to Casted target
 
bool _removeTarget (Slot *target)
 remove target
 
virtual void finalize ()
 finalize slot More...
 
std::string getName () const
 Get slot name.
 
virtual std::set< Slot * > getTargets () const
 Get pointers to the connected targets.
 
std::string getType () const
 Get slot type. More...
 
std::string guessType () const
 Try to guess slot type.
 
virtual void load (const ParameterFile &pf, const PluginManagerInterface *man)
 overload Slot functions. Load and save the config string
 
virtual void prepare ()
 prepare slot More...
 
virtual void save (ParameterFile &pf) const
 Save slot connections This function disconnects already established connections in the parameterFile and stores the current one. More...
 
void setVirtualPartnerSlot (VirtualSlot *insl)
 Set corresponding partner VirtualSlot.
 
- 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 std::string getDisplayName () const
 Get slot display name.
 
bool getMulti () const
 return value of _multiSlot;
 
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...
 
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 isValidPartner (VirtualSlot *insl)=0
 
virtual bool isValidTarget (Slot *target)=0
 
virtual bool onAddTarget (Slot *target)
 
virtual void onLoad (const ParameterFile &pf, const PluginManagerInterface *man)
 
virtual bool onRemoveTarget (Slot *target)
 
virtual void onSave (ParameterFile &pf) const
 
void setDisplayNameAndType (std::string name, std::string type)
 

Protected Attributes

VirtualSlot_partner
 
std::set< Slot * > _target
 
- 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.
 

Friends

class VirtualInputSlot
 
class VirtualOutputSlot
 

Additional Inherited Members

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

Detailed Description

Definition at line 478 of file Slots.h.

Member Function Documentation

void VirtualSlot::finalize ( )
virtual

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

Implements Slot.

Definition at line 301 of file Slots.cpp.

std::string VirtualSlot::getType ( ) const
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

Implements Slot.

Reimplemented in VirtualInputSlot, and VirtualOutputSlot.

Definition at line 429 of file Slots.cpp.

References Slot::_type.

void VirtualSlot::prepare ( )
virtual

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

Implements Slot.

Definition at line 298 of file Slots.cpp.

void VirtualSlot::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 195 of file Slots.cpp.

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


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