DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
dabc::Module Class Reference

Base for dabc::ModuleSync and dabc::ModuleAsync classes. More...

#include <dabc/Module.h>

Inheritance diagram for dabc::Module:
dabc::Worker dabc::Object dabc::ModuleAsync dabc::ModuleSync dabc::ConnectionManager dabc::CpuInfoModule dabc::MemoryPool dabc::MultiplexerModule dabc::RepeaterModule dabc::Transport fesa::Player gosip::Player hadaq::BnetMasterModule hadaq::CombinerModule hadaq::MonitorModule hadaq::SorterModule hadaq::TerminalModule mbs::CombinerModule mbs::MonitorSlowControl mbs::ReadoutModule stream::RecalibrateModule stream::RunModule stream::TdcCalibrationModule

Public Member Functions

virtual const char * ClassName () const
 Returns class name of the object instance. More...
 
std::string GetInfoParName () const
 
- Public Member Functions inherited from dabc::Worker
bool ActivateTimeout (double tmout_sec)
 Method used to produce timeout events in the worker. More...
 
Command Assign (Command cmd)
 ! Assign command with processor before command be submitted to other processor This produce ReplyCommand() call when command execution is finished Command itself returned if operation was successful, otherwise null() command More...
 
void AssignAddon (WorkerAddon *addon)
 Assigns addon to the worker Should be called before worker assigned to the thread. More...
 
bool AssignToThread (ThreadRef thrd, bool sync=true)
 Assign worker to thread, worker becomes active immediately. More...
 
bool CanSubmitCommand () const
 Returns true if command can be submitted to worker. More...
 
RecordField Cfg (const std::string &name, Command cmd=nullptr) const
 Returns configuration field of specified name Configuration value of specified name searched in following places: More...
 
bool DettachFromThread ()
 Detach worker from the thread, later worker can be assigned to some other thread Method especially useful to normally finish object recursion (if it possible). More...
 
bool Execute (Command cmd, double tmout=-1.)
 Execute command in the processor. More...
 
bool Execute (const std::string &cmd, double tmout=-1.)
 
bool HasThread () const
 Indicates if pointer on thread is not zero; thread-safe. More...
 
bool IsOwnThread () const
 Returns true if called from thread. More...
 
bool MakeThreadForWorker (const std::string &thrdname="")
 Creates appropriate thread for worker and assign worker to the thread. More...
 
Parameter Par (const std::string &name) const
 Returns reference on worker parameter object. More...
 
virtual std::string RequiredThrdClass () const
 Method returns name of required thread class for processor. More...
 
void SetWorkerPriority (int nq)
 
bool Submit (Command cmd)
 Submit command for execution in the processor. More...
 
ThreadRef thread ()
 Return reference on the worker thread; thread-safe. More...
 
std::string ThreadName () const
 Returns name of the worker thread; thread-safe
More...
 
 Worker (Reference parent, const std::string &name)
 
std::string WorkerAddress (bool full=true)
 Return address, which can be used to submit command to the worker If full specified, command can be submitted from any node, which has connection to this node. More...
 
uint32_t WorkerId () const
 
int WorkerPriority () const
 
virtual ~Worker ()
 
- Public Member Functions inherited from dabc::Object
bool AddChild (Object *child, bool withmutex=true) throw ()
 Add object to list of child objects, thread safe More...
 
bool AddChildAt (Object *child, unsigned pos, bool withmutex=true)
 Add object to list of child objects at specified position. More...
 
ObjectFindChild (const char *name) const
 returns pointer on child object with given name More...
 
Reference FindChildRef (const char *name, bool force=false) const throw ()
 returns reference on child object with given name More...
 
bool GetAllChildRef (ReferencesVector *vect) const
 
ObjectGetChild (unsigned n) const
 returns pointer on child object More...
 
Reference GetChildRef (unsigned n) const
 returns reference on child object More...
 
Reference GetFolder (const std::string &name, bool force=false) throw ()
 Return folder of specified name, no special symbols allowed. More...
 
const char * GetName () const
 Returns name of the object, thread safe More...
 
ObjectGetParent () const
 Returns pointer on parent object, thread safe More...
 
Reference GetParentRef () const
 
bool IsChildsHidden () const
 Return true if object wants to hide childs from hierarchy scan, thread safe More...
 
bool IsHidden () const
 Return true if object wants to be hidden from hierarchy scan, thread safe More...
 
bool IsLogging () const
 Return true if object selected for logging, thread safe More...
 
bool IsName (const char *str) const
 Checks if object name is same as provided string, thread safe More...
 
bool IsName (const char *str, int len) const
 Checks if object name is same as provided, thread safe More...
 
bool IsName (const std::string &str) const
 Checks if object name is same as provided string, thread safe More...
 
bool IsNameMatch (const std::string &mask) const
 Check if object name match to the mask. More...
 
bool IsOwner () const
 Returns true if object is owner of its children, thread safe More...
 
bool IsParent (Object *obj) const
 Checks if specified argument is in the list of object parents. More...
 
bool IsTopXmlLevel () const
 Return true if object should be searched in the top level of the xml file, thread safe More...
 
std::string ItemName (bool compact=true) const
 Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call. More...
 
unsigned NumChilds () const
 returns number of child objects More...
 
 Object (const std::string &name, unsigned flags=flIsOwner)
 Resolve problem with child-parent mutex locking. More...
 
 Object (Reference parent, const std::string &name, unsigned flags=flIsOwner)
 
virtual void Print (int lvl=0)
 Print object content on debug output. More...
 
bool RemoveChild (Object *child, bool cleanup=true) throw ()
 Detach child from parent object If cleanup==true and parent is owner of child, child will be destroyed. More...
 
bool RemoveChildAt (unsigned n, bool cleanup=true) throw ()
 Detach child object from parent at specified position If cleanup==true and object is owner of child, child will be destroyed. More...
 
bool RemoveChilds (bool cleanup=true)
 Remove all childs. More...
 
void SetLogging (bool on=true)
 Sets logging flag, thread safe More...
 
virtual ~Object ()
 

Protected Member Functions

virtual void AfterModuleStop ()
 
virtual void BeforeModuleStart ()
 
bool BindPorts (const std::string &inpname, const std::string &outname)
 Bind input and output ports that both will share same connection. More...
 
virtual void BuildFieldsMap (RecordFieldsMap *cont)
 Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager. More...
 
bool CanSendToAllOutputs (bool exclude_disconnected=true) const
 
EventId ConstructUserItemEvent (unsigned indx=0)
 
unsigned CreateInput (const std::string &name, unsigned queue=10)
 
unsigned CreateOutput (const std::string &name, unsigned queue=10)
 
virtual Parameter CreatePar (const std::string &name, const std::string &kind="")
 
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 memory pool functionality. More...
 
unsigned CreateTimer (const std::string &name, double period_sec=-1., bool synchron=false)
 
unsigned CreateUserItem (const std::string &name)
 
void DisconnectAllPorts (bool witherr=false)
 Method disconnects all module ports, should be called only from Module thread. More...
 
bool DisconnectPort (const std::string &name, bool witherr=false)
 Disconnect port from transport. More...
 
virtual bool DoStart ()
 
virtual bool DoStop ()
 
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. More...
 
virtual int ExecuteCommand (Command cmd)
 Main method where commands are executed. More...
 
virtual bool Find (ConfigIO &cfg)
 Method to locate object in xml file. More...
 
unsigned FindInput (const std::string &name) const
 
unsigned FindOutput (const std::string &name) const
 
unsigned FindPool (const std::string &name) const
 
PortRef FindPort (const std::string &name) const
 
unsigned FindTimer (const std::string &name)
 
unsigned FindUserItem (const std::string &name)
 
ModuleItemGetItem (unsigned id) const
 
std::string InputName (unsigned indx=0, bool fullname=false) const
 
unsigned InputQueueCapacity (unsigned indx=0) const
 
bool InputQueueFull (unsigned indx=0) const
 
bool IsAutoPool (unsigned indx=0) const
 Returns true when handle automatically delivers buffers via the connection. More...
 
bool IsInputConnected (unsigned indx=0) const
 
bool IsOutputConnected (unsigned indx=0) const
 
bool IsPoolConnected (unsigned indx=0) const
 
bool IsPortConnected (const std::string &name) const
 
bool IsRunning () const
 Returns true if module if running. More...
 
bool IsValidInput (unsigned indx=0) const
 
bool IsValidOutput (unsigned indx=0) const
 
bool IsValidPool (unsigned indx=0) const
 
bool IsValidTimer (unsigned indx) const
 
bool IsValidUserItem (unsigned indx) const
 
virtual void ModuleCleanup ()
 Method, which can be reimplemented by user and should cleanup all references on buffers and other objects. More...
 
unsigned NumInputs () const
 
unsigned NumOutputs () const
 
unsigned NumPools () const
 
unsigned NumTimers () const
 
virtual void ObjectCleanup ()
 Inherited method, called during module destroy. More...
 
virtual void OnThreadAssigned ()
 
std::string OutputName (unsigned indx=0, bool fullname=false) const
 
unsigned OutputQueueCapacity (unsigned indx=0) const
 
std::string PoolName (unsigned indx=0, bool fullname=false) const
 
unsigned PortQueueCapacity (const std::string &name) const
 
virtual int PreviewCommand (Command cmd)
 This method called before command will be executed. More...
 
virtual void ProcessConnectionActivated (const std::string &name, bool on)
 
virtual void ProcessEvent (const EventId &)
 
virtual void ProcessItemEvent (ModuleItem *item, uint16_t evid)
 
virtual double ProcessTimeout (double last_diff)
 
void ProduceInputEvent (unsigned indx=0, unsigned cnt=1)
 
void ProduceOutputEvent (unsigned indx=0, unsigned cnt=1)
 
void ProducePoolEvent (unsigned indx=0, unsigned cnt=1)
 
void ProduceUserItemEvent (unsigned indx=0, unsigned cnt=1)
 
virtual bool ReplyCommand (Command cmd)
 Reimplement this method to react on command reply Return true if command can be destroyed by framework. More...
 
void SendToAllOutputs (Buffer &buf)
 
void SetAutoStop (bool on=true)
 If set, module will be automatically stopped when all i/o ports are disconnected. More...
 
void SetInfoParName (const std::string &name)
 
virtual void SetModulePriority (int pri=-1)
 
bool SetPortLoopLength (const std::string &name, unsigned cnt)
 
bool SetPortRatemeter (const std::string &name, const Parameter &ref)
 
bool SetPortSignaling (const std::string &name, Port::EventsProducing signal)
 
void ShootTimer (const std::string &name, double delay_sec=0.)
 
void ShootTimer (unsigned indx, double delay_sec=0.)
 
bool Start ()
 Starts execution of the module code. More...
 
bool Stop ()
 Stops execution of the module code. More...
 
bool SubmitCommandToTransport (const std::string &portname, Command cmd)
 Submits command to transport, assigned with the port. More...
 
std::string TimerName (unsigned n=0, bool fullname=false) const
 
std::string UserItemName (unsigned indx=0, bool fullname=false) const
 
- Protected Member Functions inherited from dabc::Worker
bool _FireDoNothingEvent ()
 
bool _FireEvent (uint16_t evid)
 
bool _FireEvent (uint16_t evid, uint32_t arg, int pri=-1)
 
bool _IsFireEvent () const
 
bool ActivateMainLoop ()
 
virtual void BeforeHierarchyScan (Hierarchy &h)
 Method called before publisher makes next snapshot of hierarchy. More...
 
void CancelCommands ()
 
void CleanupPublisher (bool sync=true)
 Release reference on publisher and unsubscribe/unpublish all registered entries. More...
 
CommandDefinition CreateCmdDef (const std::string &name)
 
virtual bool DestroyByOwnThread ()
 Inherited method from Object, invoked at the moment when worker requested to be destroyed by its thread. More...
 
bool DestroyPar (const std::string &name)
 Method must be used if worker wants to destroy parameter. More...
 
virtual void DoWorkerAfterMainLoop ()
 Internal - function executed after leaving main loop. More...
 
virtual void DoWorkerMainLoop ()
 Internal - entrance function for main loop execution. More...
 
bool ExecuteIn (Worker *dest, Command cmd)
 Executes command in specified worker. More...
 
bool FireEvent (uint16_t evid)
 
bool FireEvent (uint16_t evid, uint32_t arg, int pri=-1)
 
Reference GetPublisher ()
 Return reference on publisher. More...
 
bool IsWorkerActive () const
 Method indicates if worker is running in the thread and accepts normal events. More...
 
virtual void ObjectDestroyed (Object *)
 Method to clear object reference, will be called from thread context (when possible) More...
 
virtual void ProcessParameterEvent (const ParameterEvent &evnt)
 Interface method to retrieve subscribed parameter events. More...
 
virtual bool Publish (const Hierarchy &h, const std::string &path)
 
virtual bool PublishPars (const std::string &path)
 
bool RegisterForParameterEvent (const std::string &mask, bool onlychangeevent=true)
 Subscribe to parameter events from local or remote node. More...
 
void SetParValue (const std::string &name, const RecordField &v)
 Set parameter value and sync with worker hierarchy. More...
 
void SetWorkerCfgId (int id=-1)
 Set identifier which can be used in XML configuration ${}# formula It means that correspondent to the ID element of array will be extracted. More...
 
bool SingleLoop (double tmout)
 
virtual bool Subscribe (const std::string &path)
 
virtual bool Unpublish (const Hierarchy &h, const std::string &path)
 
bool UnregisterForParameterEvent (const std::string &mask)
 Unsubscribe to parameter events from local or remote node. More...
 
virtual bool Unsubscribe (const std::string &path)
 
 Worker (const ConstructorPair &pair)
 Special constructor, designed for inherited classes. More...
 
void WorkerSleep (double tmout)
 
- Protected Member Functions inherited from dabc::Object
virtual void _ChildsChanged ()
 Method called when new childs are add or old are removed. More...
 
virtual bool _DoDeleteItself ()
 This method is called at the moment when DecReference think that object can be destroyed and wants to return true. More...
 
bool _IsNormalState ()
 Same as IsNormalState() but without mutex lock - user should lock mutex himself. More...
 
virtual ObjectCreateInstance (const std::string &name)
 Method used to create new item to be placed as child of the object. More...
 
void DeleteThis ()
 Method should be used by the object to delete itself. More...
 
bool DestroyCalledFromOwnThread ()
 Internal DABC method, should be called by thread which was requested to destroy object. More...
 
void FillFullName (std::string &fullname, Object *upto, bool exclude_top_parent=false) const
 Method used to produce full item name,. More...
 
bool GetFlag (unsigned fl) const
 Return value of selected flag, not thread safe
More...
 
bool IsNormalState ()
 Return true if object is in normal state. More...
 
unsigned NumReferences ()
 Return number of references on the object. More...
 
 Object (const ConstructorPair &pair, unsigned flags=flIsOwner)
 
MutexObjectMutex () const
 Returns mutex, used for protection of Object data members. More...
 
void SetAutoDestroy (bool on=true)
 Set autodestroy flag for the object Once enabled, object will be destroyed when last reference will be cleared. More...
 
void SetFlag (unsigned fl, bool on=true)
 Change value of selected flag, not thread safe
More...
 
void SetName (const char *name)
 Changes object name. More...
 
void SetNameDirect (const char *name)
 Changes object name disregard of existing references. More...
 
void SetOwner (bool on=true)
 Specifies if object will be owner of its new childs. More...
 

Protected Attributes

bool fAutoStop
 module will automatically stop when all i/o ports will be disconnected More...
 
dabc::Reference fDfltPool
 direct reference on memory pool, used when no pool handles are not created More...
 
std::string fInfoParName
 full name of parameter, used as info More...
 
std::vector< InputPort * > fInputs
 array of input ports More...
 
std::vector< ModuleItem * > fItems
 map for fast search of module items More...
 
std::vector< OutputPort * > fOutputs
 array of output ports More...
 
std::vector< PoolHandle * > fPools
 array of pools More...
 
std::string fPublishPars
 path where module pars will be published More...
 
bool fRunState
 true if module in the running state More...
 
unsigned fSysTimerIndex
 index of timer, which will be used with module itself More...
 
std::vector< Timer * > fTimers
 array of timers More...
 
std::vector< ModuleItem * > fUsers
 array of user items More...
 
- Protected Attributes inherited from dabc::Worker
WorkerAddonRef fAddon
 extension of worker for some special events More...
 
Reference fPublisher
 reference on publisher, once found, remain until end of object live More...
 
ThreadRef fThread
 reference on the thread, once assigned remain whole time More...
 
MutexfThreadMutex
 pointer on main thread mutex More...
 
bool fWorkerActive
 indicates if worker can submit events to the thread More...
 
int fWorkerCfgId
 special ID, can be used in XML configuration in ${}# formula More...
 
CommandsQueue fWorkerCommands
 all kinds of commands, processed by the worker More...
 
int fWorkerCommandsLevel
 Number of process commands recursion. More...
 
unsigned fWorkerFiredEvents
 indicate current balance between fired and processed events, used to correctly halt worker More...
 
Hierarchy fWorkerHierarchy
 place for publishing of worker parameters More...
 
uint32_t fWorkerId
 worker id in thread list, used for events submit More...
 
int fWorkerPriority
 priority of events, submitted by worker to the thread More...
 
- Protected Attributes inherited from dabc::Object
int fObjectBlock
 counter for blocking calls, as long as non-zero, non of child can be removed More...
 
ReferencesVectorfObjectChilds
 list of the child objects More...
 
unsigned fObjectFlags
 flag, protected by the mutex More...
 
MutexfObjectMutex
 mutex protects all private property of the object More...
 
std::string fObjectName
 object name More...
 
Reference fObjectParent
 reference on the parent object More...
 
int fObjectRefCnt
 accounts how many references existing on the object, thread safe More...
 

Private Member Functions

void AddModuleItem (ModuleItem *item)
 
InputPortInput (unsigned n=0) const
 
 Module (const std::string &name, Command cmd)
 
OutputPortOutput (unsigned n=0) const
 
PoolHandlePool (unsigned n=0) const
 
void RemoveModuleItem (ModuleItem *item)
 
Buffer TakeDfltBuffer ()
 
virtual ~Module ()
 

Friends

class ConnTimer
 
class Manager
 
class ModuleAsync
 
class ModuleItem
 
class ModuleRef
 
class ModuleSync
 
class Timer
 

Additional Inherited Members

- Public Types inherited from dabc::Worker
enum  EPriotiryLevels { priorityMaximum = 0 , priorityMinimum = -1 , priorityDefault = -7 , priorityMagic = -77 }
 
enum  EWorkerEventsCodes { evntFirstCore = 1 , evntFirstAddOn = 100 , evntFirstSystem = 200 , evntFirstUser = 1000 }
 
- Static Public Member Functions inherited from dabc::Worker
static int cmd_bool (bool v)
 
- Static Public Member Functions inherited from dabc::Object
static void Destroy (Object *obj) throw ()
 User method for object destroyment. More...
 
static void InspectGarbageCollector ()
 \ brief Methods to inspect how many objects pointers are remained More...
 
static bool NameMatch (const std::string &name, const std::string &mask)
 Check if name matches to specified mask. More...
 
static bool NameMatchM (const std::string &name, const std::string &mask)
 Check if name matches to specified mask. More...
 
static unsigned NumInstances ()
 Static variable counts total number of objects instances. More...
 
- Protected Types inherited from dabc::Object
enum  EFlags {
  flStateMask = 0x000f , flIsOwner = 0x0010 , flCleanup = 0x0020 , flHasThread = 0x0040 ,
  flAutoDestroy = 0x0080 , flLogging = 0x0100 , flNoMutex = 0x0200 , flHidden = 0x0400 ,
  flChildsHidden = 0x0800 , flTopXmlLevel = 0x1000
}
 
- Static Protected Member Functions inherited from dabc::Object
static ConstructorPair MakePair (const std::string &fullname, bool withmanager=true)
 Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More...
 
static ConstructorPair MakePair (Object *prnt, const std::string &fullname, bool withmanager=true)
 Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More...
 
static ConstructorPair MakePair (Reference prnt, const std::string &fullname, bool withmanager=true)
 Internal DABC method, used to produce pair - object parent and object name, which is typically should be used as argument in class constructor. More...
 

Detailed Description

Base for dabc::ModuleSync and dabc::ModuleAsync classes.

Definition at line 42 of file Module.h.

Constructor & Destructor Documentation

◆ Module()

dabc::Module::Module ( const std::string &  name,
Command  cmd 
)
private

Definition at line 24 of file Module.cxx.

◆ ~Module()

dabc::Module::~Module ( )
privatevirtual

Definition at line 59 of file Module.cxx.

Member Function Documentation

◆ AddModuleItem()

void dabc::Module::AddModuleItem ( ModuleItem item)
private

Definition at line 629 of file Module.cxx.

◆ RemoveModuleItem()

void dabc::Module::RemoveModuleItem ( ModuleItem item)
private

Definition at line 651 of file Module.cxx.

◆ TakeDfltBuffer()

dabc::Buffer dabc::Module::TakeDfltBuffer ( )
private

Definition at line 258 of file Module.cxx.

◆ Pool()

PoolHandle* dabc::Module::Pool ( unsigned  n = 0) const
inlineprivate

Definition at line 77 of file Module.h.

◆ Output()

OutputPort* dabc::Module::Output ( unsigned  n = 0) const
inlineprivate

Definition at line 78 of file Module.h.

◆ Input()

InputPort* dabc::Module::Input ( unsigned  n = 0) const
inlineprivate

Definition at line 79 of file Module.h.

◆ ObjectCleanup()

void dabc::Module::ObjectCleanup ( )
protectedvirtual

Inherited method, called during module destroy.

Used to stop module if it is still running.

Reimplemented from dabc::Worker.

Reimplemented in dabc::ModuleSync.

Definition at line 536 of file Module.cxx.

◆ DoStop()

bool dabc::Module::DoStop ( )
protectedvirtual

Definition at line 586 of file Module.cxx.

◆ DoStart()

bool dabc::Module::DoStart ( )
protectedvirtual

Reimplemented in dabc::ModuleAsync.

Definition at line 563 of file Module.cxx.

◆ OnThreadAssigned()

void dabc::Module::OnThreadAssigned ( )
protectedvirtual

◆ PreviewCommand()

int dabc::Module::PreviewCommand ( Command  cmd)
protectedvirtual

This method called before command will be executed.

Only if cmd_ignore is returned, ExecuteCommand will be called for this command Otherwise command is replied with returned value Contrary to ExecuteCommand, PreviewCommand used by dabc classes itself. Therefore, if method redefined in inherited class, one should always call PreviewCommand of base class first.

Reimplemented from dabc::Worker.

Reimplemented in dabc::ModuleSync.

Definition at line 311 of file Module.cxx.

◆ SetModulePriority()

void dabc::Module::SetModulePriority ( int  pri = -1)
protectedvirtual

Definition at line 284 of file Module.cxx.

◆ ProcessEvent()

void dabc::Module::ProcessEvent ( const EventId evid)
protectedvirtual

Reimplemented from dabc::Worker.

Reimplemented in dabc::MemoryPool, and dabc::OutputTransport.

Definition at line 822 of file Module.cxx.

◆ ProcessTimeout()

double dabc::Module::ProcessTimeout ( double  last_diff)
protectedvirtual

Reimplemented from dabc::Worker.

Reimplemented in dabc::ConnectionManager.

Definition at line 554 of file Module.cxx.

◆ Find()

bool dabc::Module::Find ( ConfigIO cfg)
protectedvirtual

Method to locate object in xml file.

Can be reimplemented in derived classes to check more attributes like class name

Reimplemented from dabc::Worker.

Reimplemented in dabc::MemoryPool.

Definition at line 516 of file Module.cxx.

◆ BuildFieldsMap()

void dabc::Module::BuildFieldsMap ( RecordFieldsMap cont)
protectedvirtual

Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager.

Reimplemented from dabc::Object.

Definition at line 530 of file Module.cxx.

◆ Start()

bool dabc::Module::Start ( )
protected

Starts execution of the module code.

Definition at line 240 of file Module.cxx.

◆ IsRunning()

bool dabc::Module::IsRunning ( ) const
inlineprotected

Returns true if module if running.

Definition at line 109 of file Module.h.

◆ Stop()

bool dabc::Module::Stop ( )
protected

Stops execution of the module code.

Definition at line 249 of file Module.cxx.

◆ SetAutoStop()

void dabc::Module::SetAutoStop ( bool  on = true)
inlineprotected

If set, module will be automatically stopped when all i/o ports are disconnected.

Definition at line 115 of file Module.h.

◆ CreatePoolHandle()

unsigned dabc::Module::CreatePoolHandle ( const std::string &  poolname,
unsigned  queue = 10 
)
protected

Creates handle for memory pool, which preserves reference on memory pool and provides fast access to memory pool functionality.

Memory pool should exist before handle can be created Returns index of pool handle, which can be used later with operation like TakeBuffer

Definition at line 607 of file Module.cxx.

◆ CreateInput()

unsigned dabc::Module::CreateInput ( const std::string &  name,
unsigned  queue = 10 
)
protected

Definition at line 704 of file Module.cxx.

◆ CreateOutput()

unsigned dabc::Module::CreateOutput ( const std::string &  name,
unsigned  queue = 10 
)
protected

Definition at line 727 of file Module.cxx.

◆ CreateTimer()

unsigned dabc::Module::CreateTimer ( const std::string &  name,
double  period_sec = -1.,
bool  synchron = false 
)
protected

Definition at line 109 of file Module.cxx.

◆ CreateUserItem()

unsigned dabc::Module::CreateUserItem ( const std::string &  name)
protected

Definition at line 203 of file Module.cxx.

◆ EnsurePorts()

void dabc::Module::EnsurePorts ( unsigned  numinp = 0,
unsigned  numout = 0,
const std::string &  poolname = "" 
)
protected

Method ensure that at least specified number of input and output ports will be created.

Definition at line 66 of file Module.cxx.

◆ BindPorts()

bool dabc::Module::BindPorts ( const std::string &  inpname,
const std::string &  outname 
)
protected

Bind input and output ports that both will share same connection.

In local case ports will be connected to appropriate pair of bind ports from other module

Definition at line 750 of file Module.cxx.

◆ NumOutputs()

unsigned dabc::Module::NumOutputs ( ) const
inlineprotected

Definition at line 141 of file Module.h.

◆ IsValidOutput()

bool dabc::Module::IsValidOutput ( unsigned  indx = 0) const
inlineprotected

Definition at line 142 of file Module.h.

◆ IsOutputConnected()

bool dabc::Module::IsOutputConnected ( unsigned  indx = 0) const
inlineprotected

Definition at line 143 of file Module.h.

◆ OutputQueueCapacity()

unsigned dabc::Module::OutputQueueCapacity ( unsigned  indx = 0) const
inlineprotected

Definition at line 144 of file Module.h.

◆ FindOutput()

unsigned dabc::Module::FindOutput ( const std::string &  name) const
protected

Definition at line 157 of file Module.cxx.

◆ OutputName()

std::string dabc::Module::OutputName ( unsigned  indx = 0,
bool  fullname = false 
) const
protected

Definition at line 181 of file Module.cxx.

◆ NumInputs()

unsigned dabc::Module::NumInputs ( ) const
inlineprotected

Definition at line 148 of file Module.h.

◆ IsValidInput()

bool dabc::Module::IsValidInput ( unsigned  indx = 0) const
inlineprotected

Definition at line 149 of file Module.h.

◆ IsInputConnected()

bool dabc::Module::IsInputConnected ( unsigned  indx = 0) const
inlineprotected

Definition at line 150 of file Module.h.

◆ InputQueueFull()

bool dabc::Module::InputQueueFull ( unsigned  indx = 0) const
inlineprotected

Definition at line 151 of file Module.h.

◆ InputQueueCapacity()

unsigned dabc::Module::InputQueueCapacity ( unsigned  indx = 0) const
inlineprotected

Definition at line 152 of file Module.h.

◆ FindInput()

unsigned dabc::Module::FindInput ( const std::string &  name) const
protected

Definition at line 165 of file Module.cxx.

◆ InputName()

std::string dabc::Module::InputName ( unsigned  indx = 0,
bool  fullname = false 
) const
protected

Definition at line 188 of file Module.cxx.

◆ NumPools()

unsigned dabc::Module::NumPools ( ) const
inlineprotected

Definition at line 156 of file Module.h.

◆ IsValidPool()

bool dabc::Module::IsValidPool ( unsigned  indx = 0) const
inlineprotected

Definition at line 157 of file Module.h.

◆ IsPoolConnected()

bool dabc::Module::IsPoolConnected ( unsigned  indx = 0) const
inlineprotected

Definition at line 158 of file Module.h.

◆ FindPool()

unsigned dabc::Module::FindPool ( const std::string &  name) const
protected

Definition at line 173 of file Module.cxx.

◆ PoolName()

std::string dabc::Module::PoolName ( unsigned  indx = 0,
bool  fullname = false 
) const
protected

Definition at line 195 of file Module.cxx.

◆ IsAutoPool()

bool dabc::Module::IsAutoPool ( unsigned  indx = 0) const
inlineprotected

Returns true when handle automatically delivers buffers via the connection.

Definition at line 162 of file Module.h.

◆ FindPort()

dabc::PortRef dabc::Module::FindPort ( const std::string &  name) const
protected

Definition at line 699 of file Module.cxx.

◆ IsPortConnected()

bool dabc::Module::IsPortConnected ( const std::string &  name) const
protected

Definition at line 785 of file Module.cxx.

◆ DisconnectPort()

bool dabc::Module::DisconnectPort ( const std::string &  name,
bool  witherr = false 
)
protected

Disconnect port from transport.

Should be called only from Module thread

Definition at line 269 of file Module.cxx.

◆ DisconnectAllPorts()

void dabc::Module::DisconnectAllPorts ( bool  witherr = false)
protected

Method disconnects all module ports, should be called only from Module thread.

Definition at line 292 of file Module.cxx.

◆ SubmitCommandToTransport()

bool dabc::Module::SubmitCommandToTransport ( const std::string &  portname,
Command  cmd 
)
protected

Submits command to transport, assigned with the port.

Definition at line 301 of file Module.cxx.

◆ PortQueueCapacity()

unsigned dabc::Module::PortQueueCapacity ( const std::string &  name) const
inlineprotected

Definition at line 177 of file Module.h.

◆ SetPortSignaling()

bool dabc::Module::SetPortSignaling ( const std::string &  name,
Port::EventsProducing  signal 
)
protected

Definition at line 791 of file Module.cxx.

◆ SetPortRatemeter()

bool dabc::Module::SetPortRatemeter ( const std::string &  name,
const Parameter ref 
)
protected

Definition at line 802 of file Module.cxx.

◆ SetPortLoopLength()

bool dabc::Module::SetPortLoopLength ( const std::string &  name,
unsigned  cnt 
)
protected

Definition at line 812 of file Module.cxx.

◆ FindTimer()

unsigned dabc::Module::FindTimer ( const std::string &  name)
protected

Definition at line 100 of file Module.cxx.

◆ IsValidTimer()

bool dabc::Module::IsValidTimer ( unsigned  indx) const
inlineprotected

Definition at line 183 of file Module.h.

◆ NumTimers()

unsigned dabc::Module::NumTimers ( ) const
inlineprotected

Definition at line 184 of file Module.h.

◆ TimerName()

std::string dabc::Module::TimerName ( unsigned  n = 0,
bool  fullname = false 
) const
protected

Definition at line 93 of file Module.cxx.

◆ ShootTimer() [1/2]

void dabc::Module::ShootTimer ( unsigned  indx,
double  delay_sec = 0. 
)
inlineprotected

Definition at line 187 of file Module.h.

◆ ShootTimer() [2/2]

void dabc::Module::ShootTimer ( const std::string &  name,
double  delay_sec = 0. 
)
inlineprotected

Definition at line 195 of file Module.h.

◆ GetItem()

ModuleItem* dabc::Module::GetItem ( unsigned  id) const
inlineprotected

Definition at line 198 of file Module.h.

◆ FindUserItem()

unsigned dabc::Module::FindUserItem ( const std::string &  name)
protected

Definition at line 219 of file Module.cxx.

◆ IsValidUserItem()

bool dabc::Module::IsValidUserItem ( unsigned  indx) const
inlineprotected

Definition at line 201 of file Module.h.

◆ UserItemName()

std::string dabc::Module::UserItemName ( unsigned  indx = 0,
bool  fullname = false 
) const
protected

Definition at line 227 of file Module.cxx.

◆ ConstructUserItemEvent()

EventId dabc::Module::ConstructUserItemEvent ( unsigned  indx = 0)
inlineprotected

Definition at line 203 of file Module.h.

◆ CreatePar()

dabc::Parameter dabc::Module::CreatePar ( const std::string &  name,
const std::string &  kind = "" 
)
protectedvirtual

Reimplemented from dabc::Worker.

Definition at line 129 of file Module.cxx.

◆ SetInfoParName()

void dabc::Module::SetInfoParName ( const std::string &  name)
protected

Definition at line 143 of file Module.cxx.

◆ CanSendToAllOutputs()

bool dabc::Module::CanSendToAllOutputs ( bool  exclude_disconnected = true) const
protected

Definition at line 932 of file Module.cxx.

◆ SendToAllOutputs()

void dabc::Module::SendToAllOutputs ( Buffer buf)
protected

Definition at line 942 of file Module.cxx.

◆ ProduceInputEvent()

void dabc::Module::ProduceInputEvent ( unsigned  indx = 0,
unsigned  cnt = 1 
)
protected

Definition at line 764 of file Module.cxx.

◆ ProduceOutputEvent()

void dabc::Module::ProduceOutputEvent ( unsigned  indx = 0,
unsigned  cnt = 1 
)
protected

Definition at line 779 of file Module.cxx.

◆ ProducePoolEvent()

void dabc::Module::ProducePoolEvent ( unsigned  indx = 0,
unsigned  cnt = 1 
)
protected

Definition at line 772 of file Module.cxx.

◆ ProduceUserItemEvent()

void dabc::Module::ProduceUserItemEvent ( unsigned  indx = 0,
unsigned  cnt = 1 
)
protected

Definition at line 234 of file Module.cxx.

◆ ExecuteCommand()

virtual int dabc::Module::ExecuteCommand ( Command  cmd)
inlineprotectedvirtual

◆ ReplyCommand()

virtual bool dabc::Module::ReplyCommand ( Command  cmd)
inlineprotectedvirtual

Reimplement this method to react on command reply Return true if command can be destroyed by framework.

Reimplemented from dabc::Worker.

Reimplemented in hadaq::CombinerModule, hadaq::TerminalModule, hadaq::BnetMasterModule, and dabc::ConnectionManager.

Definition at line 240 of file Module.h.

◆ BeforeModuleStart()

virtual void dabc::Module::BeforeModuleStart ( )
inlineprotectedvirtual

◆ AfterModuleStop()

virtual void dabc::Module::AfterModuleStop ( )
inlineprotectedvirtual

◆ ModuleCleanup()

virtual void dabc::Module::ModuleCleanup ( )
inlineprotectedvirtual

Method, which can be reimplemented by user and should cleanup all references on buffers and other objects.

Reimplemented in hadaq::CombinerModule, mbs::CombinerModule, gosip::Player, fesa::Player, dabc::Transport, and dabc::ConnectionManager.

Definition at line 249 of file Module.h.

◆ ProcessItemEvent()

virtual void dabc::Module::ProcessItemEvent ( ModuleItem item,
uint16_t  evid 
)
inlineprotectedvirtual

Reimplemented in dabc::ModuleSync, and dabc::ModuleAsync.

Definition at line 252 of file Module.h.

◆ ProcessConnectionActivated()

virtual void dabc::Module::ProcessConnectionActivated ( const std::string &  name,
bool  on 
)
inlineprotectedvirtual

Reimplemented in mbs::ServerTransport, dabc::Transport, and dabc::MemoryPool.

Definition at line 254 of file Module.h.

◆ ClassName()

virtual const char* dabc::Module::ClassName ( ) const
inlinevirtual

Returns class name of the object instance.

In some cases class name used to correctly locate object in xml file

Reimplemented from dabc::Worker.

Reimplemented in dabc::Transport, dabc::NetworkTransport, dabc::ModuleSync, dabc::ModuleAsync, and dabc::MemoryPool.

Definition at line 258 of file Module.h.

◆ GetInfoParName()

std::string dabc::Module::GetInfoParName ( ) const

Definition at line 150 of file Module.cxx.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

Definition at line 44 of file Module.h.

◆ ModuleItem

friend class ModuleItem
friend

Definition at line 45 of file Module.h.

◆ Timer

friend class Timer
friend

Definition at line 46 of file Module.h.

◆ ConnTimer

friend class ConnTimer
friend

Definition at line 47 of file Module.h.

◆ ModuleSync

friend class ModuleSync
friend

Definition at line 48 of file Module.h.

◆ ModuleAsync

friend class ModuleAsync
friend

Definition at line 49 of file Module.h.

◆ ModuleRef

friend class ModuleRef
friend

Definition at line 50 of file Module.h.

Field Documentation

◆ fRunState

bool dabc::Module::fRunState
protected

true if module in the running state

Definition at line 54 of file Module.h.

◆ fItems

std::vector<ModuleItem*> dabc::Module::fItems
protected

map for fast search of module items

Definition at line 55 of file Module.h.

◆ fInputs

std::vector<InputPort*> dabc::Module::fInputs
protected

array of input ports

Definition at line 56 of file Module.h.

◆ fOutputs

std::vector<OutputPort*> dabc::Module::fOutputs
protected

array of output ports

Definition at line 57 of file Module.h.

◆ fPools

std::vector<PoolHandle*> dabc::Module::fPools
protected

array of pools

Definition at line 58 of file Module.h.

◆ fTimers

std::vector<Timer*> dabc::Module::fTimers
protected

array of timers

Definition at line 59 of file Module.h.

◆ fUsers

std::vector<ModuleItem*> dabc::Module::fUsers
protected

array of user items

Definition at line 60 of file Module.h.

◆ fSysTimerIndex

unsigned dabc::Module::fSysTimerIndex
protected

index of timer, which will be used with module itself

Definition at line 61 of file Module.h.

◆ fAutoStop

bool dabc::Module::fAutoStop
protected

module will automatically stop when all i/o ports will be disconnected

Definition at line 62 of file Module.h.

◆ fDfltPool

dabc::Reference dabc::Module::fDfltPool
protected

direct reference on memory pool, used when no pool handles are not created

Definition at line 63 of file Module.h.

◆ fInfoParName

std::string dabc::Module::fInfoParName
protected

full name of parameter, used as info

Definition at line 64 of file Module.h.

◆ fPublishPars

std::string dabc::Module::fPublishPars
protected

path where module pars will be published

Definition at line 65 of file Module.h.


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