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
e893e817
Commit
e893e817
authored
Sep 01, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Мелкие правки коментариев и небольшой рефакторинг кода.
parent
d86410c4
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
41 deletions
+23
-41
CommonEventLoop.h
include/CommonEventLoop.h
+7
-2
HourGlass.h
include/HourGlass.h
+4
-4
MQMutex.h
include/MQMutex.h
+1
-1
SViewer.h
include/SViewer.h
+2
-6
ORepHelpers.cc
src/ObjectRepository/ORepHelpers.cc
+1
-2
UniSetObject.cc
src/ObjectRepository/UniSetObject.cc
+3
-3
SViewer.cc
src/Various/SViewer.cc
+5
-23
No files found.
include/CommonEventLoop.h
View file @
e893e817
...
...
@@ -31,10 +31,15 @@ class EvWatcher
// -------------------------------------------------------------------------
/*!
* \brief The CommonEventLoop class
* Реализация общего eventloop для всех использующих libev.
* Реализация механизма "один eventloop, много подписчиков" (libev).
* Создаётся один CommonEventLoop который обслуживает множество EvWatcher-ов.
* Каждый класс который хочет подключиться к основному loop, должен наследоваться от класса Watcher
* и при необходимости переопределить функции evprepare и evfinish
* и при необходимости переопределить функции evprepare и evfinish.
* EvWatcher добавляется(запускается) evrun(..) и останавливается функцией evstop(..).
* При этом фактически eventloop запускается при первом вызове evrun(), а останавливается при
* отключении последнего EvWatcher.
*
* Некоторые детали:
* Т.к. evprepare необходимо вызывать из потока в котором крутится event loop (иначе libev не работает),
* а функция run() в общем случае вызывается "откуда угодно" и может быть вызвана в том числе уже после
* запуска event loop, то задействован механизм асинхронного уведомления (см. evprep, onPrepapre) и ожидания
...
...
include/HourGlass.h
View file @
e893e817
...
...
@@ -15,7 +15,7 @@
*/
// --------------------------------------------------------------------------
// idea: lav@etersoft.ru
//
realis
ation: pv@etersoft.ru, lav@etersoft.ru
//
implement
ation: pv@etersoft.ru, lav@etersoft.ru
// --------------------------------------------------------------------------
#ifndef HourGlass_H_
#define HourGlass_H_
...
...
@@ -77,7 +77,7 @@ class HourGlass
}
// "ёмкость" песочных часов..
inline
int
duration
()
inline
timeout_t
duration
()
const
{
return
_size
;
}
...
...
@@ -151,13 +151,13 @@ class HourGlass
}
// текущее "насыпавшееся" количество "песка" (прошедшее время)
inline
timeout_t
amount
()
inline
timeout_t
amount
()
const
{
return
(
_size
-
remain
()
);
}
// остаток песка (времени) (оставшееся время)
inline
timeout_t
remain
()
inline
timeout_t
remain
()
const
{
timeout_t
c
=
t
.
getCurrent
();
...
...
include/MQMutex.h
View file @
e893e817
...
...
@@ -45,7 +45,7 @@ class MQMutex
void
push
(
const
VoidMessagePtr
&
msg
);
/*! Извлечь сообщение из очереди
* \return не валидный shatred_ptr если сообщений нет
* \return не валидный shatred_ptr
(nullptr)
если сообщений нет
*/
VoidMessagePtr
top
();
...
...
include/SViewer.h
View file @
e893e817
...
...
@@ -33,16 +33,13 @@ class SViewer
{
public
:
explicit
SViewer
(
const
std
::
string
&
ControllersSection
,
bool
isShort
=
true
);
explicit
SViewer
(
const
std
::
string
&
ControllersSection
,
bool
isShort
Name
=
true
);
virtual
~
SViewer
();
void
view
();
void
monitor
(
timeout_t
timeoutMS
=
500
);
protected
:
friend
class
SViewer_glade
;
void
on_SViewer_destroy
();
void
readSection
(
const
std
::
string
&
sec
,
const
std
::
string
&
secRoot
);
void
getInfo
(
UniSetTypes
::
ObjectId
id
);
...
...
@@ -57,8 +54,7 @@ class SViewer
private
:
ObjectRepository
rep
;
UInterface
::
CacheOfResolve
cache
;
bool
isShort
;
bool
isShortName
=
{
true
};
};
// --------------------------------------------------------------------------
...
...
src/ObjectRepository/ORepHelpers.cc
View file @
e893e817
...
...
@@ -256,8 +256,7 @@ namespace ORepHelpers
}
string
err
(
"Имя не должно содержать символы: "
+
bad
);
return
std
::
move
(
err
);
return
std
::
move
(
bad
);
}
// ---------------------------------------------------------------------------------------------------------------
}
src/ObjectRepository/UniSetObject.cc
View file @
e893e817
...
...
@@ -145,8 +145,8 @@ void UniSetObject::initObject()
// ------------------------------------------------------------------------------------------
/*!
* \param om - указа
зтель на мен
джер управляющий объектом
* \return Возращает \a true если инициализация прош
д
а успешно, и \a false если нет
* \param om - указа
тель на мене
джер управляющий объектом
* \return Возращает \a true если инициализация прош
л
а успешно, и \a false если нет
*/
bool
UniSetObject
::
init
(
const
std
::
weak_ptr
<
UniSetManager
>&
om
)
{
...
...
@@ -192,7 +192,7 @@ void UniSetObject::setActive(bool set)
// ------------------------------------------------------------------------------------------
/*!
* \param vm - указатель на структуру, которая заполняется если есть сообщение
* \return Возвращает
\a true если сообщение есть, и \a false
если нет
* \return Возвращает
указатель VoidMessagePtr если сообщение есть, и shared_ptr(nullptr)
если нет
*/
VoidMessagePtr
UniSetObject
::
receiveMessage
()
{
...
...
src/Various/SViewer.cc
View file @
e893e817
...
...
@@ -35,22 +35,15 @@ using namespace std;
SViewer
::
SViewer
(
const
string
&
csec
,
bool
sn
)
:
csec
(
csec
),
rep
(
UniSetTypes
::
uniset_conf
()),
cache
(
500
,
15
),
isShort
(
sn
)
isShortName
(
sn
)
{
ui
=
make_shared
<
UInterface
>
(
UniSetTypes
::
uniset_conf
());
ui
->
setCacheMaxSize
(
500
);
}
SViewer
::~
SViewer
()
{
}
void
SViewer
::
on_SViewer_destroy
()
{
// activator->oakill(SIGINT);
// msleep(500);
// activator->oakill(SIGKILL);
}
// --------------------------------------------------------------------------
void
SViewer
::
monitor
(
timeout_t
timeMS
)
{
...
...
@@ -164,17 +157,8 @@ void SViewer::getInfo( ObjectId id )
try
{
try
{
oref
=
cache
.
resolve
(
id
,
uniset_conf
()
->
getLocalNode
());
}
catch
(
NameNotFound
)
{}
if
(
CORBA
::
is_nil
(
oref
)
)
{
oref
=
ui
->
resolve
(
id
);
cache
.
cache
(
id
,
uniset_conf
()
->
getLocalNode
(),
oref
);
}
IONotifyController_i_var
ioc
=
IONotifyController_i
::
_narrow
(
oref
);
...
...
@@ -211,8 +195,6 @@ void SViewer::getInfo( ObjectId id )
{
cout
<<
"(getInfo): catch ..."
<<
endl
;
}
cache
.
erase
(
id
,
uniset_conf
()
->
getLocalNode
());
}
// ---------------------------------------------------------------------------
...
...
@@ -230,7 +212,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
{
string
name
(
uniset_conf
()
->
oind
->
getNameById
(
amap
[
i
].
si
.
id
));
if
(
isShort
)
if
(
isShort
Name
)
name
=
ORepHelpers
::
getShortName
(
name
);
string
txtname
(
uniset_conf
()
->
oind
->
getTextName
(
amap
[
i
].
si
.
id
)
);
...
...
@@ -250,7 +232,7 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
{
string
name
(
uniset_conf
()
->
oind
->
getNameById
(
amap
[
i
].
si
.
id
));
if
(
isShort
)
if
(
isShort
Name
)
name
=
ORepHelpers
::
getShortName
(
name
);
string
txtname
(
uniset_conf
()
->
oind
->
getTextName
(
amap
[
i
].
si
.
id
)
);
...
...
@@ -291,7 +273,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
string
sname
(
uniset_conf
()
->
oind
->
getNameById
(
tlst
[
i
].
si
.
id
));
if
(
isShort
)
if
(
isShort
Name
)
sname
=
ORepHelpers
::
getShortName
(
sname
);
cout
<<
" | "
<<
setw
(
60
)
<<
sname
<<
" | "
<<
setw
(
5
)
<<
tlst
[
i
].
value
<<
endl
;
...
...
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