charon-core  0.3.1
OutputSlot< T > Class Template Reference

Output slot. More...

#include <charon-core/Slots.h>

Inheritance diagram for OutputSlot< T >:

Public Member Functions

 OutputSlot (const T &initval=T())
 Create new output slot. More...
 
virtual ~OutputSlot ()
 initialize data element
 
virtual void finalize ()
 finalize slot More...
 
Slot::CacheType getCacheType () const
 query data cache type
 
virtual const std::string & getConfig () const
 get manager configuration string
 
const OutputSlotIntfgetDataSlot () const
 Return a pointer to a real slot.
 
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 T & operator() ()
 Call operator. More...
 
virtual T & operator= (const T &B)
 data assignment operator More...
 
virtual void prepare ()
 prepare slot More...
 
void setCacheType (Slot::CacheType type)
 change data cache type
 
virtual void setConfig (std::string conf)
 set manager configuration string
 
- 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;
 
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
 

Private Member Functions

void _check () const
 check for valid data pointer
 
void _prepare ()
 create data element, if needed
 

Private Attributes

Slot::CacheType _cacheType
 output slot data cache type
 
const T _initVal
 initial value cache
 
std::string _managerConfig
 config string
 
T * data
 Slot data. More...
 

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.
 

Detailed Description

template<typename T>
class OutputSlot< T >

This slot stores the output data and a list of connected slots.

Definition at line 402 of file Slots.h.

Constructor & Destructor Documentation

template<typename T>
OutputSlot< T >::OutputSlot ( const T &  initval = T())
Parameters
initvalinitialize data with this value

Definition at line 325 of file Slots.hxx.

Member Function Documentation

template<typename T >
void OutputSlot< T >::finalize ( )
virtual

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

Implements Slot.

Definition at line 437 of file Slots.hxx.

References Slot::CACHE_INVALID, Slot::CACHE_MANAGED, Slot::CACHE_MEM, Slot::DataManager< T >::getConfig(), Slot::DataManagerFactory< T >::getManager(), Slot::raise(), and Slot::DataManager< T >::setData().

template<typename T>
virtual std::string OutputSlot< 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

Reimplemented from AbstractSlot< T >.

Definition at line 460 of file Slots.h.

template<class T >
void OutputSlot< T >::load ( const ParameterFile pf,
const PluginManagerInterface man 
)
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

Implements Slot.

Definition at line 346 of file Slots.hxx.

References Slot::_name, Slot::_parent, Slot::CACHE_INVALID, Slot::CACHE_MANAGED, Slot::CACHE_MEM, ParameterFile::get(), ParameteredObject::getName(), ParameterFile::isSet(), Slot::raise(), and VirtualOutputSlot::setCacheType().

template<class T >
OutputSlot< T >::operator T ( ) const
virtual
Returns
data content (copy)

Implements AbstractROData< T >.

Definition at line 412 of file Slots.hxx.

template<class T >
const T & OutputSlot< T >::operator() ( ) const
virtual
Returns
data content (const reference, no copy)

Implements AbstractROData< T >.

Definition at line 418 of file Slots.hxx.

template<class T >
T & OutputSlot< T >::operator() ( )
virtual

Non const version

Returns
data content (no copy)

Implements AbstractData< T >.

Definition at line 424 of file Slots.hxx.

template<class T>
T & OutputSlot< T >::operator= ( const T &  B)
virtual
Parameters
Bdata to assign
Returns
updated object

Implements AbstractData< T >.

Definition at line 430 of file Slots.hxx.

template<typename T >
void OutputSlot< T >::prepare ( )
virtual

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

Implements Slot.

Definition at line 332 of file Slots.hxx.

Member Data Documentation

template<typename T>
T* OutputSlot< T >::data
private

Definition at line 408 of file Slots.h.


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