Last linter optimizations.
[bpdyndnsd] / src / serializeservicecontainer.h
1 /** @file
2  * @brief SerializeServiceContainer class header. This class holds Service objects in a list for serialization.
3  *
4  *
5  *
6  * @copyright Intra2net AG
7  * @license GPLv2
8 */
9
10 #ifndef SERIALIZESERVICECONTAINER_H
11 #define SERIALIZESERVICECONTAINER_H
12
13 #include "service.h"
14 #include "logger.h"
15
16 #include <boost/serialization/list.hpp>
17 #include <boost/serialization/vector.hpp>
18 #include <boost/serialization/shared_ptr.hpp>
19 #include <boost/serialization/export.hpp>
20
21 #include <boost/shared_ptr.hpp>
22 #include <list>
23
24 #include "service_dhs.h"
25 #include "service_ods.h"
26 #include "service_dyndns.h"
27 #include "service_dyns.h"
28 #include "service_easydns.h"
29 #include "service_tzo.h"
30 #include "service_zoneedit.h"
31 #include "service_gnudip.h"
32
33 // Following boost macros are needed for serialization of derived classes through a base class pointer (Service *).
34 BOOST_CLASS_EXPORT_GUID(ServiceOds, "ServiceOds")
35 BOOST_CLASS_EXPORT_GUID(ServiceDhs, "ServiceDhs")
36 BOOST_CLASS_EXPORT_GUID(ServiceDyns, "ServiceDyns")
37 BOOST_CLASS_EXPORT_GUID(ServiceDyndns, "ServiceDyndns")
38 BOOST_CLASS_EXPORT_GUID(ServiceEasydns, "ServiceEasydns")
39 BOOST_CLASS_EXPORT_GUID(ServiceTzo, "ServiceTzo")
40 BOOST_CLASS_EXPORT_GUID(ServiceZoneedit, "ServiceZoneedit")
41 BOOST_CLASS_EXPORT_GUID(ServiceGnudip, "ServiceGnudip")
42
43
44 class SerializeServiceContainer
45 {
46
47 private:
48
49     std::list<Service::Ptr> ContainingServices;
50
51     friend class boost::serialization::access;
52     template<class Archive>
53     void serialize(Archive & ar, const unsigned int version)
54     {
55         ar & ContainingServices;
56     }
57
58 public:
59
60     typedef boost::shared_ptr<SerializeServiceContainer> Ptr;
61
62     SerializeServiceContainer();
63
64     ~SerializeServiceContainer();
65
66     void add_service(Service::Ptr service);
67
68     std::list<Service::Ptr> get_containing_services() const;
69
70 };
71
72 #endif