23 dabc::ModuleAsync(name, cmd),
33 CreateTimer(
"SysTimer");
40 if (cmd.
IsName(
"NextBuffer")) {
61 if (fCmd.null())
return;
63 double maxage = fCmd.GetDouble(
"maxage", -1);
69 bool cleanqueue =
false;
70 if ((maxage>0) && InputQueueFull())
71 if (fLastNotFullTm.null() || (now - fLastNotFullTm > maxage)) {
75 if (cleanqueue) fLastNotFullTm = now;
90 if (cleanqueue && CanRecv()) {
100 res = cmd_bool(fIter.Reset(buf));
103 res = AcceptBuffer(buf);
116 if (!InputQueueFull()) fLastNotFullTm.GetNow();
129 if ((maxage <= 0) || fCurBufTm.null())
return true;
130 return !fCurBufTm.Expired(maxage);
153 }
while (!
dabc::mgr.FindModule(name).
null());
157 if (mdl.
null())
return mdl;
160 EOUT(
"Cannot create transport %s",url.c_str());
173 if (
null())
return false;
175 FindPort(InputName()).Disconnect();
179 std::string name = GetName();
192 if (
null())
return 0;
194 bool intime = GetObject()->GetEventInTime(maxage);
196 if (intime && GetObject()->fIter.NextEvent())
197 return GetObject()->fIter.evnt();
203 if (!Execute(cmd, tmout))
return 0;
205 if (GetObject()->fIter.NextEvent())
206 return GetObject()->fIter.evnt();
213 return null() ? 0 : GetObject()->fIter.evnt();
229 }
while (!
dabc::mgr.FindModule(name).
null());
232 cmd.
SetStr(
"node", mbsnode);
233 cmd.
SetInt(
"logger", logport);
234 cmd.
SetInt(
"cmd", cmdport);
235 cmd.
SetInt(
"stat", statport);
250 if (
null())
return false;
252 Execute(
"DeleteWorkers");
256 std::string name = GetName();
270 if (
null())
return false;
273 cmd.
SetStr(
"cmd", mbscmd);
Reference on memory from memory pool.
unsigned GetTypeId() const
Command submitted to worker when item in hierarchy defined as DABC.Command and used to produce custom...
Represents command with its arguments.
double TimeTillTimeout(double extra=0.) const
Returns time which remains until command should be timed out.
bool SetStr(const std::string &name, const char *value)
bool SetBool(const std::string &name, bool v)
bool SetInt(const std::string &name, int v)
Command & SetTimeout(double tm)
Set maximum time which can be used for command execution.
bool SetDouble(const std::string &name, double v)
ModuleRef CreateModule(const std::string &classname, const std::string &modulename, const std::string &thrdname="")
bool DeleteModule(const std::string &name)
ModuleRef FindModule(const std::string &name)
bool CanRecv(unsigned indx=0) const
Method return true if recv from specified port can be done.
std::string InputName(unsigned n=0, bool itemname=true)
Return item name of the input, can be used in connect command.
void ShootTimer(unsigned indx, double delay_sec=0.)
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
void Release()
Releases reference on the object.
bool IsName(const char *name) const
Returns true if object name is the same as specified one.
bool null() const
Returns true if reference contains nullptr.
bool Disconnect()
Release connection to the MBS node.
static MonitorHandle Connect(const std::string &mbsnode, int cmdport=6019, int logport=6007, int statport=6008)
Connect with MBS node.
bool MbsCmd(const std::string &cmd, double tmout=5.)
Execute MBS command.
Handle to organize readout of MBS data source.
mbs::EventHeader * GetEvent()
Get current event pointer.
bool null() const
Check if handle is initialized.
mbs::EventHeader * NextEvent(double tmout=1.0, double maxage=-1.)
Retrieve next event from the server One could specify timeout (how long one should wait for next even...
static ReadoutHandle DoConnect(const std::string &url, const char *classname)
bool Disconnect()
Disconnect from MBS server.
virtual int ExecuteCommand(dabc::Command cmd)
Main method where commands are executed.
dabc::Command fCmd
current nextbuffer cmd
virtual void ProcessTimerEvent(unsigned timer)
Method called by framework when timer event is produced.
bool GetEventInTime(double maxage)
ReadoutModule(const std::string &name, dabc::Command cmd)
virtual void ProcessInputEvent(unsigned port)
Method called by framework when input event is produced.
bool CreateManager(const std::string &name, int cmd_port=-1)
Function should be used to create manager instance.
void SetDebugLevel(int level=0)
std::string format(const char *fmt,...)
Class for acquiring and holding timestamps.