From 67e53335ef07eb17409f875bb552e3b53c5678b0 Mon Sep 17 00:00:00 2001
From: astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>
Date: Tue, 20 Oct 2009 06:39:15 +0000
Subject: git-svn-id: file:///home/svn/opt_utilities@86
 ed2142bd-67ad-457f-ba7c-d818d4011675

---
 interface/optdl.hpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 60 insertions(+), 4 deletions(-)

(limited to 'interface')

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();
+  }
+
+  
+
 }
 
 
-- 
cgit v1.2.2