Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
6bd9f0ec
Commit
6bd9f0ec
authored
Dec 26, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал имя NameService уникальным для Configure
parent
7a1c5189
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
47 deletions
+37
-47
start_fg_plogic.sh
extensions/LogicProcessor/start_fg_plogic.sh
+1
-1
Configuration.cc
src/Various/Configuration.cc
+36
-46
No files found.
extensions/LogicProcessor/start_fg_plogic.sh
View file @
6bd9f0ec
#!/bin/sh
#!/bin/sh
uniset-start.sh
-
g
./uniset-plogicproc
--schema
schema.xml
\
uniset-start.sh
-
f
./uniset-plogicproc
--schema
schema.xml
\
--smemory-id
SharedMemory
--name
LProcessor
\
--smemory-id
SharedMemory
--name
LProcessor
\
--confile
test.xml
--unideb-add-levels
info,crit,warn,level9,system
--confile
test.xml
--unideb-add-levels
info,crit,warn,level9,system
src/Various/Configuration.cc
View file @
6bd9f0ec
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include <sstream>
#include <sstream>
#include <iomanip>
#include <iomanip>
#include <string>
#include <string>
#include <omniORB4/internal/initRefs.h>
#include "Configuration.h"
#include "Configuration.h"
#include "Exceptions.h"
#include "Exceptions.h"
...
@@ -47,8 +46,8 @@ using namespace std;
...
@@ -47,8 +46,8 @@ using namespace std;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
static
const
string
UniSetDefaultPort
=
"2809"
;
static
const
string
UniSetDefaultPort
=
"2809"
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
static
ostream
&
print_help
(
ostream
&
os
,
int
width
,
const
string
&
cmd
,
static
ostream
&
print_help
(
ostream
&
os
,
int
width
,
const
string
cmd
,
const
string
&
help
,
const
string
&
tab
=
""
)
const
string
help
,
const
string
tab
=
""
)
{
{
// чтобы не менчять параметры основного потока
// чтобы не менчять параметры основного потока
// создаём свой stream...
// создаём свой stream...
...
@@ -80,20 +79,20 @@ ostream& UniSetTypes::Configuration::help(ostream& os)
...
@@ -80,20 +79,20 @@ ostream& UniSetTypes::Configuration::help(ostream& os)
namespace
UniSetTypes
namespace
UniSetTypes
{
{
DebugStream
unideb
;
DebugStream
unideb
;
Configuration
*
conf
=
0
;
Configuration
*
conf
;
Configuration
::
Configuration
()
:
Configuration
::
Configuration
()
:
mi
(
NULL
),
mi
(
NULL
),
oind
(
NULL
),
oind
(
NULL
),
NSName
(
"NameService"
),
NSName
(
"NameService"
),
repeatCount
(
2
),
repeatTimeout
(
100
),
repeatCount
(
2
),
repeatTimeout
(
100
),
localTimerService
(
UniSetTypes
::
DefaultObjectId
),
localTimerService
(
UniSetTypes
::
DefaultObjectId
),
localDBServer
(
UniSetTypes
::
DefaultObjectId
),
localDBServer
(
UniSetTypes
::
DefaultObjectId
),
localInfoServer
(
UniSetTypes
::
DefaultObjectId
),
localInfoServer
(
UniSetTypes
::
DefaultObjectId
),
localNode
(
UniSetTypes
::
DefaultObjectId
),
localNode
(
UniSetTypes
::
DefaultObjectId
),
localNodeName
(
""
),
localNodeName
(
""
),
fileConfName
(
""
),
fileConfName
(
""
),
heartbeat_msec
(
5
000
)
heartbeat_msec
(
10
000
)
{
{
// unideb[Debug::CRIT] << " configuration FAILED!!!!!!!!!!!!!!!!!" << endl;
// unideb[Debug::CRIT] << " configuration FAILED!!!!!!!!!!!!!!!!!" << endl;
// throw Exception();
// throw Exception();
...
@@ -199,10 +198,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -199,10 +198,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
getcwd
(
curdir
,
FILENAME_MAX
);
getcwd
(
curdir
,
FILENAME_MAX
);
rootDir
=
string
(
curdir
)
+
"/"
;
rootDir
=
string
(
curdir
)
+
"/"
;
UniSetTypes
::
conf
=
this
;
/*! \todo Надо избавляться от глобального conf (!) */
if
(
!
UniSetTypes
::
conf
)
UniSetTypes
::
conf
=
this
;
{
{
ostringstream
s
;
ostringstream
s
;
...
@@ -228,6 +224,10 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -228,6 +224,10 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
throw
;
throw
;
}
}
// default value
heartbeat_msec
=
5000
;
// cerr << "*************** initConfiguration: xmlOpen: " << pt.getCurrent() << " msec " << endl;
// cerr << "*************** initConfiguration: xmlOpen: " << pt.getCurrent() << " msec " << endl;
// pt.reset();
// pt.reset();
...
@@ -252,7 +252,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -252,7 +252,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
unideb
[
Debug
::
CRIT
]
<<
"(Configuration:init): INIT FAILED! from "
<<
fileConfName
<<
endl
;
unideb
[
Debug
::
CRIT
]
<<
"(Configuration:init): INIT FAILED! from "
<<
fileConfName
<<
endl
;
throw
;
throw
ex
;
}
}
}
}
}
}
...
@@ -274,6 +274,9 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -274,6 +274,9 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
// Настраиваем отладочные логи
// Настраиваем отладочные логи
initDebug
(
unideb
,
"UniSetDebug"
);
initDebug
(
unideb
,
"UniSetDebug"
);
// cerr << "*************** initConfiguration: oind: " << pt.getCurrent() << " msec " << endl;
// pt.reset();
// default init...
// default init...
transientIOR
=
false
;
transientIOR
=
false
;
localIOR
=
false
;
localIOR
=
false
;
...
@@ -284,14 +287,20 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -284,14 +287,20 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
initParameters
();
initParameters
();
// help
// if( !getArgParam("--help").empty() )
// help(cout);
initRepSections
();
initRepSections
();
// localIOR
// localIOR
// localIOR = false; // ??. initParameters()
int
lior
=
getArgInt
(
"--localIOR"
);
int
lior
=
getArgInt
(
"--localIOR"
);
if
(
lior
)
if
(
lior
)
localIOR
=
lior
;
localIOR
=
lior
;
// transientIOR
// transientIOR
// transientIOR = false; // ??. initParameters()
int
tior
=
getArgInt
(
"--transientIOR"
);
int
tior
=
getArgInt
(
"--transientIOR"
);
if
(
tior
)
if
(
tior
)
transientIOR
=
tior
;
transientIOR
=
tior
;
...
@@ -299,6 +308,9 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -299,6 +308,9 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
if
(
imagesDir
[
0
]
!=
'/'
&&
imagesDir
[
0
]
!=
'.'
)
if
(
imagesDir
[
0
]
!=
'/'
&&
imagesDir
[
0
]
!=
'.'
)
imagesDir
=
dataDir
+
imagesDir
+
"/"
;
imagesDir
=
dataDir
+
imagesDir
+
"/"
;
// cerr << "*************** initConfiguration: parameters...: " << pt.getCurrent() << " msec " << endl;
// pt.reset();
// считываем список узлов
// считываем список узлов
createNodesList
();
createNodesList
();
...
@@ -323,20 +335,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -323,20 +335,13 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
string
name
(
oind
->
getRealNodeName
(
it
->
id
));
string
name
(
oind
->
getRealNodeName
(
it
->
id
));
ostringstream
param
;
ostringstream
param
;
param
<<
this
<<
name
;
param
<<
this
<<
name
<<
"=corbaname::"
<<
it
->
host
<<
":"
<<
it
->
port
;
name
=
param
.
str
();
param
<<
"=corbaname::"
<<
it
->
host
<<
":"
<<
it
->
port
;
new_argv
[
i
+
1
]
=
strdup
(
param
.
str
().
c_str
());
new_argv
[
i
+
1
]
=
strdup
(
param
.
str
().
c_str
());
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"(Configuration): внесли параметр "
<<
param
.
str
()
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"(Configuration): внесли параметр "
<<
param
.
str
()
<<
endl
;
i
+=
2
;
i
+=
2
;
ostringstream
uri
;
uri
<<
"corbaname::"
<<
it
->
host
<<
":"
<<
it
->
port
;
if
(
!
omni
::
omniInitialReferences
::
setFromArgs
(
name
.
c_str
(),
uri
.
str
().
c_str
())
)
cerr
<<
"**********************!!!! FAILED ADD name="
<<
name
<<
" uri="
<<
uri
.
str
()
<<
endl
;
assert
(
i
<
_argc
);
assert
(
i
<
_argc
);
}
}
...
@@ -364,15 +369,6 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
...
@@ -364,15 +369,6 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
new_argv
[
i
+
1
]
=
strdup
(
param
.
str
().
c_str
());
new_argv
[
i
+
1
]
=
strdup
(
param
.
str
().
c_str
());
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"(Configuration): внесли параметр "
<<
param
.
str
()
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"(Configuration): внесли параметр "
<<
param
.
str
()
<<
endl
;
{
ostringstream
ns_name
;
ns_name
<<
this
<<
"NameService"
;
ostringstream
uri
;
uri
<<
"corbaname::"
<<
getProp
(
nsnode
,
"host"
)
<<
":"
<<
defPort
;
if
(
!
omni
::
omniInitialReferences
::
setFromArgs
(
ns_name
.
str
().
c_str
(),
uri
.
str
().
c_str
())
)
cerr
<<
"**********************!!!! FAILED ADD name="
<<
ns_name
<<
" uri="
<<
uri
.
str
()
<<
endl
;
}
}
}
_argv
=
new_argv
;
_argv
=
new_argv
;
...
@@ -580,16 +576,10 @@ void Configuration::initParameters()
...
@@ -580,16 +576,10 @@ void Configuration::initParameters()
if
(
confDir
.
empty
()
)
if
(
confDir
.
empty
()
)
confDir
=
getRootDir
();
confDir
=
getRootDir
();
}
}
}
else
if
(
name
==
"HeartBeatTime"
)
{
// Heartbeat init...
heartbeat_msec
=
it
.
getIntProp
(
"name"
);
xmlNode
*
cnode
=
conf
->
getNode
(
"HeartBeatTime"
);
}
if
(
cnode
)
{
UniXML_iterator
hit
(
cnode
);
heartbeat_msec
=
hit
.
getIntProp
(
"msec"
);
if
(
heartbeat_msec
<=
0
)
heartbeat_msec
=
5000
;
}
}
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
@@ -772,7 +762,7 @@ void Configuration::createNodesList()
...
@@ -772,7 +762,7 @@ void Configuration::createNodesList()
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
Configuration
::
initNode
(
UniSetTypes
::
NodeInfo
&
ninfo
,
UniXML_iterator
&
it
)
void
Configuration
::
initNode
(
UniSetTypes
::
NodeInfo
&
ninfo
,
UniXML_iterator
&
it
)
{
{
if
(
ninfo
.
id
==
getLocalNode
()
)
if
(
ninfo
.
id
==
conf
->
getLocalNode
()
)
ninfo
.
connected
=
true
;
ninfo
.
connected
=
true
;
else
else
ninfo
.
connected
=
false
;
ninfo
.
connected
=
false
;
...
@@ -797,7 +787,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
...
@@ -797,7 +787,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
string
debname
(
_debname
);
string
debname
(
_debname
);
xmlNode
*
dnode
=
getNode
(
_debname
);
xmlNode
*
dnode
=
conf
->
getNode
(
_debname
);
if
(
dnode
==
NULL
)
if
(
dnode
==
NULL
)
deb
<<
"(Configuration)(initDebug): WARNING! Not found conf. section for log '"
<<
_debname
<<
"'"
<<
endl
;
deb
<<
"(Configuration)(initDebug): WARNING! Not found conf. section for log '"
<<
_debname
<<
"'"
<<
endl
;
else
else
...
@@ -953,7 +943,7 @@ ObjectId Configuration::getSensorID( const std::string name )
...
@@ -953,7 +943,7 @@ ObjectId Configuration::getSensorID( const std::string name )
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
DefaultObjectId
;
return
DefaultObjectId
;
return
oind
->
getIdByName
(
getSensorsSection
()
+
"/"
+
name
);
return
oind
->
getIdByName
(
conf
->
getSensorsSection
()
+
"/"
+
name
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ObjectId
Configuration
::
getControllerID
(
const
std
::
string
name
)
ObjectId
Configuration
::
getControllerID
(
const
std
::
string
name
)
...
@@ -961,7 +951,7 @@ ObjectId Configuration::getControllerID( const std::string name )
...
@@ -961,7 +951,7 @@ ObjectId Configuration::getControllerID( const std::string name )
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
DefaultObjectId
;
return
DefaultObjectId
;
return
oind
->
getIdByName
(
getControllersSection
()
+
"/"
+
name
);
return
oind
->
getIdByName
(
conf
->
getControllersSection
()
+
"/"
+
name
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ObjectId
Configuration
::
getObjectID
(
const
std
::
string
name
)
ObjectId
Configuration
::
getObjectID
(
const
std
::
string
name
)
...
@@ -969,7 +959,7 @@ ObjectId Configuration::getObjectID( const std::string name )
...
@@ -969,7 +959,7 @@ ObjectId Configuration::getObjectID( const std::string name )
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
DefaultObjectId
;
return
DefaultObjectId
;
return
oind
->
getIdByName
(
getObjectsSection
()
+
"/"
+
name
);
return
oind
->
getIdByName
(
conf
->
getObjectsSection
()
+
"/"
+
name
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ObjectId
Configuration
::
getServiceID
(
const
std
::
string
name
)
ObjectId
Configuration
::
getServiceID
(
const
std
::
string
name
)
...
@@ -977,7 +967,7 @@ ObjectId Configuration::getServiceID( const std::string name )
...
@@ -977,7 +967,7 @@ ObjectId Configuration::getServiceID( const std::string name )
if
(
name
.
empty
()
)
if
(
name
.
empty
()
)
return
DefaultObjectId
;
return
DefaultObjectId
;
return
oind
->
getIdByName
(
getServicesSection
()
+
"/"
+
name
);
return
oind
->
getIdByName
(
conf
->
getServicesSection
()
+
"/"
+
name
);
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
UniSetTypes
::
ObjectId
Configuration
::
getNodeID
(
const
std
::
string
name
,
std
::
string
alias
)
UniSetTypes
::
ObjectId
Configuration
::
getNodeID
(
const
std
::
string
name
,
std
::
string
alias
)
...
@@ -1068,7 +1058,7 @@ UniversalIO::IOTypes Configuration::getIOType( UniSetTypes::ObjectId id )
...
@@ -1068,7 +1058,7 @@ UniversalIO::IOTypes Configuration::getIOType( UniSetTypes::ObjectId id )
UniversalIO
::
IOTypes
Configuration
::
getIOType
(
const
std
::
string
name
)
UniversalIO
::
IOTypes
Configuration
::
getIOType
(
const
std
::
string
name
)
{
{
// Если указано "короткое" имя
// Если указано "короткое" имя
// то просто сперва ищём ID, а потом по нему
// то просто сперва ищём ID, а потом по нему
// iotype
// iotype
ObjectId
id
=
getSensorID
(
name
);
ObjectId
id
=
getSensorID
(
name
);
if
(
id
!=
DefaultObjectId
)
if
(
id
!=
DefaultObjectId
)
...
@@ -1086,7 +1076,7 @@ UniversalIO::IOTypes Configuration::getIOType( const std::string name )
...
@@ -1086,7 +1076,7 @@ UniversalIO::IOTypes Configuration::getIOType( const std::string name )
return
UniversalIO
::
UnknownIOType
;
return
UniversalIO
::
UnknownIOType
;
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
&
xmlfile
)
void
uniset_init
(
int
argc
,
const
char
*
const
*
argv
,
const
std
::
string
xmlfile
)
{
{
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
xmlfile
);
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
xmlfile
);
UniSetTypes
::
conf
=
new
Configuration
(
argc
,
argv
,
confile
);
UniSetTypes
::
conf
=
new
Configuration
(
argc
,
argv
,
confile
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment