1 #ifndef __JEEP__JFUNCTIONADAPTOR__
2 #define __JEEP__JFUNCTIONADAPTOR__
18 namespace JPP {
using namespace JEEP; }
32 template<
class __pF__>
58 return (
function != NULL);
103 const char* error = dlerror();
132 void open(
const char* file_name)
136 handle = dlopen(file_name, RTLD_LOCAL | RTLD_LAZY);
207 const string::size_type pos = buffer.rfind(
SEPARATOR);
209 if (pos != string::npos) {
211 object.libso = buffer.substr(0,pos);
212 object.symbol = buffer.substr(pos+1);
216 object.libso = buffer;
266 const std::string&
symbol) :
300 template<
class JReturn_t = void,
class ...Args>
307 typedef JReturn_t (*pF)(Args...);
335 const std::string&
symbol) :
348 return this->
function(
args...);
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for opening of file.
Exception for reading of file.
void initialise()
Initialise counter.
void attach(const JSharedCounter &object)
Attach this counter to given shared counter object.
General puprpose classes and methods.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary base class for function adaptor.
JFunctionAdaptorHelper(const JFunctionAdaptorHelper &helper)
Copy constructor.
bool is_valid() const
Check validity of function.
void get(const char *symbol)
Get function with given name according to specific protocol.
void reload()
Reload function from shared library.
friend std::ostream & operator<<(std::ostream &out, const JFunctionAdaptorHelper &object)
Write function adaptor helper to output stream.
static const char SEPARATOR
Separation character between library file name and function name.
JFunctionAdaptorHelper()
Default constructor.
bool is_open() const
Check if shared library file is open.
void set(__pF__ pf)
Set function.
friend std::istream & operator>>(std::istream &in, JFunctionAdaptorHelper &object)
Read function adaptor helper from input stream.
JFunctionAdaptorHelper(__pF__ pf)
Constructor.
JFunctionAdaptorHelper(const std::string &libso, const std::string &symbol)
Constructor.
void open(const char *file_name)
Open file.
virtual ~JFunctionAdaptorHelper()
Virtual destructor.
void load(const std::string &libso, const std::string &symbol)
Load function from shared library.
void reset()
Reset function adaptor helper.
JFunctionAdaptor(const std::string &libso, const std::string &symbol)
Constructor.
JFunctionAdaptor(pF pf)
Constructor.
JFunctionAdaptor()
Default constructor.
JReturn_t operator()(Args... args) const
Function operation.