aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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();
+ }
+
+
+
}