00001 //------------------------------------------------------------------------------ 00002 // Copyright (c) 2012 by European Organization for Nuclear Research (CERN) 00003 // Author: Lukasz Janyst <ljanyst@cern.ch> 00004 //------------------------------------------------------------------------------ 00005 // XRootD is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // XRootD is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00017 //------------------------------------------------------------------------------ 00018 00019 #ifndef __XRD_CL_TRANSPORT_MANAGER_HH__ 00020 #define __XRD_CL_TRANSPORT_MANAGER_HH__ 00021 00022 #include <map> 00023 #include <string> 00024 00025 namespace XrdCl 00026 { 00027 class TransportHandler; 00028 00029 //---------------------------------------------------------------------------- 00031 //---------------------------------------------------------------------------- 00032 class TransportManager 00033 { 00034 public: 00035 typedef TransportHandler *(*TransportFactory)(); 00036 00037 //------------------------------------------------------------------------ 00039 //------------------------------------------------------------------------ 00040 TransportManager(); 00041 00042 //------------------------------------------------------------------------ 00043 // Destructor 00044 //------------------------------------------------------------------------ 00045 virtual ~TransportManager(); 00046 00047 //------------------------------------------------------------------------ 00049 //------------------------------------------------------------------------ 00050 bool RegisterFactory( const std::string &protocol, 00051 TransportFactory factory ); 00052 00053 //------------------------------------------------------------------------ 00055 //------------------------------------------------------------------------ 00056 TransportHandler *GetHandler( const std::string &protocol ); 00057 00058 private: 00059 typedef std::map<std::string, TransportHandler*> HandlerMap; 00060 typedef std::map<std::string, TransportFactory> FactoryMap; 00061 HandlerMap pHandlers; 00062 FactoryMap pFactories; 00063 }; 00064 } 00065 00066 #endif // __XRD_CL_TRANSPORT_MANAGER_HH__