26 #include "../include/charon-core/Slots.hxx" 
   27 #include "../include/charon-core/SlotBundleInterfaces.h" 
   39         throw std::runtime_error(std::string(
"Parameter \"") + name + 
"\" already assigned");
 
   41         throw std::runtime_error(
"Setting invalid parent object!");
 
   43         throw std::runtime_error(
"Invalid name: length 0");
 
   91     return (targets.find(&target) != targets.end());
 
   96         raise(
"Slot::connect(): invalid target slot given (null)");
 
  106     std::set<Slot*>::iterator tIter;
 
  108     for (tIter = targets.begin(); tIter != targets.end(); tIter++) {
 
  109         res &= (*tIter)->_removeTarget(
this);
 
  117     if (targets.find(&target) == targets.end())
 
  131         << 
"\": " << msg << std::endl;
 
  136         << 
"\": " << msg << std::endl;
 
  141         << 
"\" (type " << 
getType() << 
"): " << msg << std::endl;
 
  145     throw std::runtime_error(
 
  147                 + 
"\" (type " + 
getType() + 
"): " 
  153 VirtualSlot::VirtualSlot(std::string virtType,
int num) {
 
  155     std::stringstream vname;
 
  156     vname<<
"Virtual"<<virtType<<num;
 
  167         if(!isValidTarget(target)) {
 
  188     return _managerconfig;
 
  192     return onRemoveTarget(target);
 
  198     std::vector<std::string> targetList;
 
  199     std::set<Slot*>::const_iterator slot;
 
  200     for (slot = _target.begin(); slot != _target.end(); slot++)
 
  201         targetList.push_back((*slot)->getParent().getName() + 
"." 
  202                 + (*slot)->getName());
 
  203     if (targetList.size())
 
  221             raise(
"_loopset to true but no _loopPartner!!");
 
  245     std::vector<std::string> targetList = pf.
getList<std::string> (
 
  250         Slot::raise(
"multiple targets but not a multi-slot");
 
  253     if (!targetList.size())
 
  257     std::vector<std::string>::const_iterator tStrIter;
 
  260     for (tStrIter = targetList.begin(); tStrIter != targetList.end(); tStrIter++) {
 
  262                 tStrIter->find(
".")));
 
  265                     tStrIter->substr(tStrIter->find(
".") + 1));
 
  280         if(isValidPartner(insl)) {
 
  312 VirtualInputSlot::VirtualInputSlot(
int num)
 
  326 VirtualOutputSlot::VirtualOutputSlot(
int num)
 
  334 bool VirtualOutputSlot::isValidPartner(
VirtualSlot *insl) {
 
  335     return (dynamic_cast<VirtualInputSlot*>(insl) != 0);
 
  338 bool VirtualInputSlot::isValidPartner(
VirtualSlot *insl) {
 
  339     return (dynamic_cast<VirtualOutputSlot*>(insl) != 0);
 
  342 void VirtualSlot::setDisplayNameAndType(std::string name, std::string 
type) {
 
  347 bool VirtualSlot::onAddTarget(
Slot*) {
 
  351 bool VirtualSlot::onRemoveTarget(
Slot*) {
 
  355 bool VirtualInputSlot::onAddTarget(
Slot *target) {
 
  356     if(dynamic_cast<SlotBundleIntf*>(
_parent))
 
  362     if(_target.size()>0) {
 
  370     _target.insert(target);
 
  376 #pragma message ("This is ugly, OutputSlot should not have to deal \ 
  377 with DataManager. Maybe put DataManager into VirtualSlot??") 
  388 bool VirtualInputSlot::onRemoveTarget(
Slot *target) {
 
  389     if(_target.find(target)==_target.end()) {
 
  396         partner->_managerconfig=
"";
 
  398         if(_partner->_target.size()==0) {
 
  399             _partner->
_type=
"virtual";
 
  401         if(dynamic_cast<SlotBundleIntf*>(
_parent))
 
  405         _target.erase(target);
 
  411 bool VirtualOutputSlot::isValidTarget(
Slot *target) {
 
  416 bool VirtualInputSlot::isValidTarget(
Slot *target) {
 
  433 void VirtualSlot::onLoad(
 
  440 void VirtualOutputSlot::onLoad(
 
  447         if(cType==
"Cache_mem") {
 
  450         else if(cType==
"Cache_managed") {
 
  460     pf.
set<std::string> (
 
  463     switch (_cacheType) {
 
  468         cType=
"Cache_managed";
 
  471         cType=
"Cache_invalid";
 
  500 void VirtualOutputSlot::setLoop(
bool loop) {
 
  507             raise(
"loopPartner already set");
 
  514         _loopPartner=loopPartner;
 
  518 bool VirtualOutputSlot::onAddTarget(
Slot *target) {
 
  519     if(dynamic_cast<SlotBundleIntf*>(
_parent))
 
  528     _target.insert(target);
 
  533 bool VirtualOutputSlot::onRemoveTarget(
Slot *target) {
 
  534     if(_target.find(target)!=_target.end()) {
 
  535         _target.erase(target);
 
  537         if(_target.size()==0) {
 
  538             if(_partner->_target.size()==0)
 
virtual const std::string & getConfig() const =0
get manager configuration string 
 
std::string _displayName
Slot display name. 
 
stay in memory after execution 
 
virtual const OutputSlotIntf * getDataSlot() const =0
Return a pointer to a real slot. 
 
virtual std::string getType() const =0
Get slot type. 
 
Interface for a plugin manager. 
 
virtual std::set< Slot * > getTargets() const 
Get pointers to the connected targets. 
 
virtual void setConfig(std::string conf)
set manager configuration string 
 
virtual Slot::CacheType getCacheType() const =0
query data cache type 
 
virtual void setConfig(std::string conf)=0
set manager configuration string 
 
This class serves to store parameters used within the Charon Project. 
 
std::string getName() const 
Get slot name. 
 
bool getOptional() const 
return value of _optional; 
 
void init(ParameteredObject *parent, std::string name, std::string type)
initialize parent and name 
 
void setVirtualPartnerSlot(VirtualSlot *insl)
Set corresponding partner VirtualSlot. 
 
SplitStream sout
Dummy instance for usage in other files (for interface too). 
 
virtual void load(const ParameterFile &pf, const PluginManagerInterface *man)
overload Slot functions. Load and save the config string 
 
void erase(std::string parameter)
Delete a parameter from the parameter list. 
 
bool disconnect()
Remove all slot targets. 
 
Base class for serializable objects. 
 
Slot::CacheType getCacheType() const 
get the cache type from _slot 
 
void printInfo(const std::string &msg) const 
print info message with slot name to sout 
 
bool _optional
flag to mark this slot as optional 
 
const OutputSlotIntf * getDataSlot() const 
Return a pointer to a real slot. 
 
virtual bool _addTarget(Slot *target)=0
Add slot target. 
 
bool connected() const 
Check if slot is connected. 
 
dumped after execution, not recommended 
 
std::vector< T > getList(std::string parameter) const 
If multiple values are set, return a list containing these values. 
 
virtual ParameteredObject * getInstance(const std::string &instanceName) const =0
Get an existing instance of a loaded plugin. 
 
virtual void save(ParameterFile &pf) const 
Save slot connections This function disconnects already established connections in the parameterFile ...
 
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. 
 
ParameteredObject & getParent()
get parent object 
 
virtual void finalize()
finalize slot 
 
std::string getType() const 
Get slot type. 
 
std::string getName() const 
get the Name 
 
std::string getType() const 
overloaded getType 
 
virtual std::string getName() const 
Get slot name. 
 
virtual std::set< Slot * > getTargets() const =0
Get pointers to the connected targets. 
 
void setCacheType(Slot::CacheType type)
set the cache type of _slot 
 
bool _removeTarget(Slot *target)
remove target 
 
void set(std::string parameter, const T &value=T())
Set a parameter to the given single value. 
 
abstract interface class for output slots 
 
bool getMulti() const 
return value of _multiSlot; 
 
std::string guessType() const 
Try to guess slot type. 
 
bool _multiSlot
flag to mark this slot as a multislot, that can have multiple sources/targets. 
 
T get(std::string parameter) const 
Get the value of a specified parameter. 
 
bool isSet(std::string parameter) const 
Check if a givem parameter has already been set. 
 
CacheType
slot data cache type 
 
Implementation of the template class ParameterFile. 
 
Slot * getSlot(const std::string &slotName) const 
Get pointer to some slot (by name) 
 
bool _addTarget(Slot *target)
set _slot to Casted target 
 
std::string _type
Slot type. 
 
charon_core_DLL_PUBLIC std::string type(const std::string &typeInfo)
Get type representation. 
 
Commom properties of slot objects. 
 
Declaration of class SplitStream. 
 
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 
 
std::string _name
Slot name. 
 
const std::string & getName() const 
instance name 
 
virtual std::string getDisplayName() const 
Get slot display name. 
 
virtual void save(ParameterFile &pf) const 
Save slot connections This function disconnects already established connections in the parameterFile ...
 
Slot()
default constructor 
 
void printError(const std::string &msg) const 
print error with slot name and type info to sout 
 
virtual void prepare()
prepare slot 
 
const std::string & getConfig() const 
get the manager config 
 
cached on disk after execution, save memory 
 
ParameteredObject * _parent
Pointer to parent object. 
 
virtual bool _removeTarget(Slot *target)=0
Remove slot target. 
 
bool connect(Slot &target)
Connect with given slot.