16 #include "dabc/Device.h"
23 Worker(MakePair(name)),
24 fDeviceDestroyed(false)
26 DOUT3(
"Device %p %s %s constructor prior:%d",
this, GetName(), ItemName().c_str(), WorkerPriority());
37 fDeviceDestroyed =
true;
45 if (cmd.IsName(CmdCreateTransport::CmdName())) {
46 CmdCreateTransport crcmd = cmd;
52 TransportRef tr = CreateTransport(cmd, port);
54 DOUT1(
"Device %s creates transport %p", GetName(), tr());
59 if (thrdname.empty()) thrdname = ThreadName();
61 DOUT1(
"Device %s Create thread %s for transport", GetName(), thrdname.c_str());
64 tr()->fTransportDevice =
this;
66 if (!tr.MakeThreadForWorker(thrdname)) {
67 EOUT(
"Fail to create thread for transport");
72 tr.ConnectPoolHandles();
78 DOUT1(
"Device %s transport is created for port %p %s", GetName(), port(), port.ItemName().c_str());
89 DOUT4(
"Device::Find %p name = %s parent %p",
this, GetName(),
GetParent());
95 if (cfg.CheckAttr(
xmlNameAttr, GetName()))
return true;
virtual void ObjectCleanup()
Central cleanup method for worker.
virtual bool Find(ConfigIO &cfg)
Method to locate object in xml file.
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
Device(const std::string &name)
static int ConnectPorts(Reference port1ref, Reference port2ref, Command cmd=nullptr)
Reference FindPort(const std::string &port)
const char * GetName() const
Returns name of the object, thread safe
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
int WorkerPriority() const
virtual void ObjectCleanup()
Central cleanup method for worker.
XMLNodePointer_t GetParent(XMLNodePointer_t xmlnode)
const char * xmlThreadAttr
const char * xmlDeviceNode