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
da428026
Commit
da428026
authored
Dec 14, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Рефакторинг: ушёл от лишних классов xxx_LT
(перевёл функциональность в базовый UniSetObject)
parent
d0d9967c
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
132 additions
and
494 deletions
+132
-494
ctl-cpp-h-alone.xsl
Utilities/codegen/ctl-cpp-h-alone.xsl
+2
-4
ctl-cpp-h.xsl
Utilities/codegen/ctl-cpp-h.xsl
+2
-4
libuniset2.spec
conf/libuniset2.spec
+5
-1
configure.ac
configure.ac
+4
-4
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
PassiveLProcessor.cc
extensions/LogicProcessor/PassiveLProcessor.cc
+3
-3
PassiveLProcessor.h
extensions/LogicProcessor/PassiveLProcessor.h
+2
-2
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+4
-4
MBExchange.h
extensions/ModbusMaster/MBExchange.h
+2
-2
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+5
-5
MBSlave.h
extensions/ModbusSlave/MBSlave.h
+2
-2
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+6
-6
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+2
-2
UNetExchange.cc
extensions/UNetUDP/UNetExchange.cc
+4
-4
UNetExchange.h
extensions/UNetUDP/UNetExchange.h
+2
-2
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+1
-1
UNetSender.h
extensions/UNetUDP/UNetSender.h
+1
-1
UObject_SK.h
extensions/include/UObject_SK.h
+1
-3
UObject_SK.cc
extensions/lib/UObject_SK.cc
+3
-3
DBServer.h
include/DBServer.h
+2
-2
IONotifyController_LT.h
include/IONotifyController_LT.h
+0
-64
LT_Object.h
include/LT_Object.h
+19
-3
SMonitor.h
include/SMonitor.h
+2
-2
UniSetManager_LT.h
include/UniSetManager_LT.h
+0
-63
UniSetObject.h
include/UniSetObject.h
+6
-1
UniSetObject_LT.h
include/UniSetObject_LT.h
+0
-63
Makefile.am
src/ObjectRepository/Makefile.am
+1
-1
UniSetManager_LT.cc
src/ObjectRepository/UniSetManager_LT.cc
+0
-74
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+18
-6
UniSetObject_LT.cc
src/ObjectRepository/UniSetObject_LT.cc
+0
-74
IONotifyController_LT.cc
src/Processes/IONotifyController_LT.cc
+0
-75
Makefile.am
src/Processes/Makefile.am
+1
-1
DBServer.cc
src/Services/DBServer.cc
+4
-4
LT_Object.cc
src/Various/LT_Object.cc
+26
-0
SMonitor.cc
src/Various/SMonitor.cc
+1
-1
uniset2.files
uniset2.files
+0
-6
No files found.
Utilities/codegen/ctl-cpp-h-alone.xsl
View file @
da428026
...
...
@@ -43,7 +43,6 @@
#include
<
unordered_map
>
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
#include
<xsl:call-template
name=
"preinclude"
/><xsl:value-of
select=
"normalize-space($BASECLASS)"
/>
.h
<xsl:call-template
name=
"postinclude"
/></xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
#include
<xsl:call-template
name=
"preinclude"
/>
UniSetObject.h
<xsl:call-template
name=
"postinclude"
/></xsl:if>
#include
<xsl:call-template
name=
"preinclude"
/>
LT_Object.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
UniXML.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
Trigger.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
UInterface.h
<xsl:call-template
name=
"postinclude"
/>
...
...
@@ -53,9 +52,8 @@
#include
<xsl:call-template
name=
"preinclude"
/>
VMonitor.h
<xsl:call-template
name=
"postinclude"
/>
// -----------------------------------------------------------------------------
class
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK:
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
public
<xsl:value-of
select=
"normalize-space($BASECLASS)"
/>
,
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
public UniSetObject,
</xsl:if>
public LT_Object
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
public
<xsl:value-of
select=
"normalize-space($BASECLASS)"
/></xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
public UniSetObject
</xsl:if>
{
public:
<xsl:if
test=
"not(normalize-space($OID))=''"
>
...
...
Utilities/codegen/ctl-cpp-h.xsl
View file @
da428026
...
...
@@ -43,7 +43,6 @@
#include
<
sstream
>
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
#include
<xsl:call-template
name=
"preinclude"
/><xsl:value-of
select=
"normalize-space($BASECLASS)"
/>
.h
<xsl:call-template
name=
"postinclude"
/></xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
#include
<xsl:call-template
name=
"preinclude"
/>
UniSetObject.h
<xsl:call-template
name=
"postinclude"
/></xsl:if>
#include
<xsl:call-template
name=
"preinclude"
/>
LT_Object.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
UniXML.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
Trigger.h
<xsl:call-template
name=
"postinclude"
/>
#include
<xsl:call-template
name=
"preinclude"
/>
DebugStream.h
<xsl:call-template
name=
"postinclude"
/>
...
...
@@ -52,9 +51,8 @@
#include
<xsl:call-template
name=
"preinclude"
/>
VMonitor.h
<xsl:call-template
name=
"postinclude"
/>
// -----------------------------------------------------------------------------
class
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK:
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
public
<xsl:value-of
select=
"normalize-space($BASECLASS)"
/>
,
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
public UniSetObject,
</xsl:if>
public LT_Object
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
>
public
<xsl:value-of
select=
"normalize-space($BASECLASS)"
/></xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
public UniSetObject
</xsl:if>
{
public:
<xsl:if
test=
"not(normalize-space($OID))=''"
>
...
...
conf/libuniset2.spec
View file @
da428026
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.2
Release: alt1
1
Release: alt1
2
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -452,6 +452,10 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Mon Dec 14 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt12
- refactoring: remove xxx_LT classes
- add new function for LT_Object
* Tue Nov 03 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt11
- RRDServer: add support 'dsname', check RRD_MAX_DSNAME_LEN
...
...
configure.ac
View file @
da428026
...
...
@@ -3,9 +3,12 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset2], [2.2.
0
], pv@etersoft.ru)
AC_INIT([uniset2], [2.2.
1
], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
LIBVER=2:2:1
AC_SUBST(LIBVER)
# AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER(uniset-config.h)
...
...
@@ -30,9 +33,6 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
LIBVER=2:2:0
AC_SUBST(LIBVER)
ASTYLE_OPT="-A1 -T -C -S -N -L -w -Y -M -f -p --mode=c --lineend=linux --align-reference=type --align-pointer=type --suffix=none --style=ansi"
AC_SUBST(ASTYLE_OPT)
...
...
extensions/IOControl/IOControl.h
View file @
da428026
...
...
@@ -10,7 +10,7 @@
#include "PassiveTimer.h"
#include "Trigger.h"
#include "IONotifyController.h"
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "Mutex.h"
#include "MessageType.h"
#include "ComediInterface.h"
...
...
extensions/LogicProcessor/PassiveLProcessor.cc
View file @
da428026
...
...
@@ -8,13 +8,13 @@ using namespace UniSetExtensions;
// -------------------------------------------------------------------------
PassiveLProcessor
::
PassiveLProcessor
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
UniSetObject
_LT
(
objId
),
UniSetObject
(
objId
),
shm
(
nullptr
)
{
auto
conf
=
uniset_conf
();
logname
=
myname
;
shm
=
make_shared
<
SMInterface
>
(
shmID
,
UniSetObject
_LT
::
ui
,
objId
,
ic
);
shm
=
make_shared
<
SMInterface
>
(
shmID
,
UniSetObject
::
ui
,
objId
,
ic
);
string
conf_name
(
conf
->
getArgParam
(
"--"
+
prefix
+
"-confnode"
,
myname
));
...
...
@@ -199,7 +199,7 @@ bool PassiveLProcessor::activateObject()
// см. sysCommand()
{
UniSetTypes
::
uniset_mutex_lock
l
(
mutex_start
,
5000
);
UniSetObject
_LT
::
activateObject
();
UniSetObject
::
activateObject
();
initIterators
();
}
...
...
extensions/LogicProcessor/PassiveLProcessor.h
View file @
da428026
...
...
@@ -4,7 +4,7 @@
#include <map>
#include <memory>
#include "UniSetTypes.h"
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "Extensions.h"
#include "SharedMemory.h"
#include "UInterface.h"
...
...
@@ -13,7 +13,7 @@
// --------------------------------------------------------------------------
/*! Реализация LogicProccessor основанная на заказе датчиков */
class
PassiveLProcessor
:
public
UniSetObject
_LT
,
public
UniSetObject
,
protected
LProcessor
{
public
:
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
da428026
...
...
@@ -15,7 +15,7 @@ using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
MBExchange
::
MBExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
_ic
,
const
std
::
string
&
prefix
)
:
UniSetObject
_LT
(
objId
),
UniSetObject
(
objId
),
allInitOK
(
false
),
initPause
(
3000
),
force
(
false
),
...
...
@@ -327,7 +327,7 @@ void MBExchange::sigterm( int signo )
try
{
UniSetObject
_LT
::
sigterm
(
signo
);
UniSetObject
::
sigterm
(
signo
);
}
catch
(
std
::
exception
&
ex
)
{
...
...
@@ -2766,7 +2766,7 @@ bool MBExchange::activateObject()
{
setProcActive
(
false
);
UniSetTypes
::
uniset_rwmutex_rlock
l
(
mutex_start
);
UniSetObject
_LT
::
activateObject
();
UniSetObject
::
activateObject
();
if
(
!
shm
->
isLocalwork
()
)
rtuQueryOptimization
(
devices
);
...
...
@@ -3257,7 +3257,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::ExchangeMode& em )
// -----------------------------------------------------------------------------
UniSetTypes
::
SimpleInfo
*
MBExchange
::
getInfo
()
{
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
_LT
::
getInfo
();
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
::
getInfo
();
ostringstream
inf
;
...
...
extensions/ModbusMaster/MBExchange.h
View file @
da428026
...
...
@@ -7,7 +7,7 @@
#include <unordered_map>
#include <memory>
#include "IONotifyController.h"
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "PassiveTimer.h"
#include "DelayTimer.h"
#include "Trigger.h"
...
...
@@ -34,7 +34,7 @@
\par Базовый класс для реализация обмена по протоколу Modbus [RTU|TCP].
*/
class
MBExchange
:
public
UniSetObject
_LT
public
UniSetObject
{
public
:
MBExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
=
nullptr
,
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
da428026
...
...
@@ -13,7 +13,7 @@ using namespace UniSetExtensions;
using
namespace
ModbusRTU
;
// -----------------------------------------------------------------------------
MBSlave
::
MBSlave
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
string
&
prefix
)
:
UniSetObject
_LT
(
objId
),
UniSetObject
(
objId
),
initPause
(
3000
),
test_id
(
DefaultObjectId
),
askcount_id
(
DefaultObjectId
),
...
...
@@ -883,7 +883,7 @@ bool MBSlave::activateObject()
{
activated
=
false
;
UniSetTypes
::
uniset_rwmutex_wrlock
l
(
mutex_start
);
UniSetObject
_LT
::
activateObject
();
UniSetObject
::
activateObject
();
initIterators
();
activated
=
true
;
startNotifyEvent
.
notify_all
();
...
...
@@ -909,7 +909,7 @@ bool MBSlave::deactivateObject()
mbwarn
<<
myname
<<
"(deactivateObject): "
<<
ex
.
what
()
<<
endl
;
}
return
UniSetObject
_LT
::
deactivateObject
();
return
UniSetObject
::
deactivateObject
();
}
// ------------------------------------------------------------------------------------------
void
MBSlave
::
sigterm
(
int
signo
)
...
...
@@ -928,7 +928,7 @@ void MBSlave::sigterm( int signo )
mbwarn
<<
myname
<<
"SIGTERM("
<<
signo
<<
"): "
<<
ex
.
what
()
<<
endl
;
}
UniSetObject
_LT
::
sigterm
(
signo
);
UniSetObject
::
sigterm
(
signo
);
}
// ------------------------------------------------------------------------------------------
void
MBSlave
::
readConfiguration
()
...
...
@@ -2377,7 +2377,7 @@ ModbusRTU::mbErrCode MBSlave::read4314( ModbusRTU::MEIMessageRDI& query,
// -------------------------------------------------------------------------
UniSetTypes
::
SimpleInfo
*
MBSlave
::
getInfo
()
{
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
_LT
::
getInfo
();
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
::
getInfo
();
ostringstream
inf
;
...
...
extensions/ModbusSlave/MBSlave.h
View file @
da428026
...
...
@@ -11,7 +11,7 @@
#include <condition_variable>
#include <atomic>
#include <mutex>
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "modbus/ModbusTypes.h"
#include "modbus/ModbusServerSlot.h"
#include "PassiveTimer.h"
...
...
@@ -289,7 +289,7 @@ namespace std
// -----------------------------------------------------------------------------
/*! Реализация slave-интерфейса */
class
MBSlave
:
public
UniSetObject
_LT
public
UniSetObject
{
public
:
MBSlave
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
=
nullptr
,
const
std
::
string
&
prefix
=
"mbs"
);
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
da428026
...
...
@@ -45,7 +45,7 @@ void SharedMemory::help_print( int argc, const char* const* argv )
}
// -----------------------------------------------------------------------------
SharedMemory
::
SharedMemory
(
ObjectId
id
,
const
std
::
string
&
datafile
,
const
std
::
string
&
confname
)
:
IONotifyController
_LT
(
id
),
IONotifyController
(
id
),
heartbeatCheckTime
(
5000
),
histSaveTime
(
0
),
activated
(
false
),
...
...
@@ -263,7 +263,7 @@ bool SharedMemory::deactivateObject()
if
(
logserv
)
logserv
=
nullptr
;
return
IONotifyController
_LT
::
deactivateObject
();
return
IONotifyController
::
deactivateObject
();
}
// ------------------------------------------------------------------------------------------
bool
SharedMemory
::
activateObject
()
...
...
@@ -278,7 +278,7 @@ bool SharedMemory::activateObject()
activated
=
false
;
UniSetTypes
::
uniset_rwmutex_wrlock
l
(
mutex_start
);
res
=
IONotifyController
_LT
::
activateObject
();
res
=
IONotifyController
::
activateObject
();
// инициализируем указатели
for
(
auto
&&
it
:
hlist
)
...
...
@@ -316,7 +316,7 @@ void SharedMemory::sigterm( int signo )
wdt
->
stop
();
// raise(SIGKILL);
IONotifyController
_LT
::
sigterm
(
signo
);
IONotifyController
::
sigterm
(
signo
);
}
// ------------------------------------------------------------------------------------------
void
SharedMemory
::
checkHeartBeat
()
...
...
@@ -570,7 +570,7 @@ void SharedMemory::addReadItem( Restorer_XML::ReaderSlot sl )
void
SharedMemory
::
loggingInfo
(
SensorMessage
&
sm
)
{
if
(
dblogging
)
IONotifyController
_LT
::
loggingInfo
(
sm
);
IONotifyController
::
loggingInfo
(
sm
);
}
// -----------------------------------------------------------------------------
void
SharedMemory
::
buildHistoryList
(
xmlNode
*
cnode
)
...
...
@@ -957,7 +957,7 @@ bool SharedMemory::initFromSM( UniSetTypes::ObjectId sm_id, UniSetTypes::ObjectI
// ----------------------------------------------------------------------------
UniSetTypes
::
SimpleInfo
*
SharedMemory
::
getInfo
()
{
UniSetTypes
::
SimpleInfo_var
i
=
IONotifyController
_LT
::
getInfo
();
UniSetTypes
::
SimpleInfo_var
i
=
IONotifyController
::
getInfo
();
ostringstream
inf
;
...
...
extensions/SharedMemory/SharedMemory.h
View file @
da428026
...
...
@@ -6,7 +6,7 @@
#include <string>
#include <memory>
#include <deque>
#include "IONotifyController
_LT
.h"
#include "IONotifyController.h"
#include "Mutex.h"
#include "PassiveTimer.h"
#include "NCRestorer.h"
...
...
@@ -282,7 +282,7 @@
\endcode
*/
class
SharedMemory
:
public
IONotifyController
_LT
public
IONotifyController
{
public
:
SharedMemory
(
UniSetTypes
::
ObjectId
id
,
const
std
::
string
&
datafile
,
const
std
::
string
&
confname
=
""
);
...
...
extensions/UNetUDP/UNetExchange.cc
View file @
da428026
...
...
@@ -10,7 +10,7 @@ using namespace UniSetTypes;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
UNetExchange
::
UNetExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmId
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
,
const
std
::
string
&
prefix
)
:
UniSetObject
_LT
(
objId
),
UniSetObject
(
objId
),
initPause
(
0
),
activated
(
false
),
no_sender
(
false
)
...
...
@@ -689,7 +689,7 @@ bool UNetExchange::activateObject()
{
activated
=
false
;
UniSetTypes
::
uniset_rwmutex_wrlock
l
(
mutex_start
);
UniSetObject
_LT
::
activateObject
();
UniSetObject
::
activateObject
();
initIterators
();
activated
=
true
;
}
...
...
@@ -733,7 +733,7 @@ void UNetExchange::sigterm( int signo )
}
catch
(...)
{}
UniSetObject
_LT
::
sigterm
(
signo
);
UniSetObject
::
sigterm
(
signo
);
}
// ------------------------------------------------------------------------------------------
void
UNetExchange
::
initIterators
()
...
...
@@ -895,7 +895,7 @@ void UNetExchange::receiverEvent( const shared_ptr<UNetReceiver>& r, UNetReceive
// -----------------------------------------------------------------------------
UniSetTypes
::
SimpleInfo
*
UNetExchange
::
getInfo
()
{
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
_LT
::
getInfo
();
UniSetTypes
::
SimpleInfo_var
i
=
UniSetObject
::
getInfo
();
ostringstream
inf
;
...
...
extensions/UNetUDP/UNetExchange.h
View file @
da428026
...
...
@@ -6,7 +6,7 @@
#include <queue>
#include <deque>
#include <cc++/socket.h>
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "Trigger.h"
#include "Mutex.h"
#include "SMInterface.h"
...
...
@@ -99,7 +99,7 @@
*/
// -----------------------------------------------------------------------------
class
UNetExchange
:
public
UniSetObject
_LT
public
UniSetObject
{
public
:
UNetExchange
(
UniSetTypes
::
ObjectId
objId
,
UniSetTypes
::
ObjectId
shmID
,
const
std
::
shared_ptr
<
SharedMemory
>&
ic
=
nullptr
,
const
std
::
string
&
prefix
=
"unet"
);
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
da428026
...
...
@@ -8,7 +8,7 @@
#include <unordered_map>
#include <cc++/socket.h>
#include <sigc++/sigc++.h>
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "Trigger.h"
#include "Mutex.h"
#include "SMInterface.h"
...
...
extensions/UNetUDP/UNetSender.h
View file @
da428026
...
...
@@ -6,7 +6,7 @@
#include <vector>
#include <unordered_map>
#include <cc++/socket.h>
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "Trigger.h"
#include "Mutex.h"
#include "SMInterface.h"
...
...
extensions/include/UObject_SK.h
View file @
da428026
...
...
@@ -18,7 +18,6 @@
#include <unordered_map>
#include <sstream>
#include "UniSetObject.h"
#include "LT_Object.h"
#include "UniXML.h"
#include "Trigger.h"
#include "DebugStream.h"
...
...
@@ -27,8 +26,7 @@
#include "VMonitor.h"
// -----------------------------------------------------------------------------
class
UObject_SK
:
public
UniSetObject
,
public
LT_Object
public
UniSetObject
{
public
:
UObject_SK
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
node
=
UniSetTypes
::
uniset_conf
()
->
getNode
(
"UObject"
),
const
std
::
string
&
argprefix
=
""
);
...
...
extensions/lib/UObject_SK.cc
View file @
da428026
...
...
@@ -365,10 +365,10 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
waitSM
(
smReadyTimeout
);
ptStartUpTimeout
.
reset
();
// т.к. для io-переменных важно соблюдать последовательность!
// сперва обновить входы..
а потом уже выходы
// сперва обновить входы..
updateValues
();
initFromSM
();
// потом обновить
, то, что помеченно как инициализируемо
е из SM
updateOutputs
(
true
);
//
принудительное обновление выходов
initFromSM
();
// потом обновить
значения переменных, помеченных как инициализируемы
е из SM
updateOutputs
(
true
);
//
а потом уже выходы (принудительное обновление)
preAskSensors
(
UniversalIO
::
UIONotify
);
askSensors
(
UniversalIO
::
UIONotify
);
active
=
true
;
...
...
include/DBServer.h
View file @
da428026
...
...
@@ -25,7 +25,7 @@
#define DBServer_H_
// --------------------------------------------------------------------------
#include "UniSetTypes.h"
#include "UniSetObject
_LT
.h"
#include "UniSetObject.h"
#include "LogServer.h"
#include "DebugStream.h"
#include "LogAgregator.h"
...
...
@@ -50,7 +50,7 @@
/*! Прототип реализации сервиса ведения БД */
class
DBServer
:
public
UniSetObject
_LT
public
UniSetObject
{
public
:
DBServer
(
UniSetTypes
::
ObjectId
id
,
const
std
::
string
&
prefix
=
"db"
);
...
...
include/IONotifyController_LT.h
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
//---------------------------------------------------------------------------
#ifndef IONotifyController_LT_H_
#define IONotifyController_LT_H_
//--------------------------------------------------------------------------
#include "UniSetTypes.h"
#include "IONotifyController.h"
#include "LT_Object.h"
//---------------------------------------------------------------------------
/*!
Реализация базового класса с использованием локальных таймеров
*/
class
IONotifyController_LT
:
public
IONotifyController
{
public
:
IONotifyController_LT
(
UniSetTypes
::
ObjectId
id
);
IONotifyController_LT
();
virtual
~
IONotifyController_LT
();
protected
:
/*! заказ локального таймера
\param timerid - идентификатор таймера
\param timeMS - период. 0 - означает отказ от таймера
\param ticks - количество уведомлений. "-1"- постоянно
\return Возвращает время [мсек] оставшееся до срабатывания
очередного таймера
*/
void
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
/*! функция вызываемая из потока */
virtual
void
callback
();
timeout_t
sleepTime
;
LT_Object
lt
;
private
:
};
//--------------------------------------------------------------------------
#endif
include/LT_Object.h
View file @
da428026
...
...
@@ -44,7 +44,7 @@ class UniSetObject;
\par Основной принцип
Проверяет список таймеров и при срабатывании формирует стандартное уведомление UniSetTypes::TimerMessage,
которое помещается в очередь указанному объекту. Каждый раз пересортировывает список и возвращает
время оставшееся
которое помещается в очередь указанному объекту. При проверке таймеров, определяется минимальное
время оставшееся
до очередного срабатывания. Если в списке не остаётся ни одного таймера - возвращает UniSetTimers::WaitUpTime.
Примерный код использования выглядит так:
...
...
@@ -91,6 +91,8 @@ class UniSetObject;
\warning Точность работы определяется переодичностью вызова обработчика.
\sa TimerService
\todo Подумать.. может перейти на unordered_map
*/
class
LT_Object
{
...
...
@@ -106,7 +108,7 @@ class LT_Object
\param p - приоритет присылаемого сообщения
\return Возвращает время [мсек] оставшееся до срабатывания очередного таймера
*/
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
virtual
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
...
...
@@ -120,6 +122,19 @@ class LT_Object
/*! получить текущее время ожидания */
//inline timeout_t getSleepTimeMS(){ return sleepTime; }
/*! получить время на которое установлен таймер timerid
* \param timerid - идентификатор таймера
* \return 0 - если таймер не найден, время (мсек) если таймер есть.
*/
timeout_t
getTimeInterval
(
UniSetTypes
::
TimerId
timerid
);
/*! получить оставшееся время для таймера timerid
* \param timerid - идентификатор таймера
* \return 0 - если таймер не найден, время (мсек) если таймер есть.
*/
timeout_t
getTimeLeft
(
UniSetTypes
::
TimerId
timerid
);
protected
:
/*! Информация о таймере */
...
...
@@ -176,11 +191,12 @@ class LT_Object
typedef
std
::
deque
<
TimerInfo
>
TimersList
;
timeout_t
sleepTime
;
/*!< текущее время ожидания */
private
:
TimersList
tlst
;
/*! замок для блокирования совместного доступа к cписку таймеров */
UniSetTypes
::
uniset_rwmutex
lstMutex
;
timeout_t
sleepTime
;
/*!< текущее время ожидания */
PassiveTimer
tmLast
;
};
//--------------------------------------------------------------------------
...
...
include/SMonitor.h
View file @
da428026
...
...
@@ -2,11 +2,11 @@
#define SMonitor_H_
// -----------------------------------------------------------------------------
#include <list>
#include <UniSetObject
_LT
.h>
#include <UniSetObject.h>
#include "UniSetTypes.h"
// -----------------------------------------------------------------------------
class
SMonitor
:
public
UniSetObject
_LT
public
UniSetObject
{
public
:
...
...
include/UniSetManager_LT.h
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
//---------------------------------------------------------------------------
#ifndef UniSetManager_LT_H_
#define UniSetManager_LT_H_
//--------------------------------------------------------------------------
#include "UniSetTypes.h"
#include "UniSetManager.h"
#include "LT_Object.h"
//---------------------------------------------------------------------------
/*!
Реализация базового класса с использованием локальных таймеров
*/
class
UniSetManager_LT
:
public
UniSetManager
{
public
:
UniSetManager_LT
(
UniSetTypes
::
ObjectId
id
);
UniSetManager_LT
();
virtual
~
UniSetManager_LT
();
protected
:
/*! заказ локального таймера
\param timerid - идентификатор таймера
\param timeMS - период. 0 - означает отказ от таймера
\param ticks - количество уведомлений. "-1"- постоянно
\return Возвращает время [мсек] оставшееся до срабатывания
очередного таймера
*/
void
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
/*! функция вызываемая из потока */
virtual
void
callback
();
timeout_t
sleepTime
;
LT_Object
lt
;
private
:
};
//--------------------------------------------------------------------------
#endif
include/UniSetObject.h
View file @
da428026
...
...
@@ -45,6 +45,7 @@
#include "UInterface.h"
#include "UniSetObject_i.hh"
#include "ThreadCreator.h"
#include "LT_Object.h"
//---------------------------------------------------------------------------
//#include <omnithread.h>
...
...
@@ -68,7 +69,8 @@ typedef std::list< std::shared_ptr<UniSetObject> > ObjectsList; /*!< Спи
*/
class
UniSetObject
:
public
std
::
enable_shared_from_this
<
UniSetObject
>
,
public
POA_UniSetObject_i
public
POA_UniSetObject_i
,
public
LT_Object
{
public
:
UniSetObject
(
const
std
::
string
&
name
,
const
std
::
string
&
section
);
...
...
@@ -121,6 +123,9 @@ class UniSetObject:
virtual
void
sensorInfo
(
const
UniSetTypes
::
SensorMessage
*
sm
)
{}
virtual
void
timerInfo
(
const
UniSetTypes
::
TimerMessage
*
tm
)
{}
virtual
timeout_t
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
)
override
;
/*! Получить сообщение */
bool
receiveMessage
(
UniSetTypes
::
VoidMessage
&
vm
);
...
...
include/UniSetObject_LT.h
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
//---------------------------------------------------------------------------
#ifndef UniSetObject_LT_H_
#define UniSetObject_LT_H_
//--------------------------------------------------------------------------
#include "UniSetTypes.h"
#include "UniSetObject.h"
#include "LT_Object.h"
//---------------------------------------------------------------------------
/*!
Реализация базового класса с использованием локальных таймеров
*/
class
UniSetObject_LT
:
public
UniSetObject
{
public
:
UniSetObject_LT
(
UniSetTypes
::
ObjectId
id
);
UniSetObject_LT
();
virtual
~
UniSetObject_LT
();
protected
:
/*! заказ локального таймера
\param timerid - идентификатор таймера
\param timeMS - период. 0 - означает отказ от таймера
\param ticks - количество уведомлений. "-1"- постоянно
\return Возвращает время [мсек] оставшееся до срабатывания
очередного таймера
*/
void
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
=
-
1
,
UniSetTypes
::
Message
::
Priority
p
=
UniSetTypes
::
Message
::
High
);
/*! функция вызываемая из потока */
virtual
void
callback
();
timeout_t
sleepTime
;
LT_Object
lt
;
private
:
};
//--------------------------------------------------------------------------
#endif
src/ObjectRepository/Makefile.am
View file @
da428026
...
...
@@ -3,7 +3,7 @@ libObjectsRepository_la_SOURCES = UniSetTypes_iSK.cc UniSetObject_iSK.cc UniSetT
UniSetManager_iSK.cc ObjectIndex.cc ObjectIndex_Array.cc ObjectIndex_XML.cc ObjectIndex_idXML.cc
\
ORepHelpers.cc UniSetObject.cc UniSetManager.cc
\
UniSetActivator.cc ObjectRepository.cc ObjectRepositoryFactory.cc
\
ProxyManager.cc PassiveObject.cc
UniSetObject_LT.cc UniSetManager_LT.cc
IORFile.cc
ProxyManager.cc PassiveObject.cc IORFile.cc
# ServiceActivator.cc
include
$(top_builddir)/include.mk
src/ObjectRepository/UniSetManager_LT.cc
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
// --------------------------------------------------------------------------
#include "Exceptions.h"
#include "UniSetManager_LT.h"
#include "Debug.h"
#include "PassiveTimer.h"
// ------------------------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// ------------------------------------------------------------------------------------------
UniSetManager_LT
::
UniSetManager_LT
(
UniSetTypes
::
ObjectId
id
)
:
UniSetManager
(
id
),
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
UniSetManager_LT
::
UniSetManager_LT
()
:
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
UniSetManager_LT
::~
UniSetManager_LT
()
{
}
// ------------------------------------------------------------------------------------------
void
UniSetManager_LT
::
callback
()
{
// При реализации с использованием waitMessage() каждый раз при вызове askTimer() необходимо
// проверять возвращаемое значение на UniSetTimers::WaitUpTime и вызывать termWaiting(),
// чтобы избежать ситуации, когда процесс до заказа таймера 'спал'(в функции waitMessage()) и после
// заказа продолжит спать(т.е. обработчик вызван не будет)...
try
{
if
(
waitMessage
(
msg
,
sleepTime
)
)
processingMessage
(
&
msg
);
sleepTime
=
lt
.
checkTimers
(
this
);
}
catch
(
const
Exception
&
ex
)
{
ucrit
<<
myname
<<
"(callback): "
<<
ex
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
void
UniSetManager_LT
::
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
,
UniSetTypes
::
Message
::
Priority
p
)
{
// проверяйте возвращаемое значение
if
(
lt
.
askTimer
(
timerid
,
timeMS
,
ticks
,
p
)
!=
UniSetTimer
::
WaitUpTime
)
termWaiting
();
}
// ------------------------------------------------------------------------------------------
src/ObjectRepository/UniSetObject.cc
View file @
da428026
...
...
@@ -840,18 +840,20 @@ void UniSetObject::work()
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
callback
()
{
// При реализации с использованием waitMessage() каждый раз при вызове askTimer() необходимо
// проверять возвращаемое значение на UniSetTimers::WaitUpTime и вызывать termWaiting(),
// чтобы избежать ситуации, когда процесс до заказа таймера 'спал'(в функции waitMessage()) и после
// заказа продолжит спать(т.е. обработчик вызван не будет)...
try
{
if
(
waitMessage
(
msg
)
)
if
(
waitMessage
(
msg
,
sleepTime
)
)
processingMessage
(
&
msg
);
sleepTime
=
checkTimers
(
this
);
}
catch
(
const
Exception
&
ex
)
{
ucrit
<<
ex
<<
endl
;
}
catch
(
const
std
::
exception
&
ex
)
{
ucrit
<<
ex
.
what
()
<<
endl
;
ucrit
<<
myname
<<
"(callback): "
<<
ex
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
...
...
@@ -913,6 +915,16 @@ void UniSetObject::processingMessage( UniSetTypes::VoidMessage* msg )
*/
}
// ------------------------------------------------------------------------------------------
timeout_t
UniSetObject
::
askTimer
(
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
,
Message
::
Priority
p
)
{
timeout_t
tsleep
=
LT_Object
::
askTimer
(
timerid
,
timeMS
,
ticks
,
p
);
if
(
tsleep
!=
UniSetTimer
::
WaitUpTime
)
termWaiting
();
return
tsleep
;
}
// ------------------------------------------------------------------------------------------
UniSetTypes
::
SimpleInfo
*
UniSetObject
::
getInfo
()
{
...
...
src/ObjectRepository/UniSetObject_LT.cc
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
// --------------------------------------------------------------------------
#include "Exceptions.h"
#include "Debug.h"
#include "PassiveTimer.h"
#include "UniSetObject_LT.h"
// ------------------------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// ------------------------------------------------------------------------------------------
UniSetObject_LT
::
UniSetObject_LT
(
UniSetTypes
::
ObjectId
id
)
:
UniSetObject
(
id
),
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
UniSetObject_LT
::
UniSetObject_LT
()
:
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
UniSetObject_LT
::~
UniSetObject_LT
()
{
}
// ------------------------------------------------------------------------------------------
void
UniSetObject_LT
::
callback
()
{
// При реализации с использованием waitMessage() каждый раз при вызове askTimer() необходимо
// проверять возвращаемое значение на UniSetTimers::WaitUpTime и вызывать termWaiting(),
// чтобы избежать ситуации, когда процесс до заказа таймера 'спал'(в функции waitMessage()) и после
// заказа продолжит спать(т.е. обработчик вызван не будет)...
try
{
if
(
waitMessage
(
msg
,
sleepTime
)
)
processingMessage
(
&
msg
);
sleepTime
=
lt
.
checkTimers
(
this
);
}
catch
(
const
Exception
&
ex
)
{
ucrit
<<
myname
<<
"(callback): "
<<
ex
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
void
UniSetObject_LT
::
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
,
UniSetTypes
::
Message
::
Priority
p
)
{
// проверяйте возвращаемое значение
if
(
lt
.
askTimer
(
timerid
,
timeMS
,
ticks
,
p
)
!=
UniSetTimer
::
WaitUpTime
)
termWaiting
();
}
// ------------------------------------------------------------------------------------------
src/Processes/IONotifyController_LT.cc
deleted
100644 → 0
View file @
d0d9967c
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
// --------------------------------------------------------------------------
#include "Exceptions.h"
#include "Debug.h"
#include "PassiveTimer.h"
#include "IONotifyController_LT.h"
// ------------------------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// ------------------------------------------------------------------------------------------
IONotifyController_LT
::
IONotifyController_LT
(
UniSetTypes
::
ObjectId
id
)
:
IONotifyController
(
id
),
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
IONotifyController_LT
::
IONotifyController_LT
()
:
sleepTime
(
UniSetTimer
::
WaitUpTime
)
{
}
// ------------------------------------------------------------------------------------------
IONotifyController_LT
::~
IONotifyController_LT
()
{
}
// ------------------------------------------------------------------------------------------
void
IONotifyController_LT
::
callback
()
{
// При реализации с использованием waitMessage() каждый раз при вызове askTimer() необходимо
// проверять возвращаемое значение на UniSetTimers::WaitUpTime и вызывать termWaiting(),
// чтобы избежать ситуации, когда процесс до заказа таймера 'спал'(в функции waitMessage()) и после
// заказа продолжит спать(т.е. обработчик вызван не будет)...
try
{
if
(
waitMessage
(
msg
,
sleepTime
)
)
processingMessage
(
&
msg
);
sleepTime
=
lt
.
checkTimers
(
this
);
}
catch
(
const
Exception
&
ex
)
{
ucrit
<<
myname
<<
"(callback): "
<<
ex
<<
endl
;
}
}
// ------------------------------------------------------------------------------------------
void
IONotifyController_LT
::
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
short
ticks
,
UniSetTypes
::
Message
::
Priority
p
)
{
// проверяйте возвращаемое значение
if
(
lt
.
askTimer
(
timerid
,
timeMS
,
ticks
,
p
)
!=
UniSetTimer
::
WaitUpTime
)
termWaiting
();
}
// ------------------------------------------------------------------------------------------
src/Processes/Makefile.am
View file @
da428026
...
...
@@ -5,7 +5,7 @@
noinst_LTLIBRARIES
=
libProcesses.la
libProcesses_la_CXXFLAGS
=
$(SIGC_CFLAGS)
libProcesses_la_LIBADD
=
$(SIGC_LIBS)
libProcesses_la_SOURCES
=
IOController_iSK.cc IOController.cc IONotifyController.cc
IONotifyController_LT.cc
\
libProcesses_la_SOURCES
=
IOController_iSK.cc IOController.cc IONotifyController.cc
\
NCRestorer.cc NCRestorer_XML.cc
local-clean
:
...
...
src/Services/DBServer.cc
View file @
da428026
...
...
@@ -38,7 +38,7 @@ using namespace UniSetTypes;
using
namespace
std
;
// ------------------------------------------------------------------------------------------
DBServer
::
DBServer
(
ObjectId
id
,
const
std
::
string
&
prefix
)
:
UniSetObject
_LT
(
id
)
UniSetObject
(
id
)
{
if
(
getId
()
==
DefaultObjectId
)
{
...
...
@@ -96,7 +96,7 @@ void DBServer::processingMessage( UniSetTypes::VoidMessage* msg )
break
;
default
:
UniSetObject
_LT
::
processingMessage
(
msg
);
UniSetObject
::
processingMessage
(
msg
);
break
;
}
...
...
@@ -104,14 +104,14 @@ void DBServer::processingMessage( UniSetTypes::VoidMessage* msg )
//--------------------------------------------------------------------------------------------
bool
DBServer
::
activateObject
()
{
UniSetObject
_LT
::
activateObject
();
UniSetObject
::
activateObject
();
initDBServer
();
return
true
;
}
//--------------------------------------------------------------------------------------------
void
DBServer
::
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
{
UniSetObject
_LT
::
sysCommand
(
sm
);
UniSetObject
::
sysCommand
(
sm
);
if
(
sm
->
command
==
SystemMessage
::
StartUp
)
{
...
...
src/Various/LT_Object.cc
View file @
da428026
...
...
@@ -126,6 +126,32 @@ timeout_t LT_Object::checkTimers( UniSetObject* obj )
return
sleepTime
;
}
// ------------------------------------------------------------------------------------------
timeout_t
LT_Object
::
getTimeInterval
(
TimerId
timerid
)
{
// lock
uniset_rwmutex_rlock
lock
(
lstMutex
);
for
(
const
auto
&
li
:
tlst
)
{
if
(
li
.
id
==
timerid
)
return
li
.
tmr
.
getInterval
();
}
return
0
;
}
// ------------------------------------------------------------------------------------------
timeout_t
LT_Object
::
getTimeLeft
(
TimerId
timerid
)
{
// lock
uniset_rwmutex_rlock
lock
(
lstMutex
);
for
(
const
auto
&
li
:
tlst
)
{
if
(
li
.
id
==
timerid
)
return
li
.
curTimeMS
;
}
return
0
;
}
// ------------------------------------------------------------------------------------------
timeout_t
LT_Object
::
askTimer
(
UniSetTypes
::
TimerId
timerid
,
timeout_t
timeMS
,
clock_t
ticks
,
UniSetTypes
::
Message
::
Priority
p
)
{
...
...
src/Various/SMonitor.cc
View file @
da428026
...
...
@@ -17,7 +17,7 @@ SMonitor::SMonitor():
}
SMonitor
::
SMonitor
(
ObjectId
id
)
:
UniSetObject
_LT
(
id
),
UniSetObject
(
id
),
script
(
""
)
{
string
sid
(
uniset_conf
()
->
getArgParam
(
"--sid"
));
...
...
uniset2.files
View file @
da428026
...
...
@@ -261,7 +261,6 @@ include/Exceptions.h
include/HourGlass.h
include/IOController.h
include/IONotifyController.h
include/IONotifyController_LT.h
include/IORFile.h
include/LogAgregator.h
include/LogReader.h
...
...
@@ -299,9 +298,7 @@ include/TriggerOUT.h
include/UInterface.h
include/UniSetActivator.h
include/UniSetManager.h
include/UniSetManager_LT.h
include/UniSetObject.h
include/UniSetObject_LT.h
include/UniSetTypes.h
include/UniXML.h
include/UTCPStream.h
...
...
@@ -370,13 +367,10 @@ src/ObjectRepository/PassiveObject.cc
src/ObjectRepository/ProxyManager.cc
src/ObjectRepository/UniSetActivator.cc
src/ObjectRepository/UniSetManager.cc
src/ObjectRepository/UniSetManager_LT.cc
src/ObjectRepository/UniSetObject.cc
src/ObjectRepository/UniSetObject_LT.cc
src/ObjectRepository/UniSetTypes.cc
src/Processes/IOController.cc
src/Processes/IONotifyController.cc
src/Processes/IONotifyController_LT.cc
src/Processes/Makefile.am
src/Processes/NCRestorer.cc
src/Processes/NCRestorer_XML.cc
...
...
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