22 #ifndef Configuration_H_
23 #define Configuration_H_
29 #include "UniSetTypes.h"
30 #include "ObjectIndex.h"
31 #include "PassiveTimer.h"
50 static std::ostream& help(std::ostream& os);
53 Configuration(
int argc,
const char*
const* argv,
const std::string& xmlfile =
"" );
56 Configuration(
int argc,
const char*
const* argv, std::shared_ptr<ObjectIndex>
oind,
const std::string& xmlfile =
"" );
63 std::string
getField(
const std::string& path)
const noexcept;
65 int getIntField(
const std::string& path)
const noexcept;
67 int getPIntField(
const std::string& path,
int def)
const noexcept;
69 xmlNode* findNode(xmlNode* node,
const std::string& searchnode,
const std::string& name =
"" )
const noexcept;
72 xmlNode* getNode(
const std::string& path)
const noexcept;
75 std::string getProp(xmlNode*,
const std::string& name)
const noexcept;
76 int getIntProp(xmlNode*,
const std::string& name)
const noexcept;
77 int getPIntProp(xmlNode*,
const std::string& name,
int def)
const noexcept;
80 std::string getPropByNodeName(
const std::string& nodename,
const std::string& prop)
const noexcept;
83 int getArgc()
const noexcept;
84 const char*
const* getArgv()
const noexcept;
88 const std::string getNSName()
const noexcept;
91 std::string getRootSection()
const noexcept;
92 std::string getSensorsSection()
const noexcept;
93 std::string getObjectsSection()
const noexcept;
94 std::string getControllersSection()
const noexcept;
95 std::string getServicesSection()
const noexcept;
97 xmlNode* getXMLSensorsSection() noexcept;
98 xmlNode* getXMLObjectsSection() noexcept;
99 xmlNode* getXMLControllersSection() noexcept;
100 xmlNode* getXMLServicesSection() noexcept;
101 xmlNode* getXMLNodesSection() noexcept;
105 UniversalIO::IOType getIOType(
const std::string& name )
const noexcept;
108 size_t getCountOfNet()
const noexcept;
109 timeout_t getRepeatTimeout()
const noexcept;
110 size_t getRepeatCount()
const noexcept;
122 const std::string getConfFileName()
const noexcept;
123 std::string getImagesDir()
const noexcept;
125 timeout_t getHeartBeatTime()
const noexcept;
128 const std::string getConfDir()
const noexcept;
129 const std::string getDataDir()
const noexcept;
130 const std::string getBinDir()
const noexcept;
131 const std::string getLogDir()
const noexcept;
132 const std::string getLockDir()
const noexcept;
133 const std::string getDocDir()
const noexcept;
135 bool isLocalIOR()
const noexcept;
136 bool isTransientIOR()
const noexcept;
139 std::string
getArgParam(
const std::string& name,
const std::string& defval =
"")
const noexcept;
142 std::string
getArg2Param(
const std::string& name,
const std::string& defval,
const std::string& defval2 =
"")
const noexcept;
145 int getArgInt(
const std::string& name,
const std::string& defval =
"")
const noexcept;
148 int getArgPInt(
const std::string& name,
int defval)
const noexcept;
149 int getArgPInt(
const std::string& name,
const std::string& strdefval,
int defval)
const noexcept;
151 xmlNode* initLogStream(
DebugStream& deb,
const std::string& nodename ) noexcept;
152 xmlNode* initLogStream( std::shared_ptr<DebugStream> deb,
const std::string& nodename ) noexcept;
153 xmlNode* initLogStream(
DebugStream* deb,
const std::string& nodename ) noexcept;
155 uniset::ListOfNode::const_iterator listNodesBegin()
const noexcept;
156 uniset::ListOfNode::const_iterator listNodesEnd()
const noexcept;
159 std::shared_ptr<ObjectIndex>
oind;
165 const std::shared_ptr<UniXML>
getConfXML() const noexcept;
167 CORBA::ORB_ptr getORB() const;
168 const CORBA::PolicyList getPolicy() const noexcept;
173 virtual
void initConfiguration(
int argc, const
char* const* argv);
175 void createNodesList();
176 virtual
void initNode( uniset::
NodeInfo& ninfo,
UniXML::iterator& it) noexcept;
178 void initRepSections();
179 std::
string getRepSectionName(const std::
string& sec, xmlNode* secnode = 0 );
180 void setConfFileName( const std::
string& fn = "" );
181 void initParameters();
182 void setLocalNode( const std::
string& nodename );
184 std::
string getPort( const std::
string& port = "" ) const noexcept;
186 std::
string rootDir = {
"" };
187 std::shared_ptr<UniXML> unixml;
190 const char** _argv = {
nullptr };
192 CORBA::PolicyList policyList;
201 uniset::ListOfNode lnodes;
204 std::string secRoot = {
"" };
205 std::string secSensors = {
"" };
206 std::string secObjects = {
"" };
207 std::string secControlles = {
"" };
208 std::string secServices = {
"" };
211 xmlNode* xmlSensorsSec = { 0 };
212 xmlNode* xmlObjectsSec = { 0 };
213 xmlNode* xmlControllersSec = { 0 };
214 xmlNode* xmlServicesSec = { 0 };
215 xmlNode* xmlNodesSec = { 0 };
220 std::string localNodeName = {
"" };
221 std::string fileConfName = {
"" };
222 std::string imagesDir = {
"" };
224 std::string confDir = {
"" };
225 std::string dataDir = {
"" };
226 std::string binDir = {
"" };
227 std::string logDir = {
"" };
228 std::string docDir = {
"" };
229 std::string lockDir = {
"" };
230 bool localIOR = {
false };
231 bool transientIOR = {
false };
233 timeout_t heartbeat_msec = { 3000 };
237 std::shared_ptr<Configuration>
uniset_conf() noexcept;
243 std::shared_ptr<Configuration>
uniset_init(
int argc, const
char* const* argv, const std::
string& xmlfile = "configure.xml" );
248 #define uinfo if( uniset::ulog()->debugging(Debug::INFO) ) uniset::ulog()->info()
249 #define uwarn if( uniset::ulog()->debugging(Debug::WARN) ) uniset::ulog()->warn()
250 #define ucrit if( uniset::ulog()->debugging(Debug::CRIT) ) uniset::ulog()->crit()
251 #define ulog1 if( uniset::ulog()->debugging(Debug::LEVEL1) ) uniset::ulog()->level1()
252 #define ulog2 if( uniset::ulog()->debugging(Debug::LEVEL2) ) uniset::ulog()->level2()
253 #define ulog3 if( uniset::ulog()->debugging(Debug::LEVEL3) ) uniset::ulog()->level3()
254 #define ulog4 if( uniset::ulog()->debugging(Debug::LEVEL4) ) uniset::ulog()->level4()
255 #define ulog5 if( uniset::ulog()->debugging(Debug::LEVEL5) ) uniset::ulog()->level5()
256 #define ulog6 if( uniset::ulog()->debugging(Debug::LEVEL6) ) uniset::ulog()->level6()
257 #define ulog7 if( uniset::ulog()->debugging(Debug::LEVEL7) ) uniset::ulog()->level7()
258 #define ulog8 if( uniset::ulog()->debugging(Debug::LEVEL8) ) uniset::ulog()->level8()
259 #define ulog9 if( uniset::ulog()->debugging(Debug::LEVEL9) ) uniset::ulog()->level9()
260 #define ulogsys if( uniset::ulog()->debugging(Debug::SYSTEM) ) uniset::ulog()->system()
261 #define ulogrep if( uniset::ulog()->debugging(Debug::REPOSITORY) ) uniset::ulog()->repository()
262 #define ulogany uniset::ulog()->any()
264 #endif // Configuration_H_