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
01a6fca4
Commit
01a6fca4
authored
May 30, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen): откорректировал шаблоны main и другие мелкие правки
parent
9e2d72de
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
37 deletions
+31
-37
ctl-cpp-cc-alone-ask.xsl
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
+1
-1
ctl-cpp-cc-ask.xsl
Utilities/codegen/ctl-cpp-cc-ask.xsl
+1
-1
ctl-cpp-cc.xsl
Utilities/codegen/ctl-cpp-cc.xsl
+1
-1
ctl-cpp-main-alone.xsl
Utilities/codegen/ctl-cpp-main-alone.xsl
+6
-11
ctl-cpp-main.xsl
Utilities/codegen/ctl-cpp-main.xsl
+3
-7
skel-main.cc
Utilities/codegen/skel-main.cc
+9
-11
skel.h
Utilities/codegen/skel.h
+4
-4
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+1
-0
start_fg.sh
Utilities/codegen/tests/start_fg.sh
+2
-1
test.xml
conf/test.xml
+3
-0
No files found.
Utilities/codegen/ctl-cpp-cc-alone-ask.xsl
View file @
01a6fca4
...
@@ -84,7 +84,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
...
@@ -84,7 +84,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
ui->setValue(idHeartBeat,maxHeartBeat);
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
catch( Exception
&
ex )
catch(
const
Exception
&
ex )
{
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
...
...
Utilities/codegen/ctl-cpp-cc-ask.xsl
View file @
01a6fca4
...
@@ -83,7 +83,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
...
@@ -83,7 +83,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
ui->setValue(idHeartBeat,maxHeartBeat);
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
catch( Exception
&
ex )
catch(
const
Exception
&
ex )
{
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
...
...
Utilities/codegen/ctl-cpp-cc.xsl
View file @
01a6fca4
...
@@ -87,7 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
...
@@ -87,7 +87,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::callback()
ui->setValue(idHeartBeat,maxHeartBeat);
ui->setValue(idHeartBeat,maxHeartBeat);
ptHeartBeat.reset();
ptHeartBeat.reset();
}
}
catch( Exception
&
ex )
catch(
const
Exception
&
ex )
{
{
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
ucrit
<<
myname
<<
"(execute): "
<<
ex
<<
endl;
}
}
...
...
Utilities/codegen/ctl-cpp-main-alone.xsl
View file @
01a6fca4
...
@@ -40,11 +40,10 @@ using namespace UniSetTypes;
...
@@ -40,11 +40,10 @@ using namespace UniSetTypes;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
int main( int argc,char* argv[] )
int main( int argc,char* argv[] )
{
{
if( argc>1
&&
!strcmp(argv[1],"--help"
) )
if( argc>1
&&
( strcmp(argv[1],"--help")==0 || strcmp(argv[1],"-h")==0
) )
{
{
cout
<<
"--name name - ID процесса. По умолчанию IOController1."
<<
endl;
cout
<<
"--name name - ID процесса. По умолчанию IOController1."
<<
endl;
cout
<<
"--confile fname - Конф. файл. по умолчанию configure.xml"
<<
endl;
cout
<<
"--confile fname - Конф. файл. по умолчанию configure.xml"
<<
endl;
cout
<<
"--logfile fname - выводить логи в файл fname. По умолчанию
<xsl:value-of
select=
"$CLASSNAME"
/>
.log"
<<
endl;
return 0;
return 0;
}
}
...
@@ -53,7 +52,7 @@ int main( int argc,char* argv[] )
...
@@ -53,7 +52,7 @@ int main( int argc,char* argv[] )
auto conf = uniset_init(argc, argv);
auto conf = uniset_init(argc, argv);
// определяем ID объекта
// определяем ID объекта
ObjectId ID
(DefaultObjectId)
;
ObjectId ID
= DefaultObjectId
;
string name = conf->getArgParam("--name","
<xsl:value-of
select=
"normalize-space($OID)"
/>
");
string name = conf->getArgParam("--name","
<xsl:value-of
select=
"normalize-space($OID)"
/>
");
if( !name.empty() )
if( !name.empty() )
ID = conf->getObjectID(name);
ID = conf->getObjectID(name);
...
@@ -66,19 +65,15 @@ int main( int argc,char* argv[] )
...
@@ -66,19 +65,15 @@ int main( int argc,char* argv[] )
return 1;
return 1;
}
}
<xsl:value-of
select=
"$CLASSNAME"
/>
obj(ID);
auto obj = make_shared
<
<xsl:value-of
select=
"$CLASSNAME"
/>
>
(ID);
string logfilename = conf->getArgParam("--logfile","
<xsl:value-of
select=
"$CLASSNAME"
/>
.log");
string logname( conf->getLogDir() + logfilename );
obj.mylog->logFile( logname.c_str() );
auto act = UniSetActivator::Instance();
auto act = UniSetActivator::Instance();
act-
>
add(obj
.get_ptr()
);
act-
>
add(obj);
SystemMessage sm(SystemMessage::StartUp);
SystemMessage sm(SystemMessage::StartUp);
act-
>
broadcast( sm.transport_msg() );
act-
>
broadcast( sm.transport_msg() );
act-
>
run(false);
act-
>
run(false);
pause(); // пауза, чтобы дочерние потоки успели завершить работу
return 0;
}
}
catch( const Exception
&
ex )
catch( const Exception
&
ex )
{
{
...
@@ -93,7 +88,7 @@ int main( int argc,char* argv[] )
...
@@ -93,7 +88,7 @@ int main( int argc,char* argv[] )
cerr
<<
"(main): catch ..."
<<
endl;
cerr
<<
"(main): catch ..."
<<
endl;
}
}
return
0
;
return
1
;
}
}
</xsl:template>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
Utilities/codegen/ctl-cpp-main.xsl
View file @
01a6fca4
...
@@ -42,11 +42,10 @@ using namespace UniSetTypes;
...
@@ -42,11 +42,10 @@ using namespace UniSetTypes;
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
int main( int argc, const char** argv )
{
{
if( argc>1
&&
strcmp(argv[1],"--help")==0
)
if( argc>1
&&
(strcmp(argv[1],"--help")==0 || strcmp(argv[1],"-h")==0)
)
{
{
cout
<<
"--name name - ID процесса. По умолчанию
<xsl:value-of
select=
"$CLASSNAME"
/>
."
<<
endl;
cout
<<
"--name name - ID процесса. По умолчанию
<xsl:value-of
select=
"$CLASSNAME"
/>
."
<<
endl;
cout
<<
"--confile fname - Конф. файл. по умолчанию configure.xml"
<<
endl;
cout
<<
"--confile fname - Конф. файл. по умолчанию configure.xml"
<<
endl;
cout
<<
"--logfile fname - выводить логи в файл fname. По умолчанию
<xsl:value-of
select=
"$CLASSNAME"
/>
.log"
<<
endl;
return 0;
return 0;
}
}
...
@@ -58,7 +57,7 @@ int main( int argc, const char** argv )
...
@@ -58,7 +57,7 @@ int main( int argc, const char** argv )
</xsl:if>
</xsl:if>
<xsl:if
test=
"normalize-space(//@OID)=''"
>
<xsl:if
test=
"normalize-space(//@OID)=''"
>
// определяем ID объекта
// определяем ID объекта
ObjectId ID
(DefaultObjectId)
;
ObjectId ID
= DefaultObjectId
;
string name = conf->getArgParam("--name","
<xsl:value-of
select=
"$CLASSNAME"
/>
");
string name = conf->getArgParam("--name","
<xsl:value-of
select=
"$CLASSNAME"
/>
");
if( !name.empty() )
if( !name.empty() )
{
{
...
@@ -71,11 +70,8 @@ int main( int argc, const char** argv )
...
@@ -71,11 +70,8 @@ int main( int argc, const char** argv )
return 0;
return 0;
}
}
}
}
auto obj = make_shared
<
<xsl:value-of
select=
"$CLASSNAME"
/>
>
(ID);
string logfilename = conf->getArgParam("--logfile","
<xsl:value-of
select=
"$CLASSNAME"
/>
.log");
auto obj = make_shared
<
<xsl:value-of
select=
"$CLASSNAME"
/>
>
(ID);
string logname( conf->getLogDir() + logfilename );
obj->mylog->logFile( logname.c_str() );
</xsl:if>
</xsl:if>
auto act = UniSetActivator::Instance();
auto act = UniSetActivator::Instance();
...
...
Utilities/codegen/skel-main.cc
View file @
01a6fca4
#include <sstream>
#include <sstream>
#include <memory>
#include <UniSetActivator.h>
#include <UniSetActivator.h>
#include "Skel.h"
#include "Skel.h"
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -11,30 +12,27 @@ int main( int argc, const char** argv )
...
@@ -11,30 +12,27 @@ int main( int argc, const char** argv )
{
{
auto
conf
=
uniset_init
(
argc
,
argv
);
auto
conf
=
uniset_init
(
argc
,
argv
);
string
logfilename
=
conf
->
getArgParam
(
"--logfile"
,
"Skel.log"
);
string
logname
(
conf
->
getLogDir
()
+
logfilename
);
ulog
.
logFile
(
logname
.
c_str
()
);
auto
act
=
UniSetActivator
::
Instance
();
xmlNode
*
cnode
=
conf
->
getNode
(
"Skel"
);
xmlNode
*
cnode
=
conf
->
getNode
(
"Skel"
);
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
{
{
dlog
.
crit
()
<<
"(Skel): not found <Skel> in conffile"
<<
endl
;
cerr
<<
"(Skel): not found <Skel> in conffile"
<<
endl
;
return
1
;
return
1
;
}
}
Skel
o
(
"Skel"
,
cnode
);
auto
o
=
make_shared
<
Skel
>
(
"Skel"
,
cnode
);
act
.
add
(
o
.
get_ptr
());
auto
act
=
UniSetActivator
::
Instance
();
act
->
add
(
o
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
.
broadcast
(
sm
.
transport_msg
()
);
act
->
broadcast
(
sm
.
transport_msg
()
);
ulogany
<<
"
\n\n\n
"
;
ulogany
<<
"
\n\n\n
"
;
ulogany
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
ulogany
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
dlogany
<<
"
\n\n\n
"
;
dlogany
<<
"
\n\n\n
"
;
dlogany
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
dlogany
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
act
->
run
(
false
);
act
->
run
(
false
);
return
0
;
}
}
catch
(
const
std
::
exception
&
ex
)
catch
(
const
std
::
exception
&
ex
)
{
{
...
@@ -45,6 +43,6 @@ int main( int argc, const char** argv )
...
@@ -45,6 +43,6 @@ int main( int argc, const char** argv )
cerr
<<
"(Skel::main): catch(...)"
<<
endl
;
cerr
<<
"(Skel::main): catch(...)"
<<
endl
;
}
}
return
0
;
return
1
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
Utilities/codegen/skel.h
View file @
01a6fca4
...
@@ -14,10 +14,10 @@ class Skel:
...
@@ -14,10 +14,10 @@ class Skel:
protected
:
protected
:
Skel
();
Skel
();
virtual
void
step
();
virtual
void
step
()
override
;
virtual
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
)
;
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
;
virtual
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
)
;
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
;
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
override
;
private
:
private
:
};
};
...
...
Utilities/codegen/tests/TestGen.cc
View file @
01a6fca4
...
@@ -27,6 +27,7 @@ void TestGen::step()
...
@@ -27,6 +27,7 @@ void TestGen::step()
cout
<<
dumpIO
()
<<
endl
;
cout
<<
dumpIO
()
<<
endl
;
myinfo
<<
str
(
input2_s
)
<<
endl
;
myinfo
<<
str
(
input2_s
)
<<
endl
;
ulog
()
->
info
()
<<
"ulog: "
<<
str
(
input2_s
)
<<
endl
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
TestGen
::
sensorInfo
(
const
SensorMessage
*
sm
)
void
TestGen
::
sensorInfo
(
const
SensorMessage
*
sm
)
...
...
Utilities/codegen/tests/start_fg.sh
View file @
01a6fca4
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
ulimit
-Sc
1000000
ulimit
-Sc
1000000
uniset2-start.sh
-f
./test
--name
TestProc
--confile
test.xml
--ulog-add-levels
info,crit,warn,level1,level8
\
uniset2-start.sh
-f
./test
--name
TestProc
--confile
test.xml
--ulog-add-levels
warn,crit
\
--sm-ready-timeout
5000
--test-run-logserver
--test-log-add-levels
any
--sm-ready-timeout
5000
--test-run-logserver
--test-log-add-levels
any
#info,warn,crit,system,level9 > 1.log
#info,warn,crit,system,level9 > 1.log
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
#--c-filter-field cfilter --c-filter-value test1 --s-filter-field io --s-filter-value 1
conf/test.xml
View file @
01a6fca4
...
@@ -53,6 +53,9 @@
...
@@ -53,6 +53,9 @@
t_check_s=
"Threshold1_S"
t_check_s=
"Threshold1_S"
log_c=
"LogLevel_S"
log_c=
"LogLevel_S"
log_s=
"LogLevel_S"
log_s=
"LogLevel_S"
input1_s=
"Input5_S"
input2_s=
"Input6_S"
output2_c=
"DO2_C"
/>
/>
<IOControl
name=
"IOControl"
/>
<IOControl
name=
"IOControl"
/>
...
...
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