CERN org.glite.Gfal
2.0.1
|
00001 #pragma once 00002 #ifndef PLUGIN_INTERFACE_H 00003 #define PLUGIN_INTERFACE_H 00004 /* 00005 * Copyright (c) Members of the EGEE Collaboration. 2004. 00006 * See http://www.eu-egee.org/partners/ for details on the copyright holders. 00007 * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); 00009 * you may not use this file except in compliance with the License. 00010 * You may obtain a copy of the License at 00011 * 00012 * http://www.apache.org/licenses/LICENSE-2.0 00013 * 00014 * Unless required by applicable law or agreed to in writing, software 00015 * distributed under the License is distributed on an "AS IS" BASIS, 00016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00017 * See the License for the specific language governing permissions and 00018 * limitations under the License. 00019 */ 00020 00021 #include <string> 00022 #include <vector> 00023 #include <iostream> 00024 00025 00026 namespace Gfal{ 00027 00028 00032 class PluginLink { 00033 public: 00034 PluginLink(){}; 00035 virtual ~PluginLink(){}; 00036 00041 template<typename T> 00042 T get_sym_s(const std::string & str) const; 00047 virtual void* get_sym(const std::string & str) const =0; 00048 00052 virtual void* plugin_data()= 0; 00053 00054 }; 00055 00056 // overloded member of get_sym, allow type safety 00057 template<typename T> 00058 T PluginLink::get_sym_s(const std::string & str) const { 00059 return reinterpret_cast<T>(this->get_sym(str)); 00060 } 00061 00062 // 00063 typedef std::vector<PluginLink* > VectorPlugin; 00064 00065 class PluginFactory{ 00066 public: 00067 PluginFactory(){}; 00068 virtual ~PluginFactory(){}; 00069 00073 virtual const VectorPlugin& get_plugin_links() =0; 00074 00075 00076 }; 00077 00078 } 00079 #endif /* PluginFactory_H */