Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 6b51943

Browse files
committed
Extract EventPar and rename to EventSubscriptionState
1 parent 46c64bf commit 6b51943

File tree

8 files changed

+56
-37
lines changed

8 files changed

+56
-37
lines changed

cppapi/server/attribute.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
#include <attrdesc.h>
3838
#include <fwdattrdesc.h>
3939
#include <encoded_attribute.h>
40+
#include "event_subscription_state.h"
4041

4142
#include <functional>
4243
#include <time.h>
4344
#include <iterator>
44-
#include <set>
4545

4646
#ifdef _TG_WINDOWS_
4747
#include <sys/types.h>
@@ -126,9 +126,6 @@ typedef enum prop_type
126126

127127
class EventSupplier;
128128

129-
typedef int EventClientLibVersion;
130-
typedef std::set<EventClientLibVersion> EventClientLibVersions;
131-
132129
//=============================================================================
133130
//
134131
// The Attribute class

cppapi/server/device.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6121,13 +6121,13 @@ void DeviceImpl::remove_local_command(const string &cmd_name)
61216121
//
61226122
//------------------------------------------------------------------------------------------------------------------
61236123

6124-
void DeviceImpl::get_event_param(vector<EventPar> &eve)
6124+
void DeviceImpl::get_event_param(DeviceEventSubscriptionState& eve)
61256125
{
61266126
ZmqEventSupplier *event_supplier_zmq = Util::instance()->get_zmq_event_supplier();
61276127

61286128
if (event_supplier_zmq->any_dev_intr_client(this) == true)
61296129
{
6130-
EventPar ep;
6130+
AttributeEventSubscriptionState ep;
61316131

61326132
ep.notifd = false;
61336133
ep.zmq = true;
@@ -6154,7 +6154,7 @@ void DeviceImpl::get_event_param(vector<EventPar> &eve)
61546154
//
61556155
//------------------------------------------------------------------------------------------------------------------
61566156

6157-
void DeviceImpl::set_event_param(vector<EventPar> &eve)
6157+
void DeviceImpl::set_event_param(const DeviceEventSubscriptionState& eve)
61586158
{
61596159
for (size_t loop = 0; loop < eve.size(); loop++)
61606160
{

cppapi/server/device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3414,8 +3414,8 @@ class DeviceImpl : public virtual POA_Tango::Device
34143414
void disable_intr_change_ev() {intr_change_ev = false;}
34153415
bool is_intr_change_ev_enable() {return intr_change_ev;}
34163416

3417-
void get_event_param(vector<EventPar> &);
3418-
void set_event_param(vector<EventPar> &);
3417+
void get_event_param(DeviceEventSubscriptionState&);
3418+
void set_event_param(const DeviceEventSubscriptionState&);
34193419

34203420
void set_client_lib(int _l) {if (count(client_lib.begin(),client_lib.end(),_l)==0)client_lib.push_back(_l);}
34213421

cppapi/server/dserver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ void DServer::restart(string &d_name)
861861

862862
vector<PollObj *> &p_obj = dev_to_del->get_poll_obj_list();
863863
vector<Pol> dev_pol;
864-
vector<EventPar> eve;
864+
DeviceEventSubscriptionState eve;
865865

866866
for (i = 0;i < p_obj.size();i++)
867867
{
@@ -1172,7 +1172,7 @@ void ServRestartThread::run(void *ptr)
11721172
// Memorize event parameters and devices interface
11731173
//
11741174

1175-
map<string,vector<EventPar> > map_events;
1175+
EventSubscriptionState map_events;
11761176
map<string,DevIntr> map_dev_inter;
11771177

11781178
dev->mem_event_par(map_events);
@@ -1956,14 +1956,14 @@ void DServer::mcast_event_for_att(string &dev_name,string &att_name,vector<strin
19561956
//
19571957
//------------------------------------------------------------------------------------------------------------------
19581958

1959-
void DServer::mem_event_par(map<string,vector<EventPar> > &_map)
1959+
void DServer::mem_event_par(EventSubscriptionState& _map)
19601960
{
19611961
for (size_t i = 0;i < class_list.size();i++)
19621962
{
19631963
vector<DeviceImpl *> &dev_list = class_list[i]->get_device_list();
19641964
for (size_t j = 0;j < dev_list.size();j++)
19651965
{
1966-
vector<EventPar> eve;
1966+
DeviceEventSubscriptionState eve;
19671967
dev_list[j]->get_device_attr()->get_event_param(eve);
19681968
dev_list[j]->get_event_param(eve);
19691969

@@ -1989,15 +1989,15 @@ void DServer::mem_event_par(map<string,vector<EventPar> > &_map)
19891989
//
19901990
//------------------------------------------------------------------------------------------------------------------
19911991

1992-
void DServer::apply_event_par(map<string,vector<EventPar> > &_map)
1992+
void DServer::apply_event_par(EventSubscriptionState& _map)
19931993
{
19941994
for (size_t i = 0;i < class_list.size();i++)
19951995
{
19961996
vector<DeviceImpl *> &dev_list = class_list[i]->get_device_list();
19971997
for (size_t j = 0;j < dev_list.size();j++)
19981998
{
19991999
string &dev_name = dev_list[j]->get_name();
2000-
map<string,vector<EventPar> >::iterator ite;
2000+
EventSubscriptionState::iterator ite;
20012001
ite = _map.find(dev_name);
20022002

20032003
if (ite != _map.end())

cppapi/server/dserver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public :
127127
void _create_cpp_class(const char *c1,const char *c2) {this->create_cpp_class(c1,c2);}
128128

129129
void mcast_event_for_att(string &,string &,vector<string> &);
130-
void mem_event_par(map<string, vector<EventPar> > &);
131-
void apply_event_par(map<string,vector<EventPar> > &);
130+
void mem_event_par(EventSubscriptionState&);
131+
void apply_event_par(EventSubscriptionState&);
132132

133133
void mem_devices_interface(map<string,DevIntr> &);
134134
void changed_devices_interface(map<string,DevIntr> &);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#ifndef _EVENT_SUBSCRIPTION_STATE_H
2+
#define _EVENT_SUBSCRIPTION_STATE_H
3+
4+
#include <set>
5+
#include <map>
6+
#include <vector>
7+
#include <string>
8+
9+
namespace Tango
10+
{
11+
12+
typedef int EventClientLibVersion;
13+
typedef std::set<EventClientLibVersion> EventClientLibVersions;
14+
15+
struct AttributeEventSubscriptionState
16+
{
17+
long attr_id;
18+
EventClientLibVersions change;
19+
EventClientLibVersions archive;
20+
bool quality;
21+
EventClientLibVersions periodic;
22+
EventClientLibVersions user;
23+
EventClientLibVersions att_conf;
24+
bool data_ready;
25+
bool dev_intr_change;
26+
bool notifd;
27+
bool zmq;
28+
};
29+
30+
typedef std::vector<AttributeEventSubscriptionState> DeviceEventSubscriptionState;
31+
32+
typedef std::map<std::string, DeviceEventSubscriptionState> EventSubscriptionState;
33+
34+
}
35+
36+
#endif

cppapi/server/multiattribute.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ void MultiAttribute::read_alarm(string &status)
15011501
//
15021502
//------------------------------------------------------------------------------------------------------------------
15031503

1504-
void MultiAttribute::get_event_param(vector<EventPar> &eve)
1504+
void MultiAttribute::get_event_param(DeviceEventSubscriptionState& eve)
15051505
{
15061506
unsigned int i;
15071507

@@ -1560,7 +1560,7 @@ void MultiAttribute::get_event_param(vector<EventPar> &eve)
15601560

15611561
if (once_more == true)
15621562
{
1563-
EventPar ep;
1563+
AttributeEventSubscriptionState ep;
15641564

15651565
if (attr_list[i]->use_notifd_event() == true)
15661566
ep.notifd = true;
@@ -1600,7 +1600,7 @@ void MultiAttribute::get_event_param(vector<EventPar> &eve)
16001600
//
16011601
//------------------------------------------------------------------------------------------------------------------
16021602

1603-
void MultiAttribute::set_event_param(vector<EventPar> &eve)
1603+
void MultiAttribute::set_event_param(const DeviceEventSubscriptionState& eve)
16041604
{
16051605
for (size_t i = 0;i < eve.size();i++)
16061606
{

cppapi/server/multiattribute.h

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,14 @@
3939
#define _MULTIATTRIBUTE_H
4040

4141
#include <tango.h>
42+
#include "event_subscription_state.h"
4243

4344
namespace Tango
4445
{
4546

4647
class AttrProperty;
4748
class DeviceClass;
4849

49-
struct EventPar
50-
{
51-
long attr_id;
52-
EventClientLibVersions change;
53-
EventClientLibVersions archive;
54-
bool quality;
55-
EventClientLibVersions periodic;
56-
EventClientLibVersions user;
57-
EventClientLibVersions att_conf;
58-
bool data_ready;
59-
bool dev_intr_change;
60-
bool notifd;
61-
bool zmq;
62-
};
63-
6450
//=============================================================================
6551
//
6652
// The MultiAttribute class
@@ -283,8 +269,8 @@ class MultiAttribute
283269
void remove_attribute(string &,bool);
284270
vector<long> &get_w_attr_list() {return writable_attr_list;}
285271
bool is_att_quality_alarmed();
286-
void get_event_param(vector<EventPar> &);
287-
void set_event_param(vector<EventPar> &);
272+
void get_event_param(DeviceEventSubscriptionState&);
273+
void set_event_param(const DeviceEventSubscriptionState&);
288274
void add_alarmed_quality_factor(string &);
289275
void add_default(vector<AttrProperty> &,string &,string &,long);
290276
void add_attr(Attribute *att);

0 commit comments

Comments
 (0)