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
eebde190
Commit
eebde190
authored
Dec 19, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen): добавил возможность вывести имя таймера в виде string
переопределив virtual getTimerName( int id );
parent
cd2cef2f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
107 deletions
+97
-107
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+2
-1
UObject_SK.h
extensions/include/UObject_SK.h
+84
-101
UObject_SK.cc
extensions/lib/UObject_SK.cc
+0
-0
LT_Object.h
include/LT_Object.h
+3
-0
LT_Object.cc
src/Various/LT_Object.cc
+8
-5
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
eebde190
...
...
@@ -436,6 +436,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
sysCommand(_sm);
}
// -----------------------------------------------------------------------------
UniSetTypes::SimpleInfo*
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::getInfo( CORBA::Long userparam )
{
<xsl:if
test=
"not(normalize-space($BASECLASS)='')"
>
UniSetTypes::SimpleInfo_var i =
<xsl:value-of
select=
"$BASECLASS"
/>
::getInfo(userparam);
</xsl:if>
...
...
@@ -451,7 +452,7 @@ UniSetTypes::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA:
inf
<<
"Timers["
<<
timers.size()
<<
"]:"
<<
endl;
for( const auto
&
t: timers )
{
inf
<<
"
"
<<
"["
<<
t.id
<<
"]: msec="
inf
<<
"
"
<<
setw(15)
<<
getTimerName(t.id)
<<
"["
<<
t.id
<<
"]: msec="
<<
setw(6)
<<
t.tmr.getInterval()
<<
" timeleft="
<<
setw(6)
<<
t.curTimeMS
<<
" tick="
<<
setw(3)
<<
( t.curTick>=0 ? t.curTick : -1 )
...
...
extensions/include/UObject_SK.h
View file @
eebde190
...
...
@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2015-12-1
5
+03:00
// generate timestamp: 2015-12-1
9
+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
...
...
@@ -29,7 +29,7 @@ class UObject_SK:
public
UniSetObject
{
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
();
virtual
~
UObject_SK
();
...
...
@@ -43,91 +43,82 @@ class UObject_SK:
virtual
bool
setMsg
(
UniSetTypes
::
ObjectId
code
,
bool
state
=
true
);
inline
std
::
shared_ptr
<
DebugStream
>
log
()
{
return
mylog
;
}
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
()
{
return
loga
;
}
inline
std
::
shared_ptr
<
DebugStream
>
log
(){
return
mylog
;
}
inline
std
::
shared_ptr
<
LogAgregator
>
logAgregator
(){
return
loga
;
}
void
init_dlog
(
std
::
shared_ptr
<
DebugStream
>
d
);
// "синтаксический сахар"..для логов
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
/*! вывод в строку значение всех входов и выходов в формате
ObjectName:
in_xxx = val
in_xxx2 = val
out_zzz = val
...
*/
std
::
string
dumpIO
();
/*! Вывод в строку названия входа/выхода в формате: in_xxx(SensorName)
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
()
{
return
std
::
move
(
vmon
.
pretty_str
());
}
// ------------------------------------------------------------
std
::
string
help
();
// "синтаксический сахар"..для логов
#ifndef myinfo
#define myinfo if( log()->debugging(Debug::INFO) ) log()->info()
#endif
#ifndef mywarn
#define mywarn if( log()->debugging(Debug::WARN) ) log()->warn()
#endif
#ifndef mycrit
#define mycrit if( log()->debugging(Debug::CRIT) ) log()->crit()
#endif
#ifndef mylog1
#define mylog1 if( log()->debugging(Debug::LEVEL1) ) log()->level1()
#endif
#ifndef mylog2
#define mylog2 if( log()->debugging(Debug::LEVEL2) ) log()->level2()
#endif
#ifndef mylog3
#define mylog3 if( log()->debugging(Debug::LEVEL3) ) log()->level3()
#endif
#ifndef mylog4
#define mylog4 if( log()->debugging(Debug::LEVEL4) ) log()->level4()
#endif
#ifndef mylog5
#define mylog5 if( log()->debugging(Debug::LEVEL5) ) log()->level5()
#endif
#ifndef mylog6
#define mylog6 if( log()->debugging(Debug::LEVEL6) ) log()->level6()
#endif
#ifndef mylog7
#define mylog7 if( log()->debugging(Debug::LEVEL7) ) log()->level7()
#endif
#ifndef mylog8
#define mylog8 if( log()->debugging(Debug::LEVEL8) ) log()->level8()
#endif
#ifndef mylog9
#define mylog9 if( log()->debugging(Debug::LEVEL9) ) log()->level9()
#endif
#ifndef mylogany
#define mylogany log()->any()
#endif
#ifndef vmonit
#define vmonit( var ) vmon.add( #var, var )
#endif
// Вспомогательные функции для удобства логирования
// ------------------------------------------------------------
/*! вывод в строку значение всех входов и выходов в формате
ObjectName:
in_xxx = val
in_xxx2 = val
out_zzz = val
...
*/
std
::
string
dumpIO
();
/*! Вывод в строку названия входа/выхода в формате: in_xxx(SensorName)
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
str
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод значения входа/выхода в формате: in_xxx(SensorName)=val
\param id - идентификатор датчика
\param showLinkName - TRUE - выводить SensorName, FALSE - не выводить
*/
std
::
string
strval
(
UniSetTypes
::
ObjectId
id
,
bool
showLinkName
=
true
);
/*! Вывод состояния внутренних переменных */
inline
std
::
string
dumpVars
(){
return
std
::
move
(
vmon
.
pretty_str
());
}
// ------------------------------------------------------------
std
::
string
help
();
...
...
@@ -154,16 +145,13 @@ class UObject_SK:
virtual
void
callback
()
override
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
)
override
;
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
{};
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
){};
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
){}
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
override
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
override
{}
virtual
void
sigterm
(
int
signo
)
override
;
virtual
bool
activateObject
()
override
;
virtual
std
::
string
getMonitInfo
()
{
return
""
;
/*!< пользовательская информация выводимая в getInfo() */
}
virtual
std
::
string
getMonitInfo
(){
return
""
;
}
/*!< пользовательская информация выводимая в getInfo() */
virtual
void
testMode
(
bool
state
);
void
updatePreviousValues
();
...
...
@@ -183,7 +171,7 @@ class UObject_SK:
int
resetMsgTime
;
// Выполнение очередного шага программы
virtual
void
step
()
{}
virtual
void
step
(){}
int
sleep_msec
;
/*!< пауза между итерациями */
bool
active
;
...
...
@@ -198,15 +186,9 @@ class UObject_SK:
xmlNode
*
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 */
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 */
std
::
atomic_bool
activated
;
...
...
@@ -229,6 +211,7 @@ class UObject_SK:
VMonitor
vmon
;
private
:
// --- private variables ---
...
...
extensions/lib/UObject_SK.cc
View file @
eebde190
This diff is collapsed.
Click to expand it.
include/LT_Object.h
View file @
eebde190
...
...
@@ -195,6 +195,9 @@ class LT_Object
TimersList
getTimersList
();
/*! пользовательская функция для вывода названия таймера */
virtual
std
::
string
getTimerName
(
int
id
){
return
""
;
}
private
:
TimersList
tlst
;
/*! замок для блокирования совместного доступа к cписку таймеров */
...
...
src/Various/LT_Object.cc
View file @
eebde190
...
...
@@ -168,7 +168,8 @@ timeout_t LT_Object::askTimer( UniSetTypes::TimerId timerid, timeout_t timeMS, c
{
if
(
timeMS
<
UniSetTimer
::
MinQuantityTime
)
{
ucrit
<<
"(LT_askTimer): [мс] попытка заказть таймер со временем срабатыания "
ucrit
<<
"(LT_askTimer): [мс] попытка заказть таймер "
<<
getTimerName
(
timerid
)
<<
" со временем срабатыания "
<<
" меньше разрешённого "
<<
UniSetTimer
::
MinQuantityTime
<<
endl
;
timeMS
=
UniSetTimer
::
MinQuantityTime
;
}
...
...
@@ -186,8 +187,8 @@ timeout_t LT_Object::askTimer( UniSetTypes::TimerId timerid, timeout_t timeMS, c
{
li
->
curTick
=
ticks
;
li
->
tmr
.
setTiming
(
timeMS
);
uinfo
<<
"(LT_askTimer): заказ на таймер(
id=
"
<<
timerid
<<
") "
<<
timeMS
<<
" [мс] уже есть..."
<<
endl
;
uinfo
<<
"(LT_askTimer): заказ на таймер(
[
"
<<
timerid
<<
"
]"
<<
getTimerName
(
timerid
)
<<
"
) "
<<
timeMS
<<
" [мс] уже есть..."
<<
endl
;
return
sleepTime
;
}
}
...
...
@@ -197,11 +198,13 @@ timeout_t LT_Object::askTimer( UniSetTypes::TimerId timerid, timeout_t timeMS, c
tlst
.
emplace_back
(
timerid
,
timeMS
,
ticks
,
p
);
}
// unlock
uinfo
<<
"(LT_askTimer): поступил заказ на таймер(id="
<<
timerid
<<
") "
<<
timeMS
<<
" [мс]
\n
"
;
uinfo
<<
"(LT_askTimer): поступил заказ на таймер(["
<<
timerid
<<
"]"
<<
getTimerName
(
timerid
)
<<
") "
<<
timeMS
<<
" [мс]
\n
"
;
}
else
// отказ (при timeMS == 0)
{
uinfo
<<
"(LT_askTimer): поступил отказ по таймеру id="
<<
timerid
<<
endl
;
uinfo
<<
"(LT_askTimer): поступил отказ по таймеру ["
<<
timerid
<<
"]"
<<
getTimerName
(
timerid
)
<<
endl
;
{
// lock
uniset_rwmutex_wrlock
lock
(
lstMutex
);
...
...
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