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
0e10a4b9
Commit
0e10a4b9
authored
May 27, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen): добавил проверку что 'выход' сохранился в SM.
parent
7804bea0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
157 additions
and
11 deletions
+157
-11
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+32
-2
ctl-cpp-cc-alone.xsl
Utilities/codegen/ctl-cpp-cc-alone.xsl
+32
-2
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+32
-2
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+48
-3
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+6
-1
libuniset2.spec
conf/libuniset2.spec
+4
-1
uniset-codegen.dox
docs/DocPages/uniset-codegen.dox
+3
-0
UObject_SK.h
extensions/include/UObject_SK.h
+0
-0
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
0e10a4b9
...
...
@@ -353,7 +353,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
@@ -368,7 +383,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::updateOutputs( bool _force )
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
Utilities/codegen/ctl-cpp-cc-alone.xsl
View file @
0e10a4b9
...
...
@@ -291,7 +291,22 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
@@ -306,7 +321,22 @@ UniSetTypes::ObjectId <xsl:value-of select="$CLASSNAME"/>_SK::getSMTestID()
{
si.id =
<xsl:value-of
select=
"../../@name"
/>
;
si.node = node_
<xsl:value-of
select=
"../../@name"
/>
;
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
0e10a4b9
...
...
@@ -293,7 +293,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
@@ -311,7 +326,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preAskSensors( UniversalIO::UIOComm
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
{
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
0e10a4b9
...
...
@@ -234,7 +234,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
ui->setValue( si,
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
...
...
@@ -252,7 +267,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
ui->setValue( si,
<xsl:value-of
select=
"$setval"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
...
...
@@ -269,7 +299,22 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::initFromSM()
{
si.id =
<xsl:value-of
select=
"@name"
/>
;
si.node = node_
<xsl:value-of
select=
"@name"
/>
;
ui->setValue( si,(long)m_
<xsl:value-of
select=
"@name"
/>
, getId() );
unsigned int i=0;
for( ; i
<
setValueNumberOfAttempts; i++ )
{
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 )
...
...
Utilities/codegen/ctl-cpp-common.xsl
View file @
0e10a4b9
...
...
@@ -345,6 +345,7 @@
</xsl:template>
<xsl:template
name=
"COMMON-HEAD-PRIVATE"
>
unsigned int setValueNumberOfAttempts = { 3 }; // количество попыток, сохранить 'out' (см. updateOutputs)
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
class PtrMapHashFn
{
...
...
@@ -836,7 +837,7 @@ end_private(false)
logserv = make_shared
<
LogServer
>
(loga);
logserv-
>
init( argprefix + "logserver", confnode );
<xsl:for-each
select=
"//smap/item"
>
<xsl:if
test=
"normalize-space(@no_check_id)!='1'"
>
if(
<xsl:value-of
select=
"normalize-space(@name)"
/>
== UniSetTypes::DefaultObjectId )
...
...
@@ -907,6 +908,8 @@ end_private(false)
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:if
test=
"normalize-space(@default)=''"
>
...
...
@@ -994,6 +997,7 @@ end_private(false)
vmonit(maxHeartBeat);
vmonit(activateTimeout);
vmonit(smReadyTimeout);
vmonit(setValueNumberOfAttempts);
}
// -----------------------------------------------------------------------------
...
...
@@ -1357,6 +1361,7 @@ askPause(uniset_conf()->getPIntProp(cnode,"askPause",2000))
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>
);
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>
");
if( s_resetTime.empty() )
...
...
conf/libuniset2.spec
View file @
0e10a4b9
...
...
@@ -14,7 +14,7 @@
Name: libuniset2
Version: 2.3
Release: alt
5
Release: alt
6
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
...
...
@@ -483,6 +483,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%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
- fixes after coverity_scan
...
...
docs/DocPages/uniset-codegen.dox
View file @
0e10a4b9
...
...
@@ -224,6 +224,7 @@
- \b --argprefix-activate-timeout msec
- \b --argprefix-startup-timeout msec
- \b --argprefix-log-[add|del]-levels xxx,xxx,xxx
- \b --argprefix-setValueNumberOfAttempts num
\section pg_Codegen_Configuration Конфигурирование
...
...
@@ -254,6 +255,8 @@
- \b activateTimeout = conf->getArgPInt("--activate-timeout", 20000); - время отведённое на инициализацию процесса
- \b msec = conf->getArgPInt("--startup-timeout", 10000); - пауза, в течение которой игнорируется сообщение SystemMessage::WatchDog.
В случае если они приходят подряд.
- \b setValueNumberOfAttempts - количество попыток сохранить 'выходы'(out_xxx) в SharedMemory.
\section pg_Codegen_TestMode Специальный режим "тест" (TestMode)
...
...
extensions/include/UObject_SK.h
View file @
0e10a4b9
This diff is collapsed.
Click to expand it.
extensions/lib/UObject_SK.cc
View file @
0e10a4b9
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