aboutsummaryrefslogtreecommitdiffstats
path: root/interface/optdl.hpp
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-10-20 11:41:47 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-10-20 11:41:47 +0000
commit3de58cdbfed2bedef00f791994398b5ba13321f4 (patch)
treec17377c74bb927364b4e0729e4fed5f1e912b013 /interface/optdl.hpp
parent67e53335ef07eb17409f875bb552e3b53c5678b0 (diff)
downloadopt-utilities-3de58cdbfed2bedef00f791994398b5ba13321f4.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@87 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'interface/optdl.hpp')
-rw-r--r--interface/optdl.hpp32
1 files changed, 29 insertions, 3 deletions
diff --git a/interface/optdl.hpp b/interface/optdl.hpp
index 4ff4d9d..5f44733 100644
--- a/interface/optdl.hpp
+++ b/interface/optdl.hpp
@@ -1,7 +1,7 @@
#ifdef __linux__
-#ifndef DL_MODEL_HPP
-#define DL_MODEL_HPP
+#ifndef OPTDL_HPP
+#define OPTDL_HPP
#define OPT_HEADER
#include <core/fitter.hpp>
#include <cmath>
@@ -90,7 +90,33 @@ namespace opt_utilities
return func_create();
}
-
+ template <typename Ty,
+ typename Tx,
+ typename Tp,
+ typename Ts,
+ typename Tstr>
+ statistic<Ty,Tx,Tp,Ts,Tstr>* load_statistic(const char* fname)
+ {
+ void* handle;
+
+ handle=dlopen(fname,RTLD_LAZY);
+
+ if(!handle)
+ {
+ throw opt_exception("faild loading object");
+ }
+
+
+ statistic<Ty,Tx,Tp,Ts,Tstr>* (*func_create)();
+
+ func_create=(statistic<Ty,Tx,Tp,Ts,Tstr>* (*)())dlsym(handle,"create_statistic_object");
+
+ if(!func_create)
+ {
+ throw opt_exception("symble undefined");
+ }
+ return func_create();
+ }
}