29
29
PUBLIC MEMBER FUNCTIONS
30
30
******************************************************************************/
31
31
32
- Property & PropertyContainer::addPropertyReal ( Property & property, String const & name, Permission const permission, int propertyIdentifier, GetTimeCallbackFunc func)
32
+ Property & addPropertyToContainer (PropertyContainer & prop_cont, Property & property, String const & name, Permission const permission, int propertyIdentifier, GetTimeCallbackFunc func)
33
33
{
34
34
/* Check whether or not the property already has been added to the container */
35
- Property * p = getProperty (name);
35
+ Property * p = getProperty (prop_cont, name);
36
36
if (p != nullptr ) return (*p);
37
37
38
38
/* Initialize property and add it to the container */
39
39
property.init (name, permission, func);
40
40
41
- addProperty (&property, propertyIdentifier);
41
+ addProperty (prop_cont, &property, propertyIdentifier);
42
42
return property;
43
43
}
44
44
45
45
46
- Property * PropertyContainer:: getProperty (String const & name)
46
+ Property * getProperty (PropertyContainer & prop_cont, String const & name)
47
47
{
48
48
std::list<Property *>::iterator iter;
49
49
50
- iter = std::find_if (_property_list .begin (),
51
- _property_list .end (),
50
+ iter = std::find_if (prop_cont .begin (),
51
+ prop_cont .end (),
52
52
[name](Property * p) -> bool
53
53
{
54
54
return (p->name () == name);
55
55
});
56
56
57
- if (iter == _property_list .end ())
57
+ if (iter == prop_cont .end ())
58
58
return nullptr ;
59
59
else
60
60
return (*iter);
61
61
}
62
62
63
- Property * PropertyContainer:: getProperty (int const identifier)
63
+ Property * getProperty (PropertyContainer & prop_cont, int const identifier)
64
64
{
65
65
std::list<Property *>::iterator iter;
66
66
67
- iter = std::find_if (_property_list .begin (),
68
- _property_list .end (),
67
+ iter = std::find_if (prop_cont .begin (),
68
+ prop_cont .end (),
69
69
[identifier](Property * p) -> bool
70
70
{
71
71
return (p->identifier () == identifier);
72
72
});
73
73
74
- if (iter == _property_list .end ())
74
+ if (iter == prop_cont .end ())
75
75
return nullptr ;
76
76
else
77
77
return (*iter);
78
78
}
79
79
80
- int PropertyContainer:: appendChangedProperties (CborEncoder * arrayEncoder, bool lightPayload)
80
+ int appendChangedProperties (PropertyContainer & prop_cont, CborEncoder * arrayEncoder, bool lightPayload)
81
81
{
82
82
int appendedProperties = 0 ;
83
- std::for_each (_property_list .begin (),
84
- _property_list .end (),
83
+ std::for_each (prop_cont .begin (),
84
+ prop_cont .end (),
85
85
[arrayEncoder, lightPayload, &appendedProperties](Property * p)
86
86
{
87
87
if (p->shouldBeUpdated () && p->isReadableByCloud ())
@@ -93,23 +93,23 @@ int PropertyContainer::appendChangedProperties(CborEncoder * arrayEncoder, bool
93
93
return appendedProperties;
94
94
}
95
95
96
- void PropertyContainer:: requestUpdateForAllProperties ()
96
+ void requestUpdateForAllProperties (PropertyContainer & prop_cont )
97
97
{
98
- std::for_each (_property_list .begin (),
99
- _property_list .end (),
98
+ std::for_each (prop_cont .begin (),
99
+ prop_cont .end (),
100
100
[](Property * p)
101
101
{
102
102
p->requestUpdate ();
103
103
});
104
104
}
105
105
106
- void PropertyContainer:: updateTimestampOnLocallyChangedProperties ()
106
+ void updateTimestampOnLocallyChangedProperties (PropertyContainer & prop_cont )
107
107
{
108
108
/* This function updates the timestamps on the primitive properties
109
109
* that have been modified locally since last cloud synchronization
110
110
*/
111
- std::for_each (_property_list .begin (),
112
- _property_list .end (),
111
+ std::for_each (prop_cont .begin (),
112
+ prop_cont .end (),
113
113
[](Property * p)
114
114
{
115
115
CloudWrapperBase * pbase = reinterpret_cast <CloudWrapperBase *>(p);
@@ -124,7 +124,7 @@ void PropertyContainer::updateTimestampOnLocallyChangedProperties()
124
124
PRIVATE MEMBER FUNCTIONS
125
125
******************************************************************************/
126
126
127
- void PropertyContainer:: addProperty (Property * property_obj, int propertyIdentifier)
127
+ void addProperty (PropertyContainer & prop_cont, Property * property_obj, int propertyIdentifier)
128
128
{
129
129
if (propertyIdentifier != -1 )
130
130
{
@@ -133,7 +133,7 @@ void PropertyContainer::addProperty(Property * property_obj, int propertyIdentif
133
133
/* If property identifier is -1, an incremental value will be assigned as identifier. */
134
134
else
135
135
{
136
- property_obj->setIdentifier (_property_list .size () + 1 ); /* This is in order to stay compatible to the old system of first increasing _numProperties and then assigning it here. */
136
+ property_obj->setIdentifier (prop_cont .size () + 1 ); /* This is in order to stay compatible to the old system of first increasing _numProperties and then assigning it here. */
137
137
}
138
- _property_list .push_back (property_obj);
138
+ prop_cont .push_back (property_obj);
139
139
}
0 commit comments