19 #ifndef DABC_ModuleItem
23 #ifndef DABC_LocalTransport
27 #ifndef DABC_ConnectionRequest
88 const std::string &name,
178 virtual const char*
ClassName()
const {
return "Port"; }
180 virtual bool IsInput()
const {
return false; }
252 const std::string &name,
287 virtual const char*
ClassName()
const {
return "InputPort"; }
312 const std::string &name,
333 virtual const char*
ClassName()
const {
return "OutputPort"; }
359 const std::string &name,
407 virtual const char*
ClassName()
const {
return "PoolHandle"; }
#define DABC_REFERENCE(RefClass, ParentClass, T)
Reference on memory from memory pool.
Represents command with its arguments.
Special timer to reestablish port connections in the module.
Reference on the dabc::LocalTransport
void ConfirmEvent(bool isoutput)
unsigned NumCanSend() const
BufferSize_t TotalBuffersSize() const
void Disconnect(bool isinp, bool witherr=false)
Buffer Item(unsigned indx) const
Transport between two ports on the same node
Base class for user-derived code, implementing event-processing.
Reference on dabc::ModuleItem class
Base class for module items like ports, timers, pool handles.
Base class for user-derived code, implementing main loop.
Base for dabc::ModuleSync and dabc::ModuleAsync classes.
OutputPort(Reference parent, const std::string &name, unsigned queuesize)
virtual unsigned NumStartEvents()
Return number of events which should be produced when async module starts.
virtual const char * ClassName() const
Returns class name of the object instance.
bool CanSend() const
Returns true if user can send get buffer via the port.
bool Send(dabc::Buffer &buf)
unsigned NumCanSend() const
Returns number of buffer which can be put to the queue.
virtual bool IsOutput() const
Handle for pool connection.
virtual void ObjectCleanup()
Inherited method, should cleanup everything.
virtual void DoCleanup()
Called when module object is cleaned up - should release all references if any.
bool CanTakeBuffer() const
virtual bool IsInput() const
virtual unsigned NumStartEvents()
Return number of events which should be produced when async module starts.
Buffer TakeRequestedBuffer()
virtual const char * ClassName() const
Returns class name of the object instance.
unsigned NumCanTake() const
Defines how many buffers can be received.
Buffer Item(unsigned indx)
PoolHandle(Reference parent, Reference pool, const std::string &name, unsigned queuesize)
unsigned NumRequestedBuffer() const
Buffer TakeBuffer(BufferSize_t size=0)
Reference on the dabc::Port class
void ConfigureReconnect(double period=1., int numtry=-1)
Configure reconnect parameters
void ConfigureOnError(const std::string &action="")
Configure action in case of error.
bool IsOutput() const
Returns true if it is output port.
bool IsConnected()
Returns true if port is connected.
bool IsInput() const
Returns true if it is input port.
int GetSignalingKind()
Returns signaling method configured for the port.
PortRef GetBindPort()
Return reference on the bind port.
bool Disconnect(bool witherr=false)
Disconnect port
unsigned QueueCapacity() const
Returns queue capacity of the port.
ConnectionRequest MakeConnReq(const std::string &url, bool isserver=false)
Create connection request to specified url.
Base class for input and output ports.
void SetRateMeter(const Parameter &ref)
Set port ratemeter - must be used from module thread.
unsigned QueueCapacity() const
Method returns actual queue capacity of the port, object mutex is used.
ConnectionRequest GetConnReq(bool force=false)
Return reference on existing request object.
Port(int kind, Reference parent, const std::string &name, unsigned queuesize)
bool fDoingReconnect
true if reconnection is now active
bool SubmitCommandToTransport(Command cmd)
Submit command to connected transport.
bool SetSignaling(EventsProducing kind)
Specifies how often port event will be produced.
virtual bool IsInput() const
void Disconnect(bool witherr=false)
virtual unsigned NumStartEvents()
Return number of events which should be produced when async module starts.
int GetMaxLoopLength()
Return maximum number of events, which could be processed at once.
void SetBindName(const std::string &name)
Set name of bind port - when input and output ports should use same transport.
Parameter fRate
parameter for rate calculations
bool TryNextReconnect(bool caused_by_error, bool can_disconnect=true)
Returns true when reconnection should be attempted.
EventsProducing fSignal
which kinds of signals will be produced
unsigned fQueueCapacity
configured capacity of the queue
std::string fOnError
that to do in case of error
double GetReconnectPeriod() const
virtual bool IsOutput() const
bool IsConnected() const
Method can only be used from thread itself.
void ConfigureReconnect(double period=-1, int numtry=-1)
Specify reconnect period and number of reconnect tries If both negative, disable reconnect.
void SetDoingReconnect(bool on=true)
double fReconnectPeriod
defines how often reconnect for port should be tried, -1 disable reconnect
void RemoveConnReq()
Remove connection request - it does not automatically means that port will be disconnected.
int fReconnectLimit
number of reconnect attempts, default 10
unsigned fMaxLoopLength
maximum length of single event-processing loop
virtual void ObjectCleanup()
Inherited method, should cleanup everything.
std::string GetBindName() const
Returns name of bind port.
void SetMaxLoopLength(unsigned cnt)
Specifies how many events can be processed at once.
LocalTransportRef fQueue
queue with buffers
bool IsDoingReconnect() const
Return true if reconnection procedure started for the port.
virtual void DoCleanup()
Called when module object is cleaned up - should release all references if any.
void SetQueue(Reference &ref)
EventsProducing SignalingKind() const
Returns configured signaling mode.
std::string fBindName
name of bind port (when input and output connected to same transport)
void ConfigureOnError(const std::string &action="")
Configure action in case of error.
void ReadPortConfiguration()
Should be called from constructors of derived classes to read port configuration like queue and so on...
virtual const char * ClassName() const
Returns class name of the object instance.
std::string fRateName
name of rate parameter, which should be assigned to port
Reference on the arbitrary object
void Release()
Releases reference on the object.
Object * GetObject() const
Return pointer on the object.