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

Manager of everything in DABC More...

#include <dabc/Manager.h>

Inheritance diagram for dabc::Manager:
dabc::Worker dabc::Object

Data Structures

struct  ParamRec
 

Public Member Functions

Configurationcfg () const
 
virtual const char * ClassName () const
 Returns class name of the object instance. More...
 
std::string ComposeAddress (const std::string &server, const std::string &itemtname="")
 Provides string, which can be used as receiver argument. More...
 
bool DecomposeAddress (const std::string &url, bool &islocal, std::string &server, std::string &itemtname)
 From address like dabc://nodeabc:988/item/subtim extracts server (with port) and itemname If server name corresponds to local name, islocal set to true. More...
 
template<class T >
bool DeleteAnyObject (T *obj)
 Delete of any kind of object in manager thread. More...
 
virtual bool DestroyObject (Reference ref)
 Delete derived from Object class object in manager thread. More...
 
virtual bool Find (ConfigIO &cfg)
 Method to locate object in xml file. More...
 
std::string GetLocalAddress ()
 Return address of current application. More...
 
std::string GetNodeAddress (int nodeid)
 Return address of the node to be able communicate with it. More...
 
ThreadsLayout GetThreadsLayout () const
 
void HaltManager ()
 Delete all modules and stop manager thread. More...
 
bool InstallSignalHandlers ()
 
 Manager (const std::string &managername, Configuration *cfg=0)
 
int NodeId () const
 Return nodes id of local node. More...
 
int NumNodes ()
 Returns number of nodes in the cluster FIXME:probably must be removed. More...
 
virtual void Print (int lvl=0)
 Displays on std output list of running threads and modules. More...
 
void ProcessCtrlCSignal ()
 
bool ProcessDestroyQueue ()
 
bool ProcessParameterEvents ()
 
void ProcessPipeSignal ()
 
void ProduceParameterEvent (ParameterContainer *par, int evid)
 
bool RegisterDependency (Object *src, Object *tgt, bool bidirectional=false)
 Register dependency between objects. More...
 
bool UnregisterDependency (Object *src, Object *tgt, bool bidirectional=false)
 Unregister dependency between objects. More...
 
virtual ~Manager ()
 
- 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...
 
virtual void BuildFieldsMap (RecordFieldsMap *cont)
 Fill fields map, which is relevant for the object Objects hierarchy produced from dabc::Manager. 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)
 
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 ()
 

Static Public Member Functions

static const char * AppThrdName ()
 
static const char * CmdChlName ()
 
static const char * ConnMgrName ()
 
static const char * FactoriesFolderName ()
 
static const char * MgrThrdName ()
 
static void SetAutoDestroy (bool on)
 Method set flag if manager instance should be destroyed when process finished. More...
 
static const char * ThreadsFolderName ()
 
- 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

enum  MgrEvents { evntDestroyObj = evntFirstSystem , evntManagerParam }
 
- 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
}
 

Protected Member Functions

ApplicationRef app ()
 
ThreadRef CurrentThread ()
 
bool DoCleanupApplication ()
 
bool DoCreateMemoryPool (Command cmd)
 
WorkerRef DoCreateModule (const std::string &classname, const std::string &modulename, Command cmd)
 
Reference DoCreateObject (const std::string &classname, const std::string &objname="", Command cmd=nullptr)
 
ThreadRef DoCreateThread (const std::string &thrdname, const std::string &classname="", const std::string &devname="", Command cmd=nullptr)
 Create thread with specified name and class name. More...
 
virtual int ExecuteCommand (Command cmd)
 Main method where commands are executed. More...
 
void FillItemName (const Object *ptr, std::string &itemname, bool compact=true)
 Method should be used to produce name of object, which can be used as item name in different Find methods of manager. More...
 
WorkerRef FindDevice (const std::string &name)
 
Reference FindItem (const std::string &itemname, bool islocal=false)
 Find object in manager hierarchy with specified itemname. More...
 
ModuleRef FindModule (const std::string &name)
 
Reference FindPool (const std::string &name)
 
Reference FindPort (const std::string &name)
 
ThreadRef FindThread (const std::string &name, const std::string &required_class="")
 
WorkerRef GetCommandChannel ()
 Return reference on command channel. More...
 
Reference GetFactoriesFolder (bool force=false)
 Return reference on folder with factories. More...
 
std::string GetLastCreatedDevName ()
 
Reference GetThreadsFolder (bool force=false)
 Return reference on folder with all registered threads. More...
 
bool IsAnyModuleRunning ()
 
virtual int PreviewCommand (Command cmd)
 This method called before command will be executed. More...
 
virtual void ProcessEvent (const EventId &)
 
virtual double ProcessTimeout (double last_diff)
 
virtual bool ReplyCommand (Command cmd)
 Reimplement this method to react on command reply Return true if command can be destroyed by framework. More...
 
void RunManagerCmdLoop (double runtime=0., const std::string &remnode="")
 Runs manager command loop - when command shell is used. More...
 
void RunManagerMainLoop (double runtime=0.)
 Runs manager mainloop. More...
 
void Sleep (double tmout, const char *prefix=0)
 Perform sleeping with event loop running. More...
 
- 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 Parameter CreatePar (const std::string &name, const std::string &kind="")
 
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 ObjectCleanup ()
 Central cleanup method for worker. More...
 
virtual void ObjectDestroyed (Object *)
 Method to clear object reference, will be called from thread context (when possible) More...
 
virtual void OnThreadAssigned ()
 
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 fAppFinished
 when true, reply from application was received More...
 
ConfigurationfCfg
 
std::string fCfgHost
 
DependPairListfDepend
 
ReferencesVectorfDestroyQueue
 
std::string fLastCreatedDevName
 name of last created device, automatically used for connection establishing More...
 
std::string fLocalAddress
 Identifier for the current application Only set when control instance is created Depending on configuration, includes server port number or just process id. More...
 
MutexfMgrMutex
 
TimeStamp fMgrStoppedTime
 indicate when manager mainloop was stopped More...
 
int fNodeId
 
int fNumNodes
 
ParamEventReceiverListfParEventsReceivers
 list of workers, registered for receiving of parameter events Used only from manager thread, therefore not protected with mutex More...
 
RecordsQueue< ParamRecfParsQueue
 
ThreadsLayout fThrLayout
 defines distribution of threads More...
 
ReferencesVectorfTimedPars
 
- 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 Types

enum  { MagicInstanceId = 7654321 }
 

Static Private Member Functions

static void ProcessFactory (Factory *factory)
 

Static Private Attributes

static FactoryfFirstFactories [10]
 first factories, which are comming before manager is created More...
 
static int fFirstFactoriesId
 magic number which should be set when fFirstFactories initialized for the first time More...
 
static ManagerfInstance = 0
 pointer on current manager instance More...
 
static int fInstanceId = 0
 magic number which indicates that instance is initialized More...
 

Friends

class Factory
 
class FactoryPlugin
 
class ManagerRef
 
class Object
 
class ParameterContainer
 
class StdManagerFactory
 

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 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

Manager of everything in DABC

It manages: modules, devices, memory pools, ...

Definition at line 291 of file Manager.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
MagicInstanceId 

Definition at line 302 of file Manager.h.

◆ MgrEvents

enum dabc::Manager::MgrEvents
protected
Enumerator
evntDestroyObj 
evntManagerParam 

Definition at line 315 of file Manager.h.

Constructor & Destructor Documentation

◆ Manager()

dabc::Manager::Manager ( const std::string &  managername,
Configuration cfg = 0 
)

Definition at line 245 of file Manager.cxx.

◆ ~Manager()

dabc::Manager::~Manager ( )
virtual

Definition at line 320 of file Manager.cxx.

Member Function Documentation

◆ ProcessFactory()

void dabc::Manager::ProcessFactory ( Factory factory)
staticprivate

Definition at line 1561 of file Manager.cxx.

◆ FindItem()

dabc::Reference dabc::Manager::FindItem ( const std::string &  itemname,
bool  islocal = false 
)
protected

Find object in manager hierarchy with specified itemname.

Itemname can be complete url or just local path (islocal = true)

Definition at line 697 of file Manager.cxx.

◆ FillItemName()

void dabc::Manager::FillItemName ( const Object ptr,
std::string &  itemname,
bool  compact = true 
)
protected

Method should be used to produce name of object, which can be used as item name in different Find methods of manager.

Item name later can be used to produce url to the item

Definition at line 746 of file Manager.cxx.

◆ FindThread()

dabc::ThreadRef dabc::Manager::FindThread ( const std::string &  name,
const std::string &  required_class = "" 
)
protected

Definition at line 1899 of file Manager.cxx.

◆ CurrentThread()

dabc::ThreadRef dabc::Manager::CurrentThread ( )
protected

Definition at line 1910 of file Manager.cxx.

◆ FindDevice()

dabc::WorkerRef dabc::Manager::FindDevice ( const std::string &  name)
protected

Definition at line 734 of file Manager.cxx.

◆ FindPool()

dabc::Reference dabc::Manager::FindPool ( const std::string &  name)
protected

Definition at line 727 of file Manager.cxx.

◆ FindModule()

dabc::ModuleRef dabc::Manager::FindModule ( const std::string &  name)
protected

Definition at line 713 of file Manager.cxx.

◆ FindPort()

dabc::Reference dabc::Manager::FindPort ( const std::string &  name)
protected

Definition at line 719 of file Manager.cxx.

◆ app()

dabc::ApplicationRef dabc::Manager::app ( )
protected

Definition at line 741 of file Manager.cxx.

◆ IsAnyModuleRunning()

bool dabc::Manager::IsAnyModuleRunning ( )
protected

Definition at line 684 of file Manager.cxx.

◆ DoCreateMemoryPool()

bool dabc::Manager::DoCreateMemoryPool ( Command  cmd)
protected

Definition at line 1255 of file Manager.cxx.

◆ DoCreateThread()

dabc::ThreadRef dabc::Manager::DoCreateThread ( const std::string &  thrdname,
const std::string &  classname = "",
const std::string &  devname = "",
Command  cmd = nullptr 
)
protected

Create thread with specified name and class name.

Parameters
[in]thrdnamename of created thread
[in]classnameclass name (when empty, dabc::Thread will be created)
[in]devnamedevice name to use for thread creation
[in]cmdcommand object with additional optional arguments
Returns
reference on created thread

Definition at line 1923 of file Manager.cxx.

◆ DoCreateModule()

dabc::WorkerRef dabc::Manager::DoCreateModule ( const std::string &  classname,
const std::string &  modulename,
Command  cmd 
)
protected

Definition at line 824 of file Manager.cxx.

◆ DoCreateObject()

dabc::Reference dabc::Manager::DoCreateObject ( const std::string &  classname,
const std::string &  objname = "",
Command  cmd = nullptr 
)
protected

Definition at line 863 of file Manager.cxx.

◆ GetCommandChannel()

WorkerRef dabc::Manager::GetCommandChannel ( )
inlineprotected

Return reference on command channel.

should be used from manager thread only

Definition at line 416 of file Manager.h.

◆ GetFactoriesFolder()

Reference dabc::Manager::GetFactoriesFolder ( bool  force = false)
inlineprotected

Return reference on folder with factories.

Parameters
force- if specified, missing factories folder will be created
Returns
reference on factories folder

Definition at line 423 of file Manager.h.

◆ GetThreadsFolder()

Reference dabc::Manager::GetThreadsFolder ( bool  force = false)
inlineprotected

Return reference on folder with all registered threads.

Parameters
force- if specified, missing threads folder will be created
Returns
reference on factories folder

Definition at line 430 of file Manager.h.

◆ Sleep()

void dabc::Manager::Sleep ( double  tmout,
const char *  prefix = 0 
)
protected

Perform sleeping with event loop running.

If prefix specified, output on terminal is performed

Definition at line 1375 of file Manager.cxx.

◆ GetLastCreatedDevName()

std::string dabc::Manager::GetLastCreatedDevName ( )
protected

Definition at line 1249 of file Manager.cxx.

◆ RunManagerMainLoop()

void dabc::Manager::RunManagerMainLoop ( double  runtime = 0.)
protected

Runs manager mainloop.

Parameters
[in]runtime- time limit for running, 0 - unlimited

Definition at line 1631 of file Manager.cxx.

◆ RunManagerCmdLoop()

void dabc::Manager::RunManagerCmdLoop ( double  runtime = 0.,
const std::string &  remnode = "" 
)
protected

Runs manager command loop - when command shell is used.

Definition at line 1713 of file Manager.cxx.

◆ DoCleanupApplication()

bool dabc::Manager::DoCleanupApplication ( )
protected

Definition at line 1363 of file Manager.cxx.

◆ ProcessTimeout()

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

Reimplemented from dabc::Worker.

Definition at line 1541 of file Manager.cxx.

◆ PreviewCommand()

int dabc::Manager::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.

Definition at line 756 of file Manager.cxx.

◆ ExecuteCommand()

int dabc::Manager::ExecuteCommand ( Command  cmd)
protectedvirtual

Main method where commands are executed.

Reimplemented from dabc::Worker.

Definition at line 877 of file Manager.cxx.

◆ ReplyCommand()

bool dabc::Manager::ReplyCommand ( Command  cmd)
protectedvirtual

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

Reimplemented from dabc::Worker.

Definition at line 1279 of file Manager.cxx.

◆ ProcessEvent()

void dabc::Manager::ProcessEvent ( const EventId evnt)
protectedvirtual

Reimplemented from dabc::Worker.

Definition at line 666 of file Manager.cxx.

◆ ClassName()

virtual const char* dabc::Manager::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.

Definition at line 462 of file Manager.h.

◆ HaltManager()

void dabc::Manager::HaltManager ( )

Delete all modules and stop manager thread.

Normally, last command before exit from main program. Automatically called from destructor

Definition at line 371 of file Manager.cxx.

◆ FactoriesFolderName()

static const char* dabc::Manager::FactoriesFolderName ( )
inlinestatic

Definition at line 473 of file Manager.h.

◆ ThreadsFolderName()

static const char* dabc::Manager::ThreadsFolderName ( )
inlinestatic

Definition at line 474 of file Manager.h.

◆ MgrThrdName()

static const char* dabc::Manager::MgrThrdName ( )
inlinestatic

Definition at line 476 of file Manager.h.

◆ AppThrdName()

static const char* dabc::Manager::AppThrdName ( )
inlinestatic

Definition at line 477 of file Manager.h.

◆ ConnMgrName()

static const char* dabc::Manager::ConnMgrName ( )
inlinestatic

Definition at line 478 of file Manager.h.

◆ CmdChlName()

static const char* dabc::Manager::CmdChlName ( )
inlinestatic

Definition at line 479 of file Manager.h.

◆ NodeId()

int dabc::Manager::NodeId ( ) const
inline

Return nodes id of local node.

Definition at line 483 of file Manager.h.

◆ NumNodes()

int dabc::Manager::NumNodes ( )
inline

Returns number of nodes in the cluster FIXME:probably must be removed.

Definition at line 485 of file Manager.h.

◆ GetLocalAddress()

std::string dabc::Manager::GetLocalAddress ( )

Return address of current application.

Definition at line 1434 of file Manager.cxx.

◆ GetNodeAddress()

std::string dabc::Manager::GetNodeAddress ( int  nodeid)

Return address of the node to be able communicate with it.

Definition at line 1421 of file Manager.cxx.

◆ DecomposeAddress()

bool dabc::Manager::DecomposeAddress ( const std::string &  url,
bool &  islocal,
std::string &  server,
std::string &  itemtname 
)

From address like dabc://nodeabc:988/item/subtim extracts server (with port) and itemname If server name corresponds to local name, islocal set to true.

Definition at line 1454 of file Manager.cxx.

◆ ComposeAddress()

std::string dabc::Manager::ComposeAddress ( const std::string &  server,
const std::string &  itemtname = "" 
)

Provides string, which can be used as receiver argument.

Definition at line 1439 of file Manager.cxx.

◆ GetThreadsLayout()

ThreadsLayout dabc::Manager::GetThreadsLayout ( ) const
inline

Definition at line 498 of file Manager.h.

◆ cfg()

Configuration* dabc::Manager::cfg ( ) const
inline

Definition at line 502 of file Manager.h.

◆ Print()

void dabc::Manager::Print ( int  lvl = 0)
virtual

Displays on std output list of running threads and modules.

Reimplemented from dabc::Object.

Definition at line 1312 of file Manager.cxx.

◆ DestroyObject()

bool dabc::Manager::DestroyObject ( Reference  ref)
virtual

Delete derived from Object class object in manager thread.

Useful as replacement of call "delete this;"

Definition at line 1317 of file Manager.cxx.

◆ DeleteAnyObject()

template<class T >
bool dabc::Manager::DeleteAnyObject ( T *  obj)
inline

Delete of any kind of object in manager thread.

Definition at line 512 of file Manager.h.

◆ RegisterDependency()

bool dabc::Manager::RegisterDependency ( Object src,
Object tgt,
bool  bidirectional = false 
)

Register dependency between objects.

One use dependency to notify source object situation when dependent tgt object is destroyed. In this case src->ObjectDestroyed(tgt) call will be done. Normally one should "forget" pointer on dependent object at this moment. In case if reference was used, reference must be released

Parameters
[in]src,tgtobject src waiting when tgt object is destroyed
[in]bidirectionaldefine that dependency should be register in both directions
Returns
true when dependency can be registered

Definition at line 1493 of file Manager.cxx.

◆ UnregisterDependency()

bool dabc::Manager::UnregisterDependency ( Object src,
Object tgt,
bool  bidirectional = false 
)

Unregister dependency between objects.

Opposite to RegisterDependency call

Definition at line 1514 of file Manager.cxx.

◆ InstallSignalHandlers()

bool dabc::Manager::InstallSignalHandlers ( )

◆ ProcessCtrlCSignal()

void dabc::Manager::ProcessCtrlCSignal ( )

Definition at line 1589 of file Manager.cxx.

◆ ProcessPipeSignal()

void dabc::Manager::ProcessPipeSignal ( )

Definition at line 1615 of file Manager.cxx.

◆ Find()

bool dabc::Manager::Find ( ConfigIO cfg)
virtual

Method to locate object in xml file.

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

Reimplemented from dabc::Worker.

Definition at line 1880 of file Manager.cxx.

◆ SetAutoDestroy()

void dabc::Manager::SetAutoDestroy ( bool  on)
static

Method set flag if manager instance should be destroyed when process finished.

Definition at line 239 of file Manager.cxx.

◆ ProcessDestroyQueue()

bool dabc::Manager::ProcessDestroyQueue ( )

Definition at line 425 of file Manager.cxx.

◆ ProcessParameterEvents()

bool dabc::Manager::ProcessParameterEvents ( )

Definition at line 549 of file Manager.cxx.

◆ ProduceParameterEvent()

void dabc::Manager::ProduceParameterEvent ( ParameterContainer par,
int  evid 
)

Definition at line 506 of file Manager.cxx.

Friends And Related Function Documentation

◆ Object

friend class Object
friend

Definition at line 293 of file Manager.h.

◆ Factory

friend class Factory
friend

Definition at line 294 of file Manager.h.

◆ FactoryPlugin

friend class FactoryPlugin
friend

Definition at line 295 of file Manager.h.

◆ ParameterContainer

friend class ParameterContainer
friend

Definition at line 296 of file Manager.h.

◆ StdManagerFactory

friend class StdManagerFactory
friend

Definition at line 297 of file Manager.h.

◆ ManagerRef

friend class ManagerRef
friend

Definition at line 298 of file Manager.h.

Field Documentation

◆ fInstance

dabc::Manager * dabc::Manager::fInstance = 0
staticprivate

pointer on current manager instance

Definition at line 307 of file Manager.h.

◆ fInstanceId

int dabc::Manager::fInstanceId = 0
staticprivate

magic number which indicates that instance is initialized

Definition at line 308 of file Manager.h.

◆ fFirstFactories

dabc::Factory * dabc::Manager::fFirstFactories
staticprivate

first factories, which are comming before manager is created

Definition at line 309 of file Manager.h.

◆ fFirstFactoriesId

int dabc::Manager::fFirstFactoriesId
staticprivate

magic number which should be set when fFirstFactories initialized for the first time

Definition at line 310 of file Manager.h.

◆ fMgrStoppedTime

TimeStamp dabc::Manager::fMgrStoppedTime
protected

indicate when manager mainloop was stopped

Definition at line 340 of file Manager.h.

◆ fAppFinished

bool dabc::Manager::fAppFinished
protected

when true, reply from application was received

Definition at line 341 of file Manager.h.

◆ fMgrMutex

Mutex* dabc::Manager::fMgrMutex
protected

Definition at line 344 of file Manager.h.

◆ fDestroyQueue

ReferencesVector* dabc::Manager::fDestroyQueue
protected

Definition at line 346 of file Manager.h.

◆ fParsQueue

RecordsQueue<ParamRec> dabc::Manager::fParsQueue
protected

Definition at line 348 of file Manager.h.

◆ fTimedPars

ReferencesVector* dabc::Manager::fTimedPars
protected

Definition at line 351 of file Manager.h.

◆ fParEventsReceivers

ParamEventReceiverList* dabc::Manager::fParEventsReceivers
protected

list of workers, registered for receiving of parameter events Used only from manager thread, therefore not protected with mutex

Definition at line 355 of file Manager.h.

◆ fDepend

DependPairList* dabc::Manager::fDepend
protected

Definition at line 358 of file Manager.h.

◆ fCfg

Configuration* dabc::Manager::fCfg
protected

Definition at line 360 of file Manager.h.

◆ fCfgHost

std::string dabc::Manager::fCfgHost
protected

Definition at line 361 of file Manager.h.

◆ fNodeId

int dabc::Manager::fNodeId
protected

Definition at line 363 of file Manager.h.

◆ fNumNodes

int dabc::Manager::fNumNodes
protected

Definition at line 364 of file Manager.h.

◆ fLocalAddress

std::string dabc::Manager::fLocalAddress
protected

Identifier for the current application Only set when control instance is created Depending on configuration, includes server port number or just process id.

Definition at line 369 of file Manager.h.

◆ fThrLayout

ThreadsLayout dabc::Manager::fThrLayout
protected

defines distribution of threads

Definition at line 371 of file Manager.h.

◆ fLastCreatedDevName

std::string dabc::Manager::fLastCreatedDevName
protected

name of last created device, automatically used for connection establishing

Definition at line 373 of file Manager.h.


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