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

Transport between two ports on the same node More...

#include <dabc/LocalTransport.h>

Inheritance diagram for dabc::LocalTransport:
dabc::Object

Static Public Member Functions

static int ConnectPorts (Reference port1ref, Reference port2ref, Command cmd=nullptr)
 
- 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  { MaskInp = 0x1 , MaskOut = 0x2 , MaskConn = 0x3 }
 
- 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

bool CanRecv () const
 
bool CanSend () const
 Returns true when send operation will add buffer into the queue When queue is not connected, buffer can always be add to the queue - this will left in the queue newest buffers. More...
 
unsigned Capacity () const
 
void CleanupQueue ()
 
void ConfirmEvent (bool isoutput)
 
void Disconnect (bool isinp, bool witherr=false)
 
void EnableMutex ()
 
unsigned Full () const
 
bool IsConnected () const
 
Buffer Item (unsigned indx) const
 
 LocalTransport (unsigned capacity, bool withmutex)
 
unsigned NumCanSend () const
 How many buffers can be add to the queue. More...
 
void PortActivated (int itemkind, bool on)
 
MutexQueueMutex () const
 
bool Recv (Buffer &buf)
 
bool Send (Buffer &buf)
 
void SetConnected (bool isinp)
 
void SignalWhenFull ()
 
unsigned Size () const
 
BufferSize_t TotalBuffersSize () const
 
virtual ~LocalTransport ()
 
- 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...
 
virtual bool DestroyByOwnThread ()
 Internal DABC method, used to activate object cleanup via object thread Returns: false - object cannot be cleanup by the thread, true - thread guarantees that DestroyCalledFromOwnThread() will be called from thread context. 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)
 
virtual void ObjectCleanup ()
 User method to cleanup object content before it will be destroyed Main motivation is to release any references on other objects to avoid any cross-references and as result deadlocks in objects cleanup. More...
 
virtual void ObjectDestroyed (Object *)
 Method called by the manager when registered dependent object is destroyed Should be used in user class to clear all references on the object to let destroy it. More...
 
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 fBlockWhenConnected
 should queue block when input port connected, default true More...
 
bool fBlockWhenUnconnected
 should queue block when input port not connected, default false More...
 
unsigned fConnected
 
WorkerRef fInp
 
unsigned fInpId
 
int fInpSignKind
 
WorkerRef fOut
 
unsigned fOutId
 
int fOutSignKind
 
BuffersQueue fQueue
 
unsigned fSignalInp
 
unsigned fSignalOut
 
bool fWithMutex
 
- 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...
 

Friends

class LocalTransportRef
 
class Port
 

Additional Inherited Members

- 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...
 
virtual const char * ClassName () const
 Returns class name of the object instance. More...
 
virtual bool Find (ConfigIO &cfg)
 Method to locate object in xml file. 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 ()
 
- 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

Transport between two ports on the same node

Definition at line 40 of file LocalTransport.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
MaskInp 
MaskOut 
MaskConn 

Definition at line 65 of file LocalTransport.h.

Constructor & Destructor Documentation

◆ LocalTransport()

dabc::LocalTransport::LocalTransport ( unsigned  capacity,
bool  withmutex 
)
protected

Definition at line 21 of file LocalTransport.cxx.

◆ ~LocalTransport()

dabc::LocalTransport::~LocalTransport ( )
protectedvirtual

Definition at line 42 of file LocalTransport.cxx.

Member Function Documentation

◆ SetConnected()

void dabc::LocalTransport::SetConnected ( bool  isinp)
inlineprotected

Definition at line 71 of file LocalTransport.h.

◆ ConfirmEvent()

void dabc::LocalTransport::ConfirmEvent ( bool  isoutput)
protected

Definition at line 248 of file LocalTransport.cxx.

◆ PortActivated()

void dabc::LocalTransport::PortActivated ( int  itemkind,
bool  on 
)
protected

Definition at line 330 of file LocalTransport.cxx.

◆ CleanupQueue()

void dabc::LocalTransport::CleanupQueue ( )
protected

Definition at line 324 of file LocalTransport.cxx.

◆ IsConnected()

bool dabc::LocalTransport::IsConnected ( ) const
inlineprotected

Definition at line 79 of file LocalTransport.h.

◆ NumCanSend()

unsigned dabc::LocalTransport::NumCanSend ( ) const
inlineprotected

How many buffers can be add to the queue.

Definition at line 86 of file LocalTransport.h.

◆ CanSend()

bool dabc::LocalTransport::CanSend ( ) const
inlineprotected

Returns true when send operation will add buffer into the queue When queue is not connected, buffer can always be add to the queue - this will left in the queue newest buffers.

Definition at line 97 of file LocalTransport.h.

◆ Send()

bool dabc::LocalTransport::Send ( Buffer buf)
protected

Definition at line 56 of file LocalTransport.cxx.

◆ CanRecv()

bool dabc::LocalTransport::CanRecv ( ) const
inlineprotected

Definition at line 101 of file LocalTransport.h.

◆ Recv()

bool dabc::LocalTransport::Recv ( Buffer buf)
protected

Definition at line 141 of file LocalTransport.cxx.

◆ SignalWhenFull()

void dabc::LocalTransport::SignalWhenFull ( )
protected

Definition at line 189 of file LocalTransport.cxx.

◆ QueueMutex()

Mutex* dabc::LocalTransport::QueueMutex ( ) const
inlineprotected

Definition at line 107 of file LocalTransport.h.

◆ EnableMutex()

void dabc::LocalTransport::EnableMutex ( )
inlineprotected

Definition at line 109 of file LocalTransport.h.

◆ Capacity()

unsigned dabc::LocalTransport::Capacity ( ) const
inlineprotected

Definition at line 112 of file LocalTransport.h.

◆ Size()

unsigned dabc::LocalTransport::Size ( ) const
inlineprotected

Definition at line 114 of file LocalTransport.h.

◆ TotalBuffersSize()

BufferSize_t dabc::LocalTransport::TotalBuffersSize ( ) const
inlineprotected

Definition at line 116 of file LocalTransport.h.

◆ Full()

unsigned dabc::LocalTransport::Full ( ) const
inlineprotected

Definition at line 118 of file LocalTransport.h.

◆ Item()

Buffer dabc::LocalTransport::Item ( unsigned  indx) const
inlineprotected

Definition at line 120 of file LocalTransport.h.

◆ Disconnect()

void dabc::LocalTransport::Disconnect ( bool  isinp,
bool  witherr = false 
)
protected

Definition at line 277 of file LocalTransport.cxx.

◆ ConnectPorts()

int dabc::LocalTransport::ConnectPorts ( Reference  port1ref,
Reference  port2ref,
Command  cmd = nullptr 
)
static

Definition at line 350 of file LocalTransport.cxx.

Friends And Related Function Documentation

◆ Port

friend class Port
friend

Definition at line 42 of file LocalTransport.h.

◆ LocalTransportRef

friend class LocalTransportRef
friend

Definition at line 43 of file LocalTransport.h.

Field Documentation

◆ fQueue

BuffersQueue dabc::LocalTransport::fQueue
protected

Definition at line 47 of file LocalTransport.h.

◆ fWithMutex

bool dabc::LocalTransport::fWithMutex
protected

Definition at line 48 of file LocalTransport.h.

◆ fOut

WorkerRef dabc::LocalTransport::fOut
protected

Definition at line 50 of file LocalTransport.h.

◆ fOutId

unsigned dabc::LocalTransport::fOutId
protected

Definition at line 51 of file LocalTransport.h.

◆ fOutSignKind

int dabc::LocalTransport::fOutSignKind
protected

Definition at line 52 of file LocalTransport.h.

◆ fSignalOut

unsigned dabc::LocalTransport::fSignalOut
protected

Definition at line 53 of file LocalTransport.h.

◆ fInp

WorkerRef dabc::LocalTransport::fInp
protected

Definition at line 55 of file LocalTransport.h.

◆ fInpId

unsigned dabc::LocalTransport::fInpId
protected

Definition at line 56 of file LocalTransport.h.

◆ fInpSignKind

int dabc::LocalTransport::fInpSignKind
protected

Definition at line 57 of file LocalTransport.h.

◆ fSignalInp

unsigned dabc::LocalTransport::fSignalInp
protected

Definition at line 58 of file LocalTransport.h.

◆ fConnected

unsigned dabc::LocalTransport::fConnected
protected

Definition at line 60 of file LocalTransport.h.

◆ fBlockWhenUnconnected

bool dabc::LocalTransport::fBlockWhenUnconnected
protected

should queue block when input port not connected, default false

Definition at line 62 of file LocalTransport.h.

◆ fBlockWhenConnected

bool dabc::LocalTransport::fBlockWhenConnected
protected

should queue block when input port connected, default true

Definition at line 63 of file LocalTransport.h.


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