| 1 | /** @file |
| 2 | * @brief Serviceholder class header. This class holds Service and OldService lists. |
| 3 | * |
| 4 | * |
| 5 | * |
| 6 | * @copyright Intra2net AG |
| 7 | * @license GPLv2 |
| 8 | */ |
| 9 | |
| 10 | #ifndef SERVICEHOLDER_H |
| 11 | #define SERVICEHOLDER_H |
| 12 | |
| 13 | #include "service.hpp" |
| 14 | #include "serializeservicecontainer.hpp" |
| 15 | #include "logger.hpp" |
| 16 | #include "ip_addr_helper.hpp" |
| 17 | |
| 18 | #include <boost/shared_ptr.hpp> |
| 19 | #include <list> |
| 20 | |
| 21 | |
| 22 | class Serviceholder |
| 23 | { |
| 24 | |
| 25 | private: |
| 26 | |
| 27 | Logger::Ptr Log; |
| 28 | |
| 29 | std::list<Service::Ptr> OldServices; // Represents all old Services where the timeout isn't expired (in case the same Service is redefined). |
| 30 | std::list<Service::Ptr> Services; // Represents all active Services. |
| 31 | |
| 32 | IPAddrHelper::Ptr IPAddrHelp; |
| 33 | |
| 34 | public: |
| 35 | |
| 36 | typedef boost::shared_ptr<Serviceholder> Ptr; |
| 37 | |
| 38 | Serviceholder(); |
| 39 | |
| 40 | Serviceholder(Logger::Ptr _log); |
| 41 | |
| 42 | ~Serviceholder(); |
| 43 | |
| 44 | void add_service(Service::Ptr service); |
| 45 | |
| 46 | int deserialize_services(); |
| 47 | |
| 48 | int serialize_services() const; |
| 49 | |
| 50 | void delete_services(); |
| 51 | |
| 52 | void set_ip_addr_helper(IPAddrHelper::Ptr _ip_addr_helper); |
| 53 | |
| 54 | IPAddrHelper::Ptr get_ip_addr_helper() const; |
| 55 | |
| 56 | std::list<Service::Ptr> get_services() const; |
| 57 | }; |
| 58 | |
| 59 | #endif |