This is the simple Serviceholder class needed for de/serialization purposes.
[bpdyndnsd] / src / serviceholder.cpp
1 /** @file
2  * @brief Serviceholder class implementation. This class holds Service objects in a list for serialization.
3  *
4  *
5  *
6  * @copyright Intra2net AG
7  * @license GPLv2
8 */
9
10 #include "serviceholder.h"
11
12 using namespace std;
13
14
15 /**
16  * Default constructor. Invoked on serialization and deserialization.
17  */
18 Serviceholder::Serviceholder()
19 {
20 }
21
22
23 /**
24  * Default destructor. While serializing and deserializing we use boost/shared_ptr, the resources are managed correctly.
25  */
26 Serviceholder::~Serviceholder()
27 {
28 }
29
30
31 /**
32  * Serialize function needed by boost/serialization to define which members should be stored as the object state.
33  * In this case the STL list of Service pointers will be serialized.
34  * @param ar Archive
35  * @param version Version
36  */
37 template<class Archive>
38 void Serviceholder::serialize(Archive & ar, const unsigned int version)
39 {
40     ar & Hold_services;
41 }
42
43
44 /**
45  * Add Service * to internal list.
46  * @param service Pointer to Service object.
47  */
48 void Serviceholder::add_service(Service * service)
49 {
50     Hold_services.push_back(service);
51 }
52
53
54 /**
55  * Needed after deserialization to get the valid list of Service* back.
56  * @return The list of Service*.
57  */
58 std::list<Service*> Serviceholder::get_hold_services()
59 {
60     return Hold_services;
61 }