1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef anna_diameter_comm_OriginHostManager_hpp
10 #define anna_diameter_comm_OriginHostManager_hpp
14 #include <anna/core/Singleton.hpp>
15 #include <anna/diameter/defines.hpp>
34 typedef std::map<std::string, anna::diameter::comm::OriginHost*> origin_hosts_t;
35 typedef std::map<std::string, anna::diameter::comm::OriginHost*>::const_iterator origin_hosts_it;
36 typedef std::map<std::string, anna::diameter::comm::OriginHost*>::iterator origin_hosts_nc_it;
40 * Helper class to centralize application Origin Host Nodes
43 class OriginHostManager : public anna::Singleton <OriginHostManager> {
47 origin_hosts_t a_origin_hosts;
49 // private constructor
50 OriginHostManager() {};
54 virtual ~OriginHostManager() {;}
57 * First element iterator
59 origin_hosts_it begin() const throw() { return a_origin_hosts.begin(); }
62 * Last element iterator
64 origin_hosts_it end() const throw() { return a_origin_hosts.end(); }
67 * Number of registered origin hosts
69 int size() const throw() { return a_origin_hosts.size(); }
72 * Registers a new origin host node (externally allocated) associated to a name.
73 * If the name exists, the new origin host pointer will replace the existing one.
75 * @param name Origin Host Name
76 * @param originHost Associated Origin Host node
78 void registerOriginHost(const std::string &name, OriginHost* originHost) throw();
81 * Get the associated origin host node for a provided name.
83 * @param name Origin Host Name
85 * @return Found origin host node, NULL if not found
87 OriginHost *getOriginHost(const std::string &name) const throw();
90 Class XML representation.
91 \param parent XML node over which we will put instance information.
92 \return XML with class content.
94 virtual anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
97 friend class anna::Singleton <OriginHostManager>;