DABC (Data Acquisition Backbone Core)  2.9.9
Public Member Functions | Protected Member Functions | Friends

Reference on manager object More...

#include <dabc/Manager.h>

Inheritance diagram for dabc::ManagerRef:
dabc::WorkerRef dabc::Reference

Public Member Functions

bool ActivateConnections (double tmout, bool sync=true)
 
ApplicationRef app ()
 
bool CleanupApplication ()
 Method safely deletes all object created for application - modules, devices, memory pools. More...
 
std::string ComposeAddress (const std::string &server, const std::string &itemname="")
 
ConnectionRequest Connect (const std::string &port1, const std::string &port2)
 Request connection between two ports. More...
 
void * CreateAny (const std::string &classname, const std::string &objname="")
 
bool CreateApplication (const std::string &classname="", const std::string &appthrd="")
 
bool CreateControl (bool withserver, int serv_port=0, bool allow_clients=true)
 Create command channel Parameter withserver defines if server socket will be created, which accepts client connections Optionally one can provide port number for server socket. More...
 
bool CreateDevice (const std::string &classname, const std::string &devname)
 
bool CreateMemoryPool (const std::string &poolname, unsigned buffersize=0, unsigned numbuffers=0)
 Generic method to create memory pool. More...
 
ModuleRef CreateModule (const std::string &classname, const std::string &modulename, const std::string &thrdname="")
 
Reference CreateObject (const std::string &classname, const std::string &objname)
 
bool CreatePublisher ()
 Create publisher, which manage all published hierarchies. More...
 
ThreadRef CreateThread (const std::string &thrdname, const std::string &classname="", const std::string &devname="")
 
bool CreateTransport (const std::string &portname, const std::string &transportkind="", const std::string &thrdname="")
 
ThreadRef CurrentThread ()
 Returns reference on the thread, which is now active. More...
 
bool DecomposeAddress (const std::string &url, bool &islocal, std::string &server, std::string &itemtname)
 
bool DeleteDevice (const std::string &devname)
 
bool DeleteModule (const std::string &name)
 
bool DeletePool (const std::string &name)
 
WorkerRef FindDevice (const std::string &name)
 
Reference FindItem (const std::string &name)
 
ModuleRef FindModule (const std::string &name)
 
Parameter FindPar (const std::string &parname)
 
Reference FindPool (const std::string &name)
 
Reference FindPort (const std::string &port)
 
ThreadRef FindThread (const std::string &name, const std::string &required_class="")
 
WorkerRef GetCommandChannel ()
 
std::string GetLocalAddress ()
 Return identifier of local host, which can be used everywhere for node addressing. More...
 
std::string GetNodeAddress (int nodeid)
 
ThreadsLayout GetThreadsLayout () const
 
bool IsTerminated () const
 
int NodeId () const
 
int NumNodes () const
 
unsigned NumThreads () const
 
void RunCmdLoop (double runtime=0., const std::string &remnode="")
 Run manager command loop. More...
 
void RunMainLoop (double runtime=0.)
 Run manager main loop. More...
 
void Sleep (double tmout, const char *prefix=0)
 Sleep for specified time, keep thread event loop running See Manager::Sleep() method for more details. More...
 
bool StartAllModules ()
 
void StartModule (const std::string &modulename)
 
bool StopAllModules ()
 
void StopApplication ()
 
void StopModule (const std::string &modulename)
 
- Public Member Functions inherited from dabc::WorkerRef
bool CanSubmitCommand () const
 Returns true if command can be submitted to the worker. More...
 
RecordField Cfg (const std::string &name, Command cmd=nullptr) const
 Returns configuration record of specified name. More...
 
bool Execute (Command cmd, double tmout=-1.)
 
bool Execute (const std::string &cmd, double tmout=-1.)
 
bool FireEvent (const EventId &ev)
 
bool FireEvent (uint16_t evid, uint32_t arg)
 
bool HasThread () const
 Returns true when thread is assigned to the worker. More...
 
bool IsSameThread (const WorkerRef &ref)
 Returns true if two workers share same thread. More...
 
bool MakeThreadForWorker (const std::string &thrdname="")
 
Parameter Par (const std::string &name) const
 Returns reference on parameter. More...
 
bool Submit (Command cmd)
 
bool SyncWorker (double tmout=-1.)
 Synchronize worker with caller thread. More...
 
ThreadRef thread ()
 
std::string ThreadName () const
 Returns thread name of worker assigned. More...
 
- Public Member Functions inherited from dabc::Reference
bool AddChild (Object *obj)
 Add child to list of object children. More...
 
const char * ClassName () const
 Return class name of referenced object, if object not assigned, returns "---". More...
 
void Destroy () throw ()
 Release reference and starts destroyment of referenced object. More...
 
Reference FindChild (const char *name) const
 Searches for child in referenced object. More...
 
bool GetAllChildRef (ReferencesVector *vect) const
 Return references for all childs. More...
 
Reference GetChild (unsigned n) const
 Return reference on child n. More...
 
Reference GetFolder (const std::string &name, bool force=false) throw ()
 Return folder of specified name, no special symbols are allowed. More...
 
const char * GetName () const
 Return name of referenced object, if object not assigned, returns "---". More...
 
ObjectGetObject () const
 Return pointer on the object. More...
 
ObjectGetParent () const
 Returns pointer on parent object. More...
 
Reference GetParentRef () const
 Returns reference on parent object. More...
 
bool IsName (const char *name) const
 Returns true if object name is the same as specified one. More...
 
std::string ItemName (bool compact=true) const
 Produce string, which can be used as name argument in dabc::mgr.FindItem(name) call. More...
 
bool null () const
 Returns true if reference contains nullptr. More...
 
unsigned NumChilds () const
 Return number of childs in referenced object. More...
 
unsigned NumReferences () const
 Returns number of references on the object. More...
 
bool operator! () const
 Returns true if reference contains nullptr. More...
 
bool operator!= (const Reference &src) const
 Compare operator - return true if references refer to different object. More...
 
bool operator!= (Object *obj) const
 Compare operator - return true if reference refer to different objects. More...
 
Objectoperator() () const
 Return pointer on the object. More...
 
Referenceoperator<< (Reference &src) throw ()
 Move operator - reference moved from source to target. More...
 
Referenceoperator= (const Reference &src) throw ()
 Assignment operator - copy reference. More...
 
Referenceoperator= (Object *obj) throw ()
 Assignment operator - copy reference. More...
 
bool operator== (const Reference &src) const
 Compare operator - return true if references refer to same object. More...
 
bool operator== (Object *obj) const
 Compare operator - return true if reference refer to same object. More...
 
void Print (int lvl=0, const char *from=0) const
 Show on debug output content of reference. More...
 
 Reference (const Reference &src) throw ()
 Copy constructor, if source is transient than source reference will be emptied. More...
 
 Reference (Object *obj=nullptr)
 Constructor, creates reference on the object. More...
 
std::string RelativeName (const dabc::Reference &topitem)
 Produce name, which can be used to find item, calling topitem.FindChild(). More...
 
void Release () throw ()
 Releases reference on the object. More...
 
bool RemoveChild (const char *name, bool cleanup=true)
 Remove child with given name and return reference on that child. More...
 
bool RemoveChilds (bool cleanup=true)
 Remove all childs in referenced object If cleanup true (default) and object is owner, all objects will be destroyed. 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 SetObject (Object *obj, bool withmutex=true)
 Direct set of object to reference. More...
 
Reference Take ()
 Copy reference to output object. More...
 
virtual ~Reference ()
 Destructor, releases reference on the object. More...
 

Protected Member Functions

DataInputCreateDataInput (const std::string &kind)
 Create data input, using factories methods. More...
 
bool IsLocalItem (const std::string &name)
 Returns true, if name of the item should specify name in local context or from remote node. More...
 
bool ParameterEventSubscription (Worker *ptr, bool subscribe, const std::string &mask, bool onlychangeevent=true)
 
- Protected Member Functions inherited from dabc::Reference
bool AcquireRefWithoutMutex (Reference &ref)
 Special method, which allows to generate new reference when object mutex is locked. More...
 
void Assign (const Reference &src)
 Method used in copy constructor and assigned operations. More...
 
MutexObjectMutex () const
 
template<class T >
bool verify_object (Object *src, T *&tgt)
 Method used in reference constructor/assignments to verify is object is suitable. More...
 

Friends

class InputTransport
 
class Manager
 
class Port
 
class Worker
 

Additional Inherited Members

- Protected Attributes inherited from dabc::Reference
ObjectfObj
 pointer on the object More...
 

Detailed Description

Reference on manager object

Should be used as thread-safe interface to manager functionality. Instance of ManagerRef is available via dabc::mgr variable.

Definition at line 560 of file Manager.h.

Member Function Documentation

◆ ParameterEventSubscription()

bool dabc::ManagerRef::ParameterEventSubscription ( Worker ptr,
bool  subscribe,
const std::string &  mask,
bool  onlychangeevent = true 
)
protected

Definition at line 2096 of file Manager.cxx.

◆ IsLocalItem()

bool dabc::ManagerRef::IsLocalItem ( const std::string &  name)
protected

Returns true, if name of the item should specify name in local context or from remote node.

Definition at line 2131 of file Manager.cxx.

◆ CreateDataInput()

dabc::DataInput * dabc::ManagerRef::CreateDataInput ( const std::string &  kind)
protected

Create data input, using factories methods.

Definition at line 2260 of file Manager.cxx.

◆ app()

dabc::ApplicationRef dabc::ManagerRef::app ( )

Definition at line 2074 of file Manager.cxx.

◆ CleanupApplication()

bool dabc::ManagerRef::CleanupApplication ( )

Method safely deletes all object created for application - modules, devices, memory pools.

All these objects normally collected under "/App" folder, therefore manager cleanup is just deletion of this folder. Threads are not directly destroyed, while they are collected in other folder, but they will be destroyed as soon as they are not used.

Definition at line 2079 of file Manager.cxx.

◆ NodeId()

int dabc::ManagerRef::NodeId ( ) const

Definition at line 2086 of file Manager.cxx.

◆ NumNodes()

int dabc::ManagerRef::NumNodes ( ) const

Definition at line 2091 of file Manager.cxx.

◆ GetLocalAddress()

std::string dabc::ManagerRef::GetLocalAddress ( )
inline

Return identifier of local host, which can be used everywhere for node addressing.

Definition at line 594 of file Manager.h.

◆ GetNodeAddress()

std::string dabc::ManagerRef::GetNodeAddress ( int  nodeid)
inline

Definition at line 597 of file Manager.h.

◆ DecomposeAddress()

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

Definition at line 600 of file Manager.h.

◆ ComposeAddress()

std::string dabc::ManagerRef::ComposeAddress ( const std::string &  server,
const std::string &  itemname = "" 
)
inline

Definition at line 603 of file Manager.h.

◆ CreateApplication()

bool dabc::ManagerRef::CreateApplication ( const std::string &  classname = "",
const std::string &  appthrd = "" 
)

Definition at line 1975 of file Manager.cxx.

◆ CreateThread()

dabc::ThreadRef dabc::ManagerRef::CreateThread ( const std::string &  thrdname,
const std::string &  classname = "",
const std::string &  devname = "" 
)

Definition at line 1988 of file Manager.cxx.

◆ CurrentThread()

dabc::ThreadRef dabc::ManagerRef::CurrentThread ( )

Returns reference on the thread, which is now active.

If thread object for given context does not exists (foreign thread), null reference will be return

Definition at line 1995 of file Manager.cxx.

◆ CreateDevice()

bool dabc::ManagerRef::CreateDevice ( const std::string &  classname,
const std::string &  devname 
)

Definition at line 2001 of file Manager.cxx.

◆ DeleteDevice()

bool dabc::ManagerRef::DeleteDevice ( const std::string &  devname)

Definition at line 2007 of file Manager.cxx.

◆ FindDevice()

dabc::WorkerRef dabc::ManagerRef::FindDevice ( const std::string &  name)

Definition at line 2013 of file Manager.cxx.

◆ CreateObject()

dabc::Reference dabc::ManagerRef::CreateObject ( const std::string &  classname,
const std::string &  objname 
)

Definition at line 2251 of file Manager.cxx.

◆ CreateMemoryPool()

bool dabc::ManagerRef::CreateMemoryPool ( const std::string &  poolname,
unsigned  buffersize = 0,
unsigned  numbuffers = 0 
)

Generic method to create memory pool.

Creates memory pool with numbuffers buffers of size buffersize. If zero arguments are specified, configuration from xml file will be used. If none (arguments or xml file) provides non-zero values, only pool instance without buffers will be created. For more sophisticated configuration of memory pool CmdCreateMemoryPool should be used

Definition at line 2239 of file Manager.cxx.

◆ DeletePool()

bool dabc::ManagerRef::DeletePool ( const std::string &  name)

Definition at line 2048 of file Manager.cxx.

◆ CreateModule()

dabc::ModuleRef dabc::ManagerRef::CreateModule ( const std::string &  classname,
const std::string &  modulename,
const std::string &  thrdname = "" 
)

Definition at line 1981 of file Manager.cxx.

◆ FindModule()

dabc::ModuleRef dabc::ManagerRef::FindModule ( const std::string &  name)

Definition at line 2018 of file Manager.cxx.

◆ StartModule()

void dabc::ManagerRef::StartModule ( const std::string &  modulename)

Definition at line 2023 of file Manager.cxx.

◆ StopModule()

void dabc::ManagerRef::StopModule ( const std::string &  modulename)

Definition at line 2028 of file Manager.cxx.

◆ StartAllModules()

bool dabc::ManagerRef::StartAllModules ( )

Definition at line 2033 of file Manager.cxx.

◆ StopAllModules()

bool dabc::ManagerRef::StopAllModules ( )

Definition at line 2038 of file Manager.cxx.

◆ DeleteModule()

bool dabc::ManagerRef::DeleteModule ( const std::string &  name)

Definition at line 2043 of file Manager.cxx.

◆ CreateTransport()

bool dabc::ManagerRef::CreateTransport ( const std::string &  portname,
const std::string &  transportkind = "",
const std::string &  thrdname = "" 
)

Definition at line 2210 of file Manager.cxx.

◆ CreateAny()

void * dabc::ManagerRef::CreateAny ( const std::string &  classname,
const std::string &  objname = "" 
)

Definition at line 2219 of file Manager.cxx.

◆ ActivateConnections()

bool dabc::ManagerRef::ActivateConnections ( double  tmout,
bool  sync = true 
)

Definition at line 2197 of file Manager.cxx.

◆ FindItem()

dabc::Reference dabc::ManagerRef::FindItem ( const std::string &  name)

Definition at line 2054 of file Manager.cxx.

◆ FindPort()

dabc::Reference dabc::ManagerRef::FindPort ( const std::string &  port)

Definition at line 2059 of file Manager.cxx.

◆ FindPar()

dabc::Parameter dabc::ManagerRef::FindPar ( const std::string &  parname)

Definition at line 2069 of file Manager.cxx.

◆ FindPool()

dabc::Reference dabc::ManagerRef::FindPool ( const std::string &  name)

Definition at line 2064 of file Manager.cxx.

◆ FindThread()

ThreadRef dabc::ManagerRef::FindThread ( const std::string &  name,
const std::string &  required_class = "" 
)
inline

Definition at line 655 of file Manager.h.

◆ NumThreads()

unsigned dabc::ManagerRef::NumThreads ( ) const
inline

Definition at line 658 of file Manager.h.

◆ GetThreadsLayout()

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

Definition at line 661 of file Manager.h.

◆ IsTerminated()

bool dabc::ManagerRef::IsTerminated ( ) const
inline

Definition at line 664 of file Manager.h.

◆ Connect()

dabc::ConnectionRequest dabc::ManagerRef::Connect ( const std::string &  port1,
const std::string &  port2 
)

Request connection between two ports.

If both ports belong to local node, they will be connected immediately. If both ports belong to remote nodes, nothing will happen. If one of the port is local and other is remote, new connection request will be created. Depending on current application state connection establishing will be started immediately or will be performed by DoEnable state transition.

Definition at line 2138 of file Manager.cxx.

◆ StopApplication()

void dabc::ManagerRef::StopApplication ( )

Definition at line 2231 of file Manager.cxx.

◆ Sleep()

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

Sleep for specified time, keep thread event loop running See Manager::Sleep() method for more details.

Definition at line 2269 of file Manager.cxx.

◆ RunMainLoop()

void dabc::ManagerRef::RunMainLoop ( double  runtime = 0.)
inline

Run manager main loop.

should be called either from manager thread or from main process

Definition at line 683 of file Manager.h.

◆ RunCmdLoop()

void dabc::ManagerRef::RunCmdLoop ( double  runtime = 0.,
const std::string &  remnode = "" 
)
inline

Run manager command loop.

Definition at line 687 of file Manager.h.

◆ GetCommandChannel()

WorkerRef dabc::ManagerRef::GetCommandChannel ( )
inline

Definition at line 690 of file Manager.h.

◆ CreateControl()

bool dabc::ManagerRef::CreateControl ( bool  withserver,
int  serv_port = 0,
bool  allow_clients = true 
)

Create command channel Parameter withserver defines if server socket will be created, which accepts client connections Optionally one can provide port number for server socket.

Definition at line 2277 of file Manager.cxx.

◆ CreatePublisher()

bool dabc::ManagerRef::CreatePublisher ( )

Create publisher, which manage all published hierarchies.

Definition at line 2315 of file Manager.cxx.

Friends And Related Function Documentation

◆ Manager

friend class Manager
friend

Definition at line 566 of file Manager.h.

◆ Worker

friend class Worker
friend

Definition at line 567 of file Manager.h.

◆ Port

friend class Port
friend

Definition at line 568 of file Manager.h.

◆ InputTransport

friend class InputTransport
friend

Definition at line 569 of file Manager.h.


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