Commit bbb8a0fa authored by Pavel Vainerman's avatar Pavel Vainerman

Configuration: исправил ошибку со static переменными (конфигураций может быть…

Configuration: исправил ошибку со static переменными (конфигураций может быть много..а это не учитывалось).
parent 1863043e
...@@ -91,7 +91,7 @@ namespace UniSetTypes ...@@ -91,7 +91,7 @@ namespace UniSetTypes
inline ObjectId getDBServer() const { return localDBServer; } /*!< получение идентификатора DBServer-а */ inline ObjectId getDBServer() const { return localDBServer; } /*!< получение идентификатора DBServer-а */
inline ObjectId getLocalNode() const { return localNode; } /*!< получение идентификатора локального узла */ inline ObjectId getLocalNode() const { return localNode; } /*!< получение идентификатора локального узла */
inline std::string getLocalNodeName() const { return localNodeName; } /*!< получение название локального узла */ inline std::string getLocalNodeName() const { return localNodeName; } /*!< получение название локального узла */
inline const std::string getNSName() const { return NSName; } inline const std::string getNSName() const { return NSName; }
// repository // repository
inline std::string getRootSection() const { return secRoot; } inline std::string getRootSection() const { return secRoot; }
...@@ -182,9 +182,9 @@ namespace UniSetTypes ...@@ -182,9 +182,9 @@ namespace UniSetTypes
void setConfFileName( const std::string& fn="" ); void setConfFileName( const std::string& fn="" );
void initParameters(); void initParameters();
void setLocalNode( const std::string& nodename ); void setLocalNode( const std::string& nodename );
std::string getPort( const std::string& port="" ); std::string getPort( const std::string& port="" );
std::string rootDir; std::string rootDir;
UniXML unixml; UniXML unixml;
...@@ -192,7 +192,7 @@ namespace UniSetTypes ...@@ -192,7 +192,7 @@ namespace UniSetTypes
const char* const* _argv; const char* const* _argv;
CORBA::ORB_var orb; CORBA::ORB_var orb;
CORBA::PolicyList policyList; CORBA::PolicyList policyList;
std::string NSName; /*!< имя сервиса именования на ланной машине (обычно "NameService") */ std::string NSName; /*!< имя сервиса именования на ланной машине (обычно "NameService") */
unsigned int countOfNet; /*!< количество резервных каналов */ unsigned int countOfNet; /*!< количество резервных каналов */
unsigned int repeatCount; /*!< количество попыток получить доступ к удаленному объекту unsigned int repeatCount; /*!< количество попыток получить доступ к удаленному объекту
...@@ -210,15 +210,15 @@ namespace UniSetTypes ...@@ -210,15 +210,15 @@ namespace UniSetTypes
std::string secServices; std::string secServices;
// xml // xml
static xmlNode* xmlSensorsSec; xmlNode* xmlSensorsSec;
static xmlNode* xmlObjectsSec; xmlNode* xmlObjectsSec;
static xmlNode* xmlControllersSec; xmlNode* xmlControllersSec;
static xmlNode* xmlServicesSec; xmlNode* xmlServicesSec;
static xmlNode* xmlNodesSec; xmlNode* xmlNodesSec;
ObjectId localDBServer; ObjectId localDBServer;
ObjectId localNode; ObjectId localNode;
std::string localNodeName; std::string localNodeName;
std::string fileConfName; std::string fileConfName;
std::string imagesDir; std::string imagesDir;
...@@ -231,21 +231,21 @@ namespace UniSetTypes ...@@ -231,21 +231,21 @@ namespace UniSetTypes
std::string lockDir; std::string lockDir;
bool localIOR; bool localIOR;
bool transientIOR; bool transientIOR;
int heartbeat_msec; int heartbeat_msec;
}; };
/*! Глобальный указатель на конфигуратор */ /*! Глобальный указатель на конфигуратор */
extern Configuration* conf; extern Configuration* conf;
/*! Глобальный объект для вывода логов */ /*! Глобальный объект для вывода логов */
extern DebugStream ulog; extern DebugStream ulog;
// Инициализация UniSetTypes::conf. // Инициализация UniSetTypes::conf.
// ( учитываются параметры командной строки --confile и --id-from-config ) // ( учитываются параметры командной строки --confile и --id-from-config )
void uniset_init( int argc, const char* const* argv, const std::string& xmlfile="configure.xml" ); void uniset_init( int argc, const char* const* argv, const std::string& xmlfile="configure.xml" );
} // end of UniSetTypes namespace } // end of UniSetTypes namespace
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// "синтаксический сахар"..для логов // "синтаксический сахар"..для логов
......
...@@ -161,6 +161,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv ) ...@@ -161,6 +161,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
// PassiveTimer pt(UniSetTimer::WaitUpTime); // PassiveTimer pt(UniSetTimer::WaitUpTime);
ulogsys << "*** configure from file: " << fileConfName << endl; ulogsys << "*** configure from file: " << fileConfName << endl;
// -------------------------------------------------------------------------
xmlSensorsSec = 0;
xmlObjectsSec = 0;
xmlControllersSec = 0;
xmlServicesSec = 0;
xmlNodesSec = 0;
// -------------------------------------------------------------------------
char curdir[FILENAME_MAX]; char curdir[FILENAME_MAX];
getcwd(curdir,FILENAME_MAX); getcwd(curdir,FILENAME_MAX);
...@@ -881,17 +888,11 @@ UniSetTypes::ObjectId Configuration::getNodeID( const std::string& name ) ...@@ -881,17 +888,11 @@ UniSetTypes::ObjectId Configuration::getNodeID( const std::string& name )
} }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
xmlNode* Configuration::xmlSensorsSec = 0;
xmlNode* Configuration::xmlObjectsSec = 0;
xmlNode* Configuration::xmlControllersSec = 0;
xmlNode* Configuration::xmlServicesSec = 0;
xmlNode* Configuration::xmlNodesSec = 0;
// -------------------------------------------------------------------------
xmlNode* Configuration::getXMLSensorsSection() xmlNode* Configuration::getXMLSensorsSection()
{ {
if( xmlSensorsSec ) if( xmlSensorsSec )
return xmlSensorsSec; return xmlSensorsSec;
xmlSensorsSec = unixml.findNode(unixml.getFirstNode(),"sensors"); xmlSensorsSec = unixml.findNode(unixml.getFirstNode(),"sensors");
return xmlSensorsSec; return xmlSensorsSec;
} }
...@@ -900,7 +901,7 @@ xmlNode* Configuration::getXMLObjectsSection() ...@@ -900,7 +901,7 @@ xmlNode* Configuration::getXMLObjectsSection()
{ {
if( xmlObjectsSec ) if( xmlObjectsSec )
return xmlObjectsSec; return xmlObjectsSec;
xmlObjectsSec = unixml.findNode(unixml.getFirstNode(),"objects"); xmlObjectsSec = unixml.findNode(unixml.getFirstNode(),"objects");
return xmlObjectsSec; return xmlObjectsSec;
} }
...@@ -909,7 +910,7 @@ xmlNode* Configuration::getXMLControllersSection() ...@@ -909,7 +910,7 @@ xmlNode* Configuration::getXMLControllersSection()
{ {
if( xmlControllersSec ) if( xmlControllersSec )
return xmlControllersSec; return xmlControllersSec;
xmlControllersSec = unixml.findNode(unixml.getFirstNode(),"controllers"); xmlControllersSec = unixml.findNode(unixml.getFirstNode(),"controllers");
return xmlControllersSec; return xmlControllersSec;
...@@ -919,7 +920,7 @@ xmlNode* Configuration::getXMLServicesSection() ...@@ -919,7 +920,7 @@ xmlNode* Configuration::getXMLServicesSection()
{ {
if( xmlServicesSec ) if( xmlServicesSec )
return xmlServicesSec; return xmlServicesSec;
xmlServicesSec = unixml.findNode(unixml.getFirstNode(),"services"); xmlServicesSec = unixml.findNode(unixml.getFirstNode(),"services");
return xmlServicesSec; return xmlServicesSec;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment