00001 /*************************************************************************** 00002 * Copyright (C) 2007 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the conexus library. * 00006 * * 00007 * The conexus library is free software; you can redistribute it and/or * 00008 * modify it under the terms of the GNU General Public License * 00009 * version 3 as published by the Free Software Foundation. * 00010 * * 00011 * The conexus library is distributed in the hope that it will be * 00012 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * 00013 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00014 * General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU General Public License * 00017 * along with this software. If not see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 #ifndef CONEXUSREGISTRY_H 00020 #define CONEXUSREGISTRY_H 00021 00022 #include <map> 00023 00024 #include <conexus/pointer.h> 00025 #include <conexus/endpoint.h> 00026 #include <conexus/endpointserver.h> 00027 00036 namespace Conexus { 00037 00043 class Registry{ 00044 public: 00045 00046 typedef ConexusPointer<Registry> pointer; 00047 00048 typedef std::map<std::string, Endpoint::pointer> NameEndpointMap; 00049 00050 typedef std::map<std::string, EndpointServer::pointer> NameEndpointServerMap; 00051 00052 Registry(); 00053 00054 static pointer create(); 00055 00056 ~Registry(); 00057 00064 bool add( const std::string& name, Endpoint::pointer obj ); 00065 00072 bool add( const std::string& name, EndpointServer::pointer obj ); 00073 00075 bool remove( const std::string& name ); 00076 00077 bool remove( Endpoint::pointer obj ); 00078 00079 bool remove( EndpointServer::pointer obj ); 00080 00081 Object::pointer lookup( const std::string& name ); 00082 00083 Endpoint::pointer lookup_endpoint( const std::string& name ); 00084 00085 EndpointServer::pointer lookup_server( const std::string& name ); 00086 00087 const NameEndpointMap& endpoints(); 00088 00089 const NameEndpointServerMap& servers(); 00090 00091 sigc::signal<void,const std::string&> signal_added(); 00092 00093 sigc::signal<void,const std::string&> signal_removed(); 00094 00095 protected: 00096 00097 NameEndpointMap m_name_endpoint; 00098 00099 NameEndpointServerMap m_name_endpointserver; 00100 00101 sigc::signal<void,const std::string&> m_signal_added; 00102 00103 sigc::signal<void,const std::string&> m_signal_removed; 00104 00105 }; 00106 00107 } 00108 00109 #endif