X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fdiameter.comm%2FOriginHostManager.hpp;fp=include%2Fanna%2Fdiameter.comm%2FOriginHostManager.hpp;h=af5793bfda6f1efa563fb5dba39be5a8e4e5c3a1;hb=a4a2ff4e20ddc4c6de7f2d3efd3acfb16c0d91c1;hp=0000000000000000000000000000000000000000;hpb=61f81319bb14f08094488e8a2478ff4e0d6d661a;p=anna.git diff --git a/include/anna/diameter.comm/OriginHostManager.hpp b/include/anna/diameter.comm/OriginHostManager.hpp new file mode 100644 index 0000000..af5793b --- /dev/null +++ b/include/anna/diameter.comm/OriginHostManager.hpp @@ -0,0 +1,105 @@ +// ANNA - Anna is Not Nothingness Anymore // +// // +// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // +// // +// See project site at http://redmine.teslayout.com/projects/anna-suite // +// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // + + +#ifndef anna_diameter_comm_OriginHostManager_hpp +#define anna_diameter_comm_OriginHostManager_hpp + + +// Project +#include +#include + +// Standard +#include +#include + + +namespace anna { + +namespace xml { + class Node; + +} +namespace diameter { + +namespace comm { + +class OriginHost; + +typedef std::map origin_hosts_t; +typedef std::map::const_iterator origin_hosts_it; +typedef std::map::iterator origin_hosts_nc_it; + + +/** + * Helper class to centralize application Origin Host Nodes + * + */ +class OriginHostManager : public anna::Singleton { + +private: + + origin_hosts_t a_origin_hosts; + + // private constructor + OriginHostManager() {}; + +public: + + virtual ~OriginHostManager() {;} + + /** + * First element iterator + */ + origin_hosts_it begin() const throw() { return a_origin_hosts.begin(); } + + /** + * Last element iterator + */ + origin_hosts_it end() const throw() { return a_origin_hosts.end(); } + + /** + * Number of registered origin hosts + */ + int size() const throw() { return a_origin_hosts.size(); } + + /** + * Registers a new origin host node (externally allocated) associated to a name. + * If the name exists, the new origin host pointer will replace the existing one. + * + * @param name Origin Host Name + * @param originHost Associated Origin Host node + */ + void registerOriginHost(const std::string &name, OriginHost* originHost) throw(); + + /** + * Get the associated origin host node for a provided name. + * + * @param name Origin Host Name + * + * @return Found origin host node, NULL if not found + */ + OriginHost *getOriginHost(const std::string &name) const throw(); + + /** + Class XML representation. + \param parent XML node over which we will put instance information. + \return XML with class content. + */ + virtual anna::xml::Node* asXML(anna::xml::Node* parent) const throw(); + + + friend class anna::Singleton ; +}; + +} +} +} + +#endif +