OSDN Git Service

クラス図に合わせたコードに変更
authorokada <okada@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 19 Dec 2008 05:43:14 +0000 (05:43 +0000)
committerokada <okada@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 19 Dec 2008 05:43:14 +0000 (05:43 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel@5279 1ed66053-1c2d-0410-8867-f7571e6e31d3

include/module_control_base.h
include/protocol_module_control.h
include/schedule_module_control.h

index 53b9d92..50a02e2 100644 (file)
 
 #include<string>
 #include<map>
-#include<boost/thread/locks.hpp>
 
 class  module_control_base
 {
 protected:
-       std::map<std::string,int>       loadedmodule_map;
-       boost::mutex                            loadedmodule_map_mutex;
+       std::string     modulefile_path;
 
        module_control_base(){}
        virtual ~module_control_base() = 0;
-
+       virtual operator=( const module_control_base& ) = 0;
 public:
+       virtual void    initialize( const std::string& infile_path ) = 0;
+       virtual void    finalize() = 0;
        virtual bool    load_module( const std::string& modulename ) = 0;
        virtual void    unload_module( const std::string&       modulename ) = 0;
 };
index 66dedd6..2530b5e 100644 (file)
@@ -12,6 +12,7 @@
 #define PROTOCOL_MODULE_CONTROL
 
 #include<string>
+#include<boost/thread/locks.hpp>
 #include"logger.h"
 #include "realserver.h"
 #include "protocol_module_base.h"
@@ -20,24 +21,42 @@ class       protocol_module_control : public module_control_base
 {
 public:
        typedef list<realserver>        realserverlist_type;
-       typedef boost::function< realserverlist_type::iretarot( void ) > rs_list_itr_func_type;
+       typedef boost::function< realserverlist_type::iretarot( void ) >        rs_list_itr_func_type;
+       typedef boost::function< void ( const LOG_LEVEL_TAG, const std::string ) >      logger_func_type;
+       typedef boost::function< void ( std::string&, unsigned int* ) >                         replication_pay_memory_func_type;
+
+       struct  module_info{
+               unsigned int    ref_count;
+               protocol_module_base*   (*module_create)(
+                                                                               rs_list_itr_func_type,
+                                                                               rs_list_itr_func_type,
+                                                                               rs_list_itr_func_type,
+                                                                               logger_func_type,
+                                                                               replication_pay_memory_func_type);
+               void                                    (*module_restroy)(protocol_module_base*);
+       };
+
 protected:
+       std::map<std::string,int>       loadedmodule_map;
+       boost::mutex                            loadedmodule_map_mutex;
+
        protocol_module_control();
        protocol_module_control( const protocol_module_control& );
        protocol_module_control&        operator=( const protocol_module_control& );
+
 public:
        static protocol_module_control& getInstance();
 
-       bool    load_module( const std::string& modulename );
-       void    unload_module( const std::string&       modulename );
+       bool    load_module( const std::string& );
+       void    unload_module( const std::string& );
 
        protocol_module_base*   module_new(
                                                                std::string& modulename,
-                                                               rs_list_itr_func_type rslist_begin,
-                                                               rs_list_itr_func_type rslist_end,
-                                                               rs_list_itr_func_type rslist_next,
-                                                               boost::function< void ( const LOG_LEVEL_TAG, const std::string ) > inlog,
-                                                               boost::function< void ( std::string&, unsigned int* ) >  inpaymemory );
+                                                               rs_list_itr_func_type   rslist_begin,
+                                                               rs_list_itr_func_type   rslist_end,
+                                                               rs_list_itr_func_type   rslist_next,
+                                                               logger_func_type                inlog,
+                                                               replication_pay_memory_func_type        inpaymemory );
        void    module_delete( protocol_module_base* module_ptr );
 };
 
index 0df5c73..9ab74ac 100644 (file)
 #define SCHEDULE_MODULE_CONTROL
 
 #include<string>
+#include<boost/thread/locks.hpp>
 #include"logger.h"
 #include"schedule_module_base.h"
 
 class  schedule_module_control : public module_control_base
 {
+public:
+       typedef boost::function< void ( const LOG_LEVEL_TAG, const std::string ) >      logger_func_type;
+       typedef boost::function< void ( std::string&, unsigned int* ) >                         replication_pay_memory_func_type;
+
+       struct  module_info{
+               unsigned int    ref_count;
+               protocol_module_base*   (*module_create)(
+                                                                               logger_func_type,
+                                                                               replication_pay_memory_func_type);
+               void                                    (*module_restroy)(protocol_module_base*);
+       };
+
 protected:
+       std::map<std::string,int>       loadedmodule_map;
+       boost::mutex                            loadedmodule_map_mutex;
+
        schedule_module_control();
        schedule_module_control( const schedule_module_control& );
        schedule_module_control&        operator=( const schedule_module_control& );
+
 public:
        static schedule_module_control& getInstance();
 
@@ -29,8 +46,8 @@ public:
 
        schedule_module_base*   module_new(
                                                                std::string& modulename,
-                                                               boost::function< void ( const LOG_LEVEL_TAG, const std::string ) > inlog,
-                                                               boost::function< void ( std::string&, unsigned int* ) >  inpaymemory );
+                                                               logger_func_type        inlog,
+                                                               replication_pay_memory_func_type        inpaymemory );
        void    module_delete( schedule_module_base* module_ptr );
 };