charon-core
0.3.1
|
Input slot. More...
#include <charon-core/Slots.h>
Public Member Functions | |
InputSlot (bool optional=false, bool multi=false) | |
Create new input slot. More... | |
virtual void | finalize () |
finalize slot More... | |
const T & | getDataFromOutputSlot (const OutputSlotIntf *slot) const |
handle data extraction from output slot More... | |
const T & | getDataFromOutputSlot (const Slot *slot) const |
handle data extraction from output slot More... | |
virtual std::string | getName () const |
get the name | |
virtual std::string | getType () const |
Get slot type. More... | |
virtual void | load (const ParameterFile &pf, const PluginManagerInterface *man) |
Load slot connections. More... | |
virtual | operator T () const |
Cast operator to get data (get copy) More... | |
virtual const T & | operator() () const |
Call operator. More... | |
virtual const T & | operator[] (std::size_t pos) const |
Access to specific member (read-only). More... | |
virtual void | prepare () |
prepare slot More... | |
virtual std::size_t | size () const |
Access to number of members. More... | |
Public Member Functions inherited from AbstractSlot< T > | |
virtual std::set< Slot * > | getTargets () const |
Get pointers to the connected targets. | |
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... | |
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 std::string | getDisplayName () const |
Get slot display name. | |
bool | getMulti () const |
return value of _multiSlot; | |
bool | getOptional () const |
return value of _optional; | |
ParameteredObject & | getParent () |
get parent object | |
const ParameteredObject & | getParent () 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 | |
Private Attributes | |
std::map< std::string, T > | _dataCache |
data cache for managed output slots | |
Additional Inherited Members | |
Public Types inherited from Slot | |
enum | CacheType { CACHE_INVALID, CACHE_MEM, CACHE_MANAGED } |
slot data cache type More... | |
Protected Member Functions inherited from AbstractSlot< T > | |
virtual bool | _addTarget (Slot *target) |
Add slot target. More... | |
virtual bool | _removeTarget (Slot *target) |
Remove slot target. More... | |
Protected Attributes inherited from AbstractSlot< T > | |
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. | |
This slot does not stores the data itself, but contains a pointer to the connected output slot. Data are read from this source, if needed.
|
virtual |
const T & InputSlot< T >::getDataFromOutputSlot | ( | const OutputSlotIntf * | slot | ) | const |
slot | output slot to extract data from |
Definition at line 246 of file Slots.hxx.
References Slot::CACHE_INVALID, Slot::CACHE_MANAGED, Slot::CACHE_MEM, OutputSlotIntf::getCacheType(), OutputSlotIntf::getConfig(), OutputSlotIntf::getDataSlot(), OutputSlotIntf::getType(), VirtualOutputSlot::getType(), and Slot::raise().
slot | output slot to extract data from |
Definition at line 237 of file Slots.hxx.
References Slot::raise().
|
inlinevirtual |
If "<T>" is found inside the type string, this will be replaced through the template type of the parent ParameteredObject.
Reimplemented from AbstractSlot< T >.
|
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.
pf | ParameterFile to load from |
man | PluginManager to get the instances from |
Implements Slot.
Definition at line 154 of file Slots.hxx.
References Slot::_multiSlot, Slot::_name, Slot::_parent, Slot::connect(), Slot::disconnect(), PluginManagerInterface::getInstance(), ParameterFile::getList(), ParameteredObject::getName(), ParameteredObject::getSlot(), ParameterFile::isSet(), and Slot::raise().
|
virtual |
Implements AbstractROData< T >.
Definition at line 200 of file Slots.hxx.
References Slot::raise().
|
virtual |
Implements AbstractROData< T >.
Definition at line 208 of file Slots.hxx.
References Slot::raise().
|
virtual |
pos | data position |
Implements AbstractMultiROData< T >.
Definition at line 216 of file Slots.hxx.
References AbstractSlot< T >::begin().
|
virtual |
Here, all connected output slots are scanned for managed data cache. For managed output slots, the data is queried using the needed data manager and stored in the _dataCache map. This is neccessary because the access operators are defined as const operators and so are not able to allocate persistent memory causing the references to become invalid.
The _dataCache map is cleared in finalize(), this way, the memory is freed.
Implements Slot.
Definition at line 287 of file Slots.hxx.
References AbstractSlot< T >::begin(), Slot::CACHE_MANAGED, AbstractSlot< T >::end(), OutputSlotIntf::getCacheType(), OutputSlotIntf::getConfig(), Slot::DataManager< T >::getData(), Slot::DataManagerFactory< T >::getManager(), Slot::getType(), VirtualOutputSlot::getType(), and Slot::raise().
|
virtual |