1 #include <charon-core/SlotBundle.h>
5 const std::string &className,
const std::string &name,
6 const std::string &doc)
9 ParameteredObject::_addParameter< int >(
11 "The number of virtual slots",
16 SlotBundle::~SlotBundle() {
31 return _virtualOutputSlots.size();
34 void SlotBundle::_deleteAllSlots()
43 std::vector<VirtualOutputSlot*> tempOutputSlots;
44 std::vector<VirtualInputSlot*> tempInputSlots;
47 int nslots=std::min(num,(
int)_virtualOutputSlots.size());
48 for(
int i=0;i<nslots;i++)
50 tempInputSlots.push_back(_virtualInputSlots[i]);
51 tempOutputSlots.push_back(_virtualOutputSlots[i]);
55 for(
int i=nslots;i<num;i++)
60 tempInputSlots.push_back(in);
61 tempOutputSlots.push_back(out);
65 for(
size_t i=num;i<_virtualOutputSlots.size();i++) {
69 delete _virtualOutputSlots[i];
70 delete _virtualInputSlots[i];
74 _virtualInputSlots=tempInputSlots;
75 _virtualOutputSlots=tempOutputSlots;
78 for(
int i=nslots;i<num;i++)
97 std::cout<<
"num slots "<<
num_slots()<<std::endl;
Parameter< int > num_slots
The number of virtual slots.
Interface for a plugin manager.
This class serves to store parameters used within the Charon Project.
void setVirtualPartnerSlot(VirtualSlot *insl)
Set corresponding partner VirtualSlot.
void loadConnection(ParameterFile pf, PluginManagerInterface *man)
Load connections.
Base class for serializable objects.
void _setDynamic(bool v)
Specifies if the ParameteredObject is dynamic.
void setNumberOfVirtualSlots(int num)
Set the number of slots.
Declaration of the abstract class Slot and template classes InputSlot and OutputSlot.
void initialize()
Initialize.
virtual void loadParameters(const ParameterFile &pf)
Load parameter from parameter file.
SlotBundle(const std::string &className, const std::string &name="", const std::string &doc="")
Default constructor.
virtual int size()
Size of bundle.
virtual void load(const ParameterFile &pf)
Load from ParameterFile.
void loadSlots(const ParameterFile &pf, const PluginManagerInterface *man)
Load slot connection from parameter file.
void prepareDynamicInterface(const ParameterFile &file)
prepare the interface of the bundle