122 unsigned CreatePoolHandle(
const std::string &poolname,
unsigned queue = 10);
124 unsigned CreateInput(
const std::string &name,
unsigned queue = 10);
125 unsigned CreateOutput(
const std::string &name,
unsigned queue = 10);
127 unsigned CreateTimer(
const std::string &name,
double period_sec = -1.,
bool synchron =
false);
133 void EnsurePorts(
unsigned numinp = 0,
unsigned numout = 0,
const std::string &poolname =
"");
137 bool BindPorts(
const std::string &inpname,
const std::string &outname);
145 unsigned FindOutput(
const std::string &name)
const;
146 std::string
OutputName(
unsigned indx = 0,
bool fullname =
false)
const;
153 unsigned FindInput(
const std::string &name)
const;
154 std::string
InputName(
unsigned indx = 0,
bool fullname =
false)
const;
159 unsigned FindPool(
const std::string &name)
const;
160 std::string
PoolName(
unsigned indx = 0,
bool fullname =
false)
const;
169 bool DisconnectPort(
const std::string &name,
bool witherr =
false);
182 unsigned FindTimer(
const std::string &name);
185 std::string
TimerName(
unsigned n = 0,
bool fullname =
false)
const;
191 else fTimers[indx]->SingleShoot(delay_sec);
195 void ShootTimer(
const std::string &name,
double delay_sec = 0.)
202 std::string
UserItemName(
unsigned indx = 0,
bool fullname =
false)
const;
258 virtual const char*
ClassName()
const {
return "Module"; }
312 std::string
InputName(
unsigned n = 0,
bool itemname =
true);
315 std::string
OutputName(
unsigned n = 0,
bool itemname =
true);
324 {
return null() ? std::string() :
GetObject()->GetInfoParName(); }
#define DABC_REFERENCE(RefClass, ParentClass, T)
Reference on memory from memory pool.
Represents command with its arguments.
Interface class between xml configuration and dabc objects.
Special timer to reestablish port connections in the module.
Manager of everything in DABC
Base class for user-derived code, implementing event-processing.
Base class for module items like ports, timers, pool handles.
Reference on dabc::Module class
std::string OutputName(unsigned n=0, bool itemname=true)
Return item name of the output, can be used in connect command.
unsigned NumOutputs()
Returns number of outputs in the module.
bool IsInputConnected(unsigned ninp)
Returns true if specified input is connected.
bool IsPortConnected(const std::string &name)
Returns true if port with specified name is connected - thread safe.
unsigned NumInputs()
Returns number of inputs in the module.
PortRef FindPort(const std::string &name)
Return reference on the port.
bool IsOutputConnected(unsigned ninp)
Returns true if specified output is connected.
bool ConnectPoolHandles()
Method called by manager to establish connection to pools TODO: while used from devices,...
std::string InputName(unsigned n=0, bool itemname=true)
Return item name of the input, can be used in connect command.
std::string InfoParName() const
Returns info parameter name, used to provide different kind of log/debug information.
Base class for user-derived code, implementing main loop.
Base for dabc::ModuleSync and dabc::ModuleAsync classes.
bool SubmitCommandToTransport(const std::string &portname, Command cmd)
Submits command to transport, assigned with the port.
bool SetPortSignaling(const std::string &name, Port::EventsProducing signal)
unsigned FindOutput(const std::string &name) const
std::vector< ModuleItem * > fItems
map for fast search of module items
virtual void ObjectCleanup()
Inherited method, called during module destroy.
unsigned OutputQueueCapacity(unsigned indx=0) const
virtual bool Find(ConfigIO &cfg)
Method to locate object in xml file.
virtual void AfterModuleStop()
unsigned NumPools() const
unsigned FindPool(const std::string &name) const
void RemoveModuleItem(ModuleItem *item)
void ProduceOutputEvent(unsigned indx=0, unsigned cnt=1)
ModuleItem * GetItem(unsigned id) const
std::vector< Timer * > fTimers
array of timers
virtual Parameter CreatePar(const std::string &name, const std::string &kind="")
bool IsRunning() const
Returns true if module if running.
bool IsPortConnected(const std::string &name) const
bool IsValidInput(unsigned indx=0) const
virtual void BuildFieldsMap(RecordFieldsMap *cont)
Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager.
PoolHandle * Pool(unsigned n=0) const
bool IsOutputConnected(unsigned indx=0) const
void SetAutoStop(bool on=true)
If set, module will be automatically stopped when all i/o ports are disconnected.
OutputPort * Output(unsigned n=0) const
bool IsValidOutput(unsigned indx=0) const
std::string OutputName(unsigned indx=0, bool fullname=false) const
bool InputQueueFull(unsigned indx=0) const
virtual void OnThreadAssigned()
bool CanSendToAllOutputs(bool exclude_disconnected=true) const
std::string PoolName(unsigned indx=0, bool fullname=false) const
virtual void ProcessEvent(const EventId &)
bool IsValidPool(unsigned indx=0) const
bool fRunState
true if module in the running state
bool BindPorts(const std::string &inpname, const std::string &outname)
Bind input and output ports that both will share same connection.
std::string InputName(unsigned indx=0, bool fullname=false) const
bool IsInputConnected(unsigned indx=0) const
void ProduceUserItemEvent(unsigned indx=0, unsigned cnt=1)
virtual void ProcessConnectionActivated(const std::string &name, bool on)
dabc::Reference fDfltPool
direct reference on memory pool, used when no pool handles are not created
bool IsPoolConnected(unsigned indx=0) const
unsigned FindInput(const std::string &name) const
unsigned FindUserItem(const std::string &name)
virtual const char * ClassName() const
Returns class name of the object instance.
unsigned NumTimers() const
unsigned CreatePoolHandle(const std::string &poolname, unsigned queue=10)
Creates handle for memory pool, which preserves reference on memory pool and provides fast access to ...
virtual void SetModulePriority(int pri=-1)
void SetInfoParName(const std::string &name)
unsigned NumOutputs() const
unsigned CreateUserItem(const std::string &name)
bool SetPortLoopLength(const std::string &name, unsigned cnt)
void AddModuleItem(ModuleItem *item)
EventId ConstructUserItemEvent(unsigned indx=0)
std::string GetInfoParName() const
void ShootTimer(const std::string &name, double delay_sec=0.)
bool fAutoStop
module will automatically stop when all i/o ports will be disconnected
virtual bool ReplyCommand(Command cmd)
Reimplement this method to react on command reply Return true if command can be destroyed by framewor...
unsigned NumInputs() const
unsigned fSysTimerIndex
index of timer, which will be used with module itself
virtual int PreviewCommand(Command cmd)
This method called before command will be executed.
virtual double ProcessTimeout(double last_diff)
void ShootTimer(unsigned indx, double delay_sec=0.)
std::string UserItemName(unsigned indx=0, bool fullname=false) const
unsigned CreateInput(const std::string &name, unsigned queue=10)
void DisconnectAllPorts(bool witherr=false)
Method disconnects all module ports, should be called only from Module thread.
bool IsAutoPool(unsigned indx=0) const
Returns true when handle automatically delivers buffers via the connection.
void ProduceInputEvent(unsigned indx=0, unsigned cnt=1)
unsigned CreateOutput(const std::string &name, unsigned queue=10)
std::vector< OutputPort * > fOutputs
array of output ports
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
virtual void ModuleCleanup()
Method, which can be reimplemented by user and should cleanup all references on buffers and other obj...
std::vector< ModuleItem * > fUsers
array of user items
std::string fPublishPars
path where module pars will be published
void ProducePoolEvent(unsigned indx=0, unsigned cnt=1)
unsigned CreateTimer(const std::string &name, double period_sec=-1., bool synchron=false)
std::string fInfoParName
full name of parameter, used as info
PortRef FindPort(const std::string &name) const
virtual void ProcessItemEvent(ModuleItem *item, uint16_t evid)
bool Stop()
Stops execution of the module code.
std::string TimerName(unsigned n=0, bool fullname=false) const
bool DisconnectPort(const std::string &name, bool witherr=false)
Disconnect port from transport.
bool Start()
Starts execution of the module code.
void EnsurePorts(unsigned numinp=0, unsigned numout=0, const std::string &poolname="")
Method ensure that at least specified number of input and output ports will be created.
bool SetPortRatemeter(const std::string &name, const Parameter &ref)
unsigned InputQueueCapacity(unsigned indx=0) const
std::vector< InputPort * > fInputs
array of input ports
virtual void BeforeModuleStart()
InputPort * Input(unsigned n=0) const
std::vector< PoolHandle * > fPools
array of pools
void SendToAllOutputs(Buffer &buf)
unsigned PortQueueCapacity(const std::string &name) const
unsigned FindTimer(const std::string &name)
bool IsValidUserItem(unsigned indx) const
Module(const std::string &name, Command cmd)
bool IsValidTimer(unsigned indx) const
Handle for pool connection.
Reference on the dabc::Port class
unsigned QueueCapacity() const
Returns queue capacity of the port.
Reference on the arbitrary object
Object * GetObject() const
Return pointer on the object.
Provides timer event to the module.
Reference on dabc::Worker
bool Execute(Command cmd, double tmout=-1.)
Active object, which is working inside dabc::Thread.
bool ActivateTimeout(double tmout_sec)
Method used to produce timeout events in the worker.
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
virtual bool ReplyCommand(Command cmd)
Reimplement this method to react on command reply Return true if command can be destroyed by framewor...
Event structure, exchanged between DABC threads.