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
bfb0a5b0
Commit
bfb0a5b0
authored
Jun 02, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "(codegen): добавил проверку что 'выход' сохранился в SM."
This reverts commit
0e10a4b9
.
parent
741852ac
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
208 deletions
+91
-208
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+0
-30
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+0
-30
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+0
-30
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+0
-45
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+0
-5
libuniset2.spec
conf/libuniset2.spec
+1
-4
uniset-codegen.dox
docs/DocPages/uniset-codegen.dox
+0
-3
UObject_SK.h
extensions/include/UObject_SK.h
+90
-61
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
bfb0a5b0
...
@@ -353,22 +353,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
...
@@ -353,22 +353,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
{
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setmsg): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
{
{
...
@@ -383,22 +368,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
...
@@ -383,22 +368,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
{
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:value-of
select=
"$setval"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setmsg): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
{
{
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
bfb0a5b0
...
@@ -291,22 +291,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
...
@@ -291,22 +291,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
{
{
...
@@ -321,22 +306,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
...
@@ -321,22 +306,7 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:value-of
select=
"$setval"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
{
{
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
bfb0a5b0
...
@@ -293,22 +293,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
...
@@ -293,22 +293,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
@@ -326,22 +311,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
...
@@ -326,22 +311,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:value-of
select=
"$setval"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
catch( UniSetTypes::Exception
&
ex )
catch( UniSetTypes::Exception
&
ex )
{
{
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
bfb0a5b0
...
@@ -234,22 +234,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
...
@@ -234,22 +234,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
...
@@ -267,22 +252,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
...
@@ -267,22 +252,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) ==
<xsl:value-of
select=
"$setval"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setdata): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
...
@@ -299,22 +269,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
...
@@ -299,22 +269,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
ui->setValue( si,(long)m_
<xsl:value-of
select=
"@name"
/>
, getId() );
ui->setValue( si,(long)m_
<xsl:value-of
select=
"@name"
/>
, getId() );
// Проверка, что сохранилось
if( ui->getValue(si.id,si.node) == (long)m_
<xsl:value-of
select=
"@name"
/>
)
break;
}
if( i>=setValueNumberOfAttempts )
{
ostringstream err;
err
<<
myname
<<
"(setmsg): failed setValue for sid="
<<
si.id;
mycrit
<<
err.str()
<<
endl;
throw UniSetTypes::SystemError(err.str());
}
}
}
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
bfb0a5b0
...
@@ -345,7 +345,6 @@
...
@@ -345,7 +345,6 @@
</xsl:template>
</xsl:template>
<xsl:template
name=
"COMMON-HEAD-PRIVATE"
>
<xsl:template
name=
"COMMON-HEAD-PRIVATE"
>
unsigned int setValueNumberOfAttempts = { 3 }; // количество попыток, сохранить 'out' (см. updateOutputs)
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
class PtrMapHashFn
class PtrMapHashFn
{
{
...
@@ -908,8 +907,6 @@ end_private(false)
...
@@ -908,8 +907,6 @@ end_private(false)
maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max",it.getProp("heartbeat_max"), 10);
maxHeartBeat = conf->getArgPInt("--" + argprefix + "heartbeat-max",it.getProp("heartbeat_max"), 10);
}
}
setValueNumberOfAttempts = conf->getArgPInt("--" + argprefix + "setValueNumberOfAttempts",it.getProp("setValueNumberOfAttempts"),setValueNumberOfAttempts);
// Инициализация значений
// Инициализация значений
<xsl:for-each
select=
"//smap/item"
>
<xsl:for-each
select=
"//smap/item"
>
<xsl:if
test=
"normalize-space(@default)=''"
>
<xsl:if
test=
"normalize-space(@default)=''"
>
...
@@ -997,7 +994,6 @@ end_private(false)
...
@@ -997,7 +994,6 @@ end_private(false)
vmonit(maxHeartBeat);
vmonit(maxHeartBeat);
vmonit(activateTimeout);
vmonit(activateTimeout);
vmonit(smReadyTimeout);
vmonit(smReadyTimeout);
vmonit(setValueNumberOfAttempts);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -1361,7 +1357,6 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
...
@@ -1361,7 +1357,6 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
si.node = conf->getLocalNode();
si.node = conf->getLocalNode();
sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec","
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
",
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
);
sleep_msec = conf->getArgPInt("--" + argprefix + "sleep-msec","
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
",
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
);
setValueNumberOfAttempts = conf->getArgPInt("--" + argprefix + "setValueNumberOfAttempts",it.getProp("setValueNumberOfAttempts"),setValueNumberOfAttempts);
string s_resetTime("
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
");
string s_resetTime("
<xsl:call-template
name=
"settings-alone"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
");
if( s_resetTime.empty() )
if( s_resetTime.empty() )
...
...
conf/libuniset2.spec
View file @
bfb0a5b0
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
Name: libuniset2
Name: libuniset2
Version: 2.3
Version: 2.3
Release: alt
6
Release: alt
5
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
License: LGPL
...
@@ -483,9 +483,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
...
@@ -483,9 +483,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
# ..
%changelog
%changelog
* Fri May 27 2016 Pavel Vainerman <pv@altlinux.ru> 2.3-alt6
- codegen: added several attempts to save the value
* Wed May 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.3-alt5
* Wed May 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.3-alt5
- fixes after coverity_scan
- fixes after coverity_scan
...
...
docs/DocPages/uniset-codegen.dox
View file @
bfb0a5b0
...
@@ -224,7 +224,6 @@
...
@@ -224,7 +224,6 @@
- \b --argprefix-activate-timeout msec
- \b --argprefix-activate-timeout msec
- \b --argprefix-startup-timeout msec
- \b --argprefix-startup-timeout msec
- \b --argprefix-log-[add|del]-levels xxx,xxx,xxx
- \b --argprefix-log-[add|del]-levels xxx,xxx,xxx
- \b --argprefix-setValueNumberOfAttempts num
\section pg_Codegen_Configuration Конфигурирование
\section pg_Codegen_Configuration Конфигурирование
...
@@ -255,8 +254,6 @@
...
@@ -255,8 +254,6 @@
- \b activateTimeout = conf->getArgPInt("--activate-timeout", 20000); - время отведённое на инициализацию процесса
- \b activateTimeout = conf->getArgPInt("--activate-timeout", 20000); - время отведённое на инициализацию процесса
- \b msec = conf->getArgPInt("--startup-timeout", 10000); - пауза, в течение которой игнорируется сообщение SystemMessage::WatchDog.
- \b msec = conf->getArgPInt("--startup-timeout", 10000); - пауза, в течение которой игнорируется сообщение SystemMessage::WatchDog.
В случае если они приходят подряд.
В случае если они приходят подряд.
- \b setValueNumberOfAttempts - количество попыток сохранить 'выходы'(out_xxx) в SharedMemory.
\section pg_Codegen_TestMode Специальный режим "тест" (TestMode)
\section pg_Codegen_TestMode Специальный режим "тест" (TestMode)
...
...
extensions/include/UObject_SK.h
View file @
bfb0a5b0
/*
* Copyright (c) 2015 Pavel Vainerman.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/*
/*
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
DO NOT EDIT THIS FILE. IT IS AUTOGENERATED FILE.
...
@@ -8,7 +22,7 @@
...
@@ -8,7 +22,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
*/
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// generate timestamp: 201
6-05-27
+03:00
// generate timestamp: 201
5-12-19
+03:00
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#ifndef UObject_SK_H_
#define UObject_SK_H_
#define UObject_SK_H_
...
@@ -29,7 +43,7 @@ class UObject_SK:
...
@@ -29,7 +43,7 @@ class UObject_SK:
public
UniSetObject
public
UniSetObject
{
{
public
:
public
:
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
UObject_SK
();
UObject_SK
();
virtual
~
UObject_SK
();
virtual
~
UObject_SK
();
...
@@ -43,54 +57,60 @@ class UObject_SK:
...
@@ -43,54 +57,60 @@ class UObject_SK:
virtual
bool
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
=
true
);
virtual
bool
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
=
true
);
inline
std
::
shared_ptr
<
DebugStream
>
log
(){
return
mylog
;
}
inline
std
::
shared_ptr
<
DebugStream
>
log
()
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
(){
return
loga
;
}
{
return
mylog
;
}
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
()
{
return
loga
;
}
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
);
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
);
// "синтаксический сахар"..для логов
// "синтаксический сахар"..для логов
#ifndef myinfo
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#endif
#ifndef mywarn
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#endif
#ifndef mycrit
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#endif
#ifndef mylog1
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#endif
#ifndef mylog2
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#endif
#ifndef mylog3
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#endif
#ifndef mylog4
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#endif
#ifndef mylog5
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#endif
#ifndef mylog6
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#endif
#ifndef mylog7
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#endif
#ifndef mylog8
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#endif
#ifndef mylog9
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#endif
#ifndef mylogany
#ifndef mylogany
#define mylogany log()->any()
#define mylogany log()->any()
#endif
#endif
#ifndef vmonit
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#define vmonit( var ) vmon.add( #var, var )
#endif
#endif
// Вспомогательные функции для удобства логирования
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
// ------------------------------------------------------------
...
@@ -107,16 +127,19 @@ class UObject_SK:
...
@@ -107,16 +127,19 @@ class UObject_SK:
\param id - идентификатор датчика
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
*/
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
*/
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод состояния внутренних переменных */
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
(){
return
std
::
move
(
vmon
.
pretty_str
());
}
inline
std
::
string
dumpVars
()
{
return
std
::
move
(
vmon
.
pretty_str
());
}
// ------------------------------------------------------------
// ------------------------------------------------------------
std
::
string
help
();
std
::
string
help
();
...
@@ -145,13 +168,16 @@ class UObject_SK:
...
@@ -145,13 +168,16 @@ class UObject_SK:
virtual
void
callback
()
override
;
virtual
void
callback
()
override
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
)
override
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
){};
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
{};
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
){}
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
{}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
sigterm
(
int
signo
)
override
;
virtual
void
sigterm
(
int
signo
)
override
;
virtual
bool
activateObject
()
override
;
virtual
bool
activateObject
()
override
;
virtual
std
::
string
getMonitInfo
(){
return
""
;
}
/*!< пользовательская информация выводимая в getInfo() */
virtual
std
::
string
getMonitInfo
()
{
return
""
;
/*!< пользовательская информация выводимая в getInfo() */
}
virtual
void
testMode
(
bool
state
);
virtual
void
testMode
(
bool
state
);
void
updatePreviousValues
();
void
updatePreviousValues
();
...
@@ -164,7 +190,6 @@ class UObject_SK:
...
@@ -164,7 +190,6 @@ class UObject_SK:
void
preSysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
);
void
preSysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
);
void
waitSM
(
int
wait_msec
,
UniSetTypes
::
ObjectId
testID
=
UniSetTypes
::
DefaultObjectId
);
void
waitSM
(
int
wait_msec
,
UniSetTypes
::
ObjectId
testID
=
UniSetTypes
::
DefaultObjectId
);
void
initFromSM
();
void
initFromSM
();
UniSetTypes
::
ObjectId
getSMTestID
();
void
resetMsg
();
void
resetMsg
();
Trigger
trResetMsg
;
Trigger
trResetMsg
;
...
@@ -172,7 +197,7 @@ class UObject_SK:
...
@@ -172,7 +197,7 @@ class UObject_SK:
int
resetMsgTime
;
int
resetMsgTime
;
// Выполнение очередного шага программы
// Выполнение очередного шага программы
virtual
void
step
(){}
virtual
void
step
()
{}
int
sleep_msec
;
/*!< пауза между итерациями */
int
sleep_msec
;
/*!< пауза между итерациями */
bool
active
;
bool
active
;
...
@@ -187,9 +212,15 @@ class UObject_SK:
...
@@ -187,9 +212,15 @@ class UObject_SK:
xmlNode
*
confnode
;
xmlNode
*
confnode
;
/*! получить числовое свойство из конф. файла по привязанной confnode */
/*! получить числовое свойство из конф. файла по привязанной confnode */
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
int
getIntProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getIntProp
(
confnode
,
name
);
}
/*! получить текстовое свойство из конф. файла по привязанной confnode */
/*! получить текстовое свойство из конф. файла по привязанной confnode */
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
inline
const
std
::
string
getProp
(
const
std
::
string
&
name
)
{
return
UniSetTypes
::
uniset_conf
()
->
getProp
(
confnode
,
name
);
}
timeout_t
smReadyTimeout
;
/*!< время ожидания готовности SM */
timeout_t
smReadyTimeout
;
/*!< время ожидания готовности SM */
std
::
atomic_bool
activated
;
std
::
atomic_bool
activated
;
...
@@ -223,8 +254,6 @@ class UObject_SK:
...
@@ -223,8 +254,6 @@ class UObject_SK:
// Используемые идентификаторы сообщений
// Используемые идентификаторы сообщений
unsigned
int
setValueNumberOfAttempts
=
{
3
};
// количество попыток, сохранить 'out' (см. updateOutputs)
bool
end_private
;
// вспомогательное поле (для внутреннего использования при генерировании кода)
bool
end_private
;
// вспомогательное поле (для внутреннего использования при генерировании кода)
};
};
...
...
extensions/lib/UObject_SK.cc
View file @
bfb0a5b0
This diff is collapsed.
Click to expand it.
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