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
7892eb68
Commit
7892eb68
authored
Dec 23, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(LogicProcessor): добавил возможность задавать время ожидания готовности SM
(--sm-ready-timeout)
parent
a89f8c86
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
24 deletions
+38
-24
LProcessor.cc
extensions/LogicProcessor/LProcessor.cc
+11
-4
LProcessor.h
extensions/LogicProcessor/LProcessor.h
+4
-1
PassiveLProcessor.cc
extensions/LogicProcessor/PassiveLProcessor.cc
+9
-8
Schema.cc
extensions/LogicProcessor/Schema.cc
+12
-9
SchemaXML.cc
extensions/LogicProcessor/SchemaXML.cc
+2
-2
No files found.
extensions/LogicProcessor/LProcessor.cc
View file @
7892eb68
#include <iostream>
#include "Configuration.h"
#include "Extensions.h"
#include "PassiveTimer.h"
#include "LProcessor.h"
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
LProcessor
::
LProcessor
()
LProcessor
::
LProcessor
(
const
std
::
string
name
)
:
logname
(
name
)
{
sleepTime
=
conf
->
getArgPInt
(
"--sleepTime"
,
200
);
smReadyTimeout
=
conf
->
getArgInt
(
"--sm-ready-timeout"
,
""
);
if
(
smReadyTimeout
==
0
)
smReadyTimeout
=
60000
;
else
if
(
smReadyTimeout
<
0
)
smReadyTimeout
=
UniSetTimer
::
WaitUpTime
;
}
LProcessor
::~
LProcessor
()
...
...
@@ -28,15 +35,15 @@ void LProcessor::execute( const string lfile )
}
catch
(
LogicException
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
execute): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
logname
<<
"(
execute): "
<<
ex
<<
endl
;
}
catch
(
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
execute): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
logname
<<
"(
execute): "
<<
ex
<<
endl
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
execute): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
logname
<<
"(
execute): catch...
\n
"
;
}
msleep
(
sleepTime
);
}
...
...
extensions/LogicProcessor/LProcessor.h
View file @
7892eb68
...
...
@@ -94,7 +94,7 @@
class
LProcessor
{
public
:
LProcessor
();
LProcessor
(
const
std
::
string
name
=
""
);
virtual
~
LProcessor
();
virtual
void
execute
(
const
string
lfile
);
...
...
@@ -133,6 +133,9 @@ class LProcessor
UniversalInterface
ui
;
int
sleepTime
;
int
smReadyTimeout
;
/*!< время ожидания готовности SM */
std
::
string
logname
;
private
:
...
...
extensions/LogicProcessor/PassiveLProcessor.cc
View file @
7892eb68
...
...
@@ -11,6 +11,7 @@ PassiveLProcessor::PassiveLProcessor( std::string lfile, UniSetTypes::ObjectId o
UniSetObject_LT
(
objId
),
shm
(
0
)
{
logname
=
myname
;
shm
=
new
SMInterface
(
shmID
,
&
(
UniSetObject_LT
::
ui
),
objId
,
ic
);
build
(
lfile
);
}
...
...
@@ -88,9 +89,9 @@ void PassiveLProcessor::sysCommand( UniSetTypes::SystemMessage *sm )
{
case
SystemMessage
:
:
StartUp
:
{
if
(
!
shm
->
waitSMready
(
10000
)
)
if
(
!
shm
->
waitSMready
(
smReadyTimeout
)
)
{
dlog
[
Debug
::
CRIT
]
<<
"(ERR): SM not ready. Terminated... "
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(ERR): SM not ready. Terminated... "
<<
endl
;
raise
(
SIGTERM
);
return
;
}
...
...
@@ -163,17 +164,17 @@ void PassiveLProcessor::setOuts()
break
;
default
:
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
setOuts): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
break
;
}
}
catch
(
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
setOuts): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
setOuts): "
<<
ex
<<
endl
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
setOuts): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
setOuts): catch...
\n
"
;
}
}
}
...
...
@@ -195,17 +196,17 @@ void PassiveLProcessor::sigterm( int signo )
break
;
default
:
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
sigterm): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
sigterm): неподдерживаемый тип iotype="
<<
it
->
iotype
<<
endl
;
break
;
}
}
catch
(
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
sigterm): "
<<
ex
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
sigterm): "
<<
ex
<<
endl
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
"(LProcessor::
sigterm): catch...
\n
"
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(
sigterm): catch...
\n
"
;
}
}
}
...
...
extensions/LogicProcessor/Schema.cc
View file @
7892eb68
#include <sstream>
#include <iostream>
#include "Extensions.h"
#include "Schema.h"
// -------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetExtensions
;
// -------------------------------------------------------------------------
Schema
::
Schema
()
...
...
@@ -30,7 +32,7 @@ void Schema::link(Element::ElementID rootID, Element::ElementID childID, int num
if
(
it
==
emap
.
end
()
)
{
ostringstream
msg
;
msg
<<
"Schema: элемент id="
<<
rootID
<<
"
НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema: элемент id="
<<
rootID
<<
"
NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
e1
=
it
->
second
;
...
...
@@ -39,7 +41,7 @@ void Schema::link(Element::ElementID rootID, Element::ElementID childID, int num
if
(
it
==
emap
.
end
()
)
{
ostringstream
msg
;
msg
<<
"Schema: элемент id="
<<
childID
<<
"
НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema: элемент id="
<<
childID
<<
"
NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
e2
=
it
->
second
;
...
...
@@ -59,7 +61,7 @@ void Schema::unlink( Element::ElementID rootID, Element::ElementID childID )
if
(
it
==
emap
.
end
()
)
{
ostringstream
msg
;
msg
<<
"Schema: элемент id="
<<
rootID
<<
"
НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema: элемент id="
<<
rootID
<<
"
NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
e1
=
it
->
second
;
...
...
@@ -68,7 +70,7 @@ void Schema::unlink( Element::ElementID rootID, Element::ElementID childID )
if
(
it
==
emap
.
end
()
)
{
ostringstream
msg
;
msg
<<
"Schema:
элемент id="
<<
childID
<<
" НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema:
element id="
<<
childID
<<
" NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
e2
=
it
->
second
;
...
...
@@ -92,7 +94,7 @@ void Schema::extlink(string name, Element::ElementID childID, int numIn )
if
(
it
==
emap
.
end
()
)
{
ostringstream
msg
;
msg
<<
"Schema:
элемент id="
<<
childID
<<
" НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema:
element id="
<<
childID
<<
" NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
...
...
@@ -108,9 +110,10 @@ void Schema::extlink(string name, Element::ElementID childID, int numIn )
// -------------------------------------------------------------------------
Element
*
Schema
::
manage
(
Element
*
el
)
{
cout
<<
"Schema: manage new element id="
<<
el
->
getId
()
<<
" type="
<<
el
->
getType
()
<<
" inputs="
<<
el
->
inCount
()
<<
endl
;
if
(
dlog
.
debugging
(
Debug
::
INFO
)
)
dlog
[
Debug
::
INFO
]
<<
"Schema: manage new element id="
<<
el
->
getId
()
<<
" type="
<<
el
->
getType
()
<<
" inputs="
<<
el
->
inCount
()
<<
endl
;
emap
[
el
->
getId
()]
=
el
;
return
el
;
...
...
@@ -160,7 +163,7 @@ bool Schema::getOut( Element::ElementID ID )
return
it
->
second
->
getOut
();
ostringstream
msg
;
msg
<<
"Schema:
элемент id="
<<
ID
<<
" НЕ НАЙДЕН!!
!"
;
msg
<<
"Schema:
element id="
<<
ID
<<
" NOT FOUND
!"
;
throw
LogicException
(
msg
.
str
());
}
// -------------------------------------------------------------------------
...
...
extensions/LogicProcessor/SchemaXML.cc
View file @
7892eb68
...
...
@@ -50,7 +50,7 @@ void SchemaXML::read( const string xmlfile )
{
string
type
(
xml
.
getProp
(
it
,
"type"
));
string
ID
(
xml
.
getProp
(
it
,
"id"
));
int
inCount
(
xml
.
getPIntProp
(
it
,
"inCount"
,
1
)
);
int
inCount
=
xml
.
getPIntProp
(
it
,
"inCount"
,
1
);
if
(
type
==
"OR"
)
manage
(
new
TOR
(
ID
,
inCount
)
);
...
...
@@ -96,7 +96,7 @@ void SchemaXML::read( const string xmlfile )
string
type
(
xml
.
getProp
(
it
,
"type"
));
string
fID
(
xml
.
getProp
(
it
,
"from"
));
string
tID
(
xml
.
getProp
(
it
,
"to"
));
int
toIn
(
xml
.
getIntProp
(
it
,
"toInput"
)
);
int
toIn
=
xml
.
getIntProp
(
it
,
"toInput"
);
if
(
type
==
"ext"
)
{
...
...
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