#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;
};
#define PROTOCOL_MODULE_CONTROL
#include<string>
+#include<boost/thread/locks.hpp>
#include"logger.h"
#include "realserver.h"
#include "protocol_module_base.h"
{
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 );
};
#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();
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 );
};