dynamicfactory.h

来自「网络游戏通用架构, 这是基于boost和libevent写的一个程序」· C头文件 代码 · 共 43 行

H
43
字号
#ifndef DYNAMICFACTORY_H
#define DYNAMICFACTORY_H

#include <stddef.h>
#include <string>

#include "common.h"
#include "dynamiclibrary.h"

using namespace std;

class Factory;

typedef Factory* (*GetFactoryFunc)(void);

class EXPORT DynamicFactory
{
public:
    DynamicFactory( const string& __filename, const string& __getFactory_func_name= "getFactory" );
    ~DynamicFactory();
public:
    bool load(void);//return true if succeeded
    void* newInstance( const string& __name );    void* newInstance( const int __type );    void parse_types( string& __typetab_filename );    void unload(void);
    const string& getFilename(void) const
    {
        return _filename;
    }
    const string& getGetFactoryFuncName(void) const
    {
        return _getFactory_func_name;
    }
protected:
    const string _filename;
    const string _getFactory_func_name;
    DynamicLibrary _lib;
    Factory* _factory;
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?