23 #include "dabc/Factory.h"
44 fSelected = FindContext(nodeid);
46 if (!fSelected)
return false;
54 if (envDABCUSERDIR.empty()) envDABCUSERDIR = GetEnv(
xmlDABCUSERDIR);
57 if (getcwd(sbuf,
sizeof(sbuf)))
58 envDABCWORKDIR = sbuf;
62 fMgrHost = NodeName(nodeid);
63 fMgrPort = NodePort(nodeid);
66 fMgrName = ContextName(nodeid);
67 envContext = fMgrName;
69 DOUT2(
"Select context nodeid %u name %s", nodeid, fMgrName.c_str());
74 fMgrNumNodes = numnodes;
96 std::string syslog =
"";
108 if (!log.empty()) syslog = log;
123 if (!fSelected)
return std::string(
"");
130 if (!fSelected)
return std::string(
"");
137 if (!fSelected)
return -1;
139 if (res.empty())
return -1;
146 if (!fSelected)
return true;
147 std::string res = Find1(fSelected,
"",
xmlRunNode,
"slow-time");
155 if (!fSelected)
return 0;
164 if (!fSelected)
return 0;
174 if (!fSelected)
return std::string(
"");
181 if (!fSelected)
return 0.;
183 if (res.empty())
return 0.;
190 if (!fSelected)
return 0.;
192 if (res.empty())
return 0.;
199 if (!fSelected)
return 0.;
201 if (res.empty())
return 0.;
208 if (!fSelected)
return true;
214 if (!fSelected)
return "";
221 if (!fSelected)
return "";
229 if (!fSelected)
return std::string(
"");
230 return Find1(fSelected, dflt ? dflt :
"",
xmlUserNode, name);
235 std::string sres = GetUserPar(name);
236 if (sres.empty())
return dflt;
243 if (!fSelected)
return std::string();
257 return std::string(res ? res :
"");
263 if (!fSelected)
return false;
270 if (libname.empty())
break;
271 DOUT2(
"Find library %s in config", libname.c_str());
282 prev = FindMatch(prev, fSelected, nodename);
287 if ((autoattr!=0) && strcmp(autoattr,
xmlFalseValue)==0)
continue;
289 if (!check_name_for_multicast)
break;
291 if ((nameattr==0) || (strpbrk(nameattr,
"*?")==0))
break;
Base class to read configuration from xml file.
double GetHaltTime()
Returns time, required to halt DABC process.
double GetThrdStopTime()
Returns time, required for normal thread stopping.
static std::string fLocalHost
std::string ThreadsLayout()
int GetUserParInt(const char *name, int dflt=0)
bool NextCreationNode(XMLNodePointer_t &prev, const char *nodename, bool check_name_for_multicast)
Method is used to find xml nodes like Module, MemoryPool, Connection in the xml file which should be ...
bool SelectContext(unsigned nodeid, unsigned numnodes)
std::string InitFuncName()
int UseControl()
Defines if control used in dabc node.
std::string RunFuncName()
std::string MasterName()
Defines master DABC process, to which application will be connected Master means all control and moni...
std::string Affinity()
Return default affinity of any newly created thread.
std::string GetUserPar(const char *name, const char *dflt=0)
int WithPublisher()
Returns true when publisher should be created.
Configuration(const char *fname=0)
double GetRunTime()
Returns configured time to run DABC process.
std::string ConetextAppClass()
static bool LoadLibrary(const std::string &fname)
virtual void Syslog(const char *prefix)
void SetLogLimit(unsigned limit=100)
virtual void LogFile(const char *fname)
void SetSyslogLevel(int level=0)
void SetDebugMask(unsigned mask)
static Logger * Instance()
void SetFileMask(unsigned mask)
XMLNodePointer_t GetNext(XMLNodePointer_t xmlnode)
const char * GetAttr(XMLNodePointer_t xmlnode, const char *name)
XMLNodePointer_t GetChild(XMLNodePointer_t xmlnode)
const char * xmlThrdStopTime
const char * xmlNoDebugPrefix
void SetDebugLevel(int level=0)
const char * xmlMasterProcess
bool str_to_double(const char *val, double *res)
Convert string to double value.
std::string format(const char *fmt,...)
const char * xmlThreadsLayout
const char * xmlApplication
const char * xmlDebuglevel
const char * xmlDABCUSERDIR
const char * xmlTrueValue
const char * xmlSocketHost
const char * xmlPublisher
void SetDebugPrefix(const char *prefix=0)
const char * xmlUseControl
const char * xmlFalseValue
const char * xmlClassAttr
void SetFileLevel(int level=0)
const char * xmlSysloglevel
const char * xmlNormalMainThrd
bool str_to_int(const char *val, int *res)
Convert string to integer value.