2929 PUBLIC MEMBER FUNCTIONS
3030 ******************************************************************************/
3131
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)
3333{
3434 /* 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);
3636 if (p != nullptr ) return (*p);
3737
3838 /* Initialize property and add it to the container */
3939 property.init (name, permission, func);
4040
41- addProperty (&property, propertyIdentifier);
41+ addProperty (prop_cont, &property, propertyIdentifier);
4242 return property;
4343}
4444
4545
46- Property * PropertyContainer:: getProperty (String const & name)
46+ Property * getProperty (PropertyContainer & prop_cont, String const & name)
4747{
4848 std::list<Property *>::iterator iter;
4949
50- iter = std::find_if (_property_list .begin (),
51- _property_list .end (),
50+ iter = std::find_if (prop_cont .begin (),
51+ prop_cont .end (),
5252 [name](Property * p) -> bool
5353 {
5454 return (p->name () == name);
5555 });
5656
57- if (iter == _property_list .end ())
57+ if (iter == prop_cont .end ())
5858 return nullptr ;
5959 else
6060 return (*iter);
6161}
6262
63- Property * PropertyContainer:: getProperty (int const identifier)
63+ Property * getProperty (PropertyContainer & prop_cont, int const identifier)
6464{
6565 std::list<Property *>::iterator iter;
6666
67- iter = std::find_if (_property_list .begin (),
68- _property_list .end (),
67+ iter = std::find_if (prop_cont .begin (),
68+ prop_cont .end (),
6969 [identifier](Property * p) -> bool
7070 {
7171 return (p->identifier () == identifier);
7272 });
7373
74- if (iter == _property_list .end ())
74+ if (iter == prop_cont .end ())
7575 return nullptr ;
7676 else
7777 return (*iter);
7878}
7979
80- int PropertyContainer:: appendChangedProperties (CborEncoder * arrayEncoder, bool lightPayload)
80+ int appendChangedProperties (PropertyContainer & prop_cont, CborEncoder * arrayEncoder, bool lightPayload)
8181{
8282 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 (),
8585 [arrayEncoder, lightPayload, &appendedProperties](Property * p)
8686 {
8787 if (p->shouldBeUpdated () && p->isReadableByCloud ())
@@ -93,23 +93,23 @@ int PropertyContainer::appendChangedProperties(CborEncoder * arrayEncoder, bool
9393 return appendedProperties;
9494}
9595
96- void PropertyContainer:: requestUpdateForAllProperties ()
96+ void requestUpdateForAllProperties (PropertyContainer & prop_cont )
9797{
98- std::for_each (_property_list .begin (),
99- _property_list .end (),
98+ std::for_each (prop_cont .begin (),
99+ prop_cont .end (),
100100 [](Property * p)
101101 {
102102 p->requestUpdate ();
103103 });
104104}
105105
106- void PropertyContainer:: updateTimestampOnLocallyChangedProperties ()
106+ void updateTimestampOnLocallyChangedProperties (PropertyContainer & prop_cont )
107107{
108108 /* This function updates the timestamps on the primitive properties
109109 * that have been modified locally since last cloud synchronization
110110 */
111- std::for_each (_property_list .begin (),
112- _property_list .end (),
111+ std::for_each (prop_cont .begin (),
112+ prop_cont .end (),
113113 [](Property * p)
114114 {
115115 CloudWrapperBase * pbase = reinterpret_cast <CloudWrapperBase *>(p);
@@ -124,7 +124,7 @@ void PropertyContainer::updateTimestampOnLocallyChangedProperties()
124124 PRIVATE MEMBER FUNCTIONS
125125 ******************************************************************************/
126126
127- void PropertyContainer:: addProperty (Property * property_obj, int propertyIdentifier)
127+ void addProperty (PropertyContainer & prop_cont, Property * property_obj, int propertyIdentifier)
128128{
129129 if (propertyIdentifier != -1 )
130130 {
@@ -133,7 +133,7 @@ void PropertyContainer::addProperty(Property * property_obj, int propertyIdentif
133133 /* If property identifier is -1, an incremental value will be assigned as identifier. */
134134 else
135135 {
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. */
137137 }
138- _property_list .push_back (property_obj);
138+ prop_cont .push_back (property_obj);
139139}
0 commit comments