aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-10-20 06:39:15 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-10-20 06:39:15 +0000
commit67e53335ef07eb17409f875bb552e3b53c5678b0 (patch)
tree7c3a2d9aa614c514a50e6ed088bf12dbdf28f185 /interface
parent372caea057ff88b2fb1327c45f77b7e4205293ea (diff)
downloadopt-utilities-67e53335ef07eb17409f875bb552e3b53c5678b0.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@86 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'interface')
-rw-r--r--interface/optdl.hpp64
1 files changed, 60 insertions, 4 deletions
diff --git a/interface/optdl.hpp b/interface/optdl.hpp
index 9729335..4ff4d9d 100644
--- a/interface/optdl.hpp
+++ b/interface/optdl.hpp
@@ -13,8 +13,11 @@
namespace opt_utilities
{
- template <typename T>
- model<T,T,std::vector<T>,std::string>* load_model(const char* fname)
+ template <typename Ty,
+ typename Tx,
+ typename Tp,
+ typename Tstr>
+ model<Ty,Tx,Tp,Tstr>* load_model(const char* fname)
{
void* handle;
@@ -26,9 +29,9 @@ namespace opt_utilities
}
- model<T,T,std::vector<T>,std::string>* (*func_create)();
+ model<Ty,Tx,Tp,Tstr>* (*func_create)();
- func_create=(model<T,T,std::vector<T>,std::string>* (*)())dlsym(handle,"create_model_object");
+ func_create=(model<Ty,Tx,Tp,Tstr>* (*)())dlsym(handle,"create_model_object");
if(!func_create)
{
@@ -36,6 +39,59 @@ namespace opt_utilities
}
return func_create();
}
+
+ template <typename Ty,
+ typename Tp>
+ opt_method<Ty,Tp>* load_opt_method(const char* fname)
+ {
+ void* handle;
+
+ handle=dlopen(fname,RTLD_LAZY);
+
+ if(!handle)
+ {
+ throw opt_exception("faild loading object");
+ }
+
+
+ opt_method<Ty,Tp>* (*func_create)();
+
+ func_create=(opt_method<Ty,Tp>* (*)())dlsym(handle,"create_opt_method_object");
+
+ if(!func_create)
+ {
+ throw opt_exception("symble undefined");
+ }
+ return func_create();
+ }
+
+ template <typename Ty,
+ typename Tp>
+ func_obj<Ty,Tp>* load_func_obj(const char* fname)
+ {
+ void* handle;
+
+ handle=dlopen(fname,RTLD_LAZY);
+
+ if(!handle)
+ {
+ throw opt_exception("faild loading object");
+ }
+
+
+ func_obj<Ty,Tp>* (*func_create)();
+
+ func_create=(func_obj<Ty,Tp>* (*)())dlsym(handle,"create_func_obj_object");
+
+ if(!func_create)
+ {
+ throw opt_exception("symble undefined");
+ }
+ return func_create();
+ }
+
+
+
}