charon-core
0.3.1
|
Encapsulation of slot connection handling (type specific) and common code for input and output slots. More...
#include <charon-core/Slots.h>
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; | |
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... | |
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... | |
|
protectedvirtual |
This does not touch the target slot itself.
target | Target slot to add. |
true | Target sucessfully connected. |
false | Target 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().
|
protectedvirtual |
This does not touch the target slot itself.
target | Target slot to remove. |
true | Target sucessfully disconnected. |
false | Target was not connected. |
Implements Slot.
Definition at line 82 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.
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().
|
virtual |
pf | ParameterFile 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().