📄 coder_factory.h
字号:
/*******************************************************************************++ LEDA 4.5 +++ coder_factory.h+++ Copyright (c) 1995-2004+ by Algorithmic Solutions Software GmbH+ All rights reserved.+ *******************************************************************************/// $Revision: 1.10 $ $Date: 2004/02/19 11:41:35 $#ifndef _LEDA_CODER_FACTORY_H#define _LEDA_CODER_FACTORY_H#if !defined(LEDA_ROOT_INCL_ID)#define LEDA_ROOT_INCL_ID 450353#include <LEDA/PREAMBLE.h>#endif#include <LEDA/impl/coder_base.h>#include <LEDA/list.h>#include <LEDA/h_array.h>#include <LEDA/list.h>#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__DECCXX)// work-around for MSVC 6.0 and CXX 5.1 (alpha)#define LEDA_COMPRESSION_WA3#endifLEDA_BEGIN_NAMESPACE/// coder_factory ///////////////////////////////////////////////////////////////////////////class __exportC coder_factory {public: typedef coder_base::id_type id_type; typedef coder_base* (*coder_construction_func)();public: coder_factory(); coder_base* construct_coder_by_id(id_type id); void register_id(id_type id, coder_construction_func ctor); list<coder_base*> get_all_coders(); list<coder_base*> get_standalone_coders(); void print_registered_coders(ostream& out = cout); // for debuggingprivate: void init(); void destroy();private: h_array<id_type, coder_construction_func>* pCoderConstructorMap;private:#if defined(LEDA_MULTI_THREAD) leda_mutex mutex_count; void lock() { mutex_count.lock(); } void unlock() { mutex_count.unlock(); }#else void lock() {} void unlock() {}#endif friend class coder_factory_init;};extern __exportD coder_factory CoderFactory;#ifndef LEDA_COMPRESSION_WA3template <class Coder>coder_base* coder_constructor() { return new Coder; }template <class Coder>class register_coder {public: register_coder() { CoderFactory.register_id(Coder::ID, &coder_constructor<Coder>); }};#endifclass __exportC coder_factory_init { static unsigned Count;public: coder_factory_init(); ~coder_factory_init();};static coder_factory_init _init_coder_factory_;#if LEDA_ROOT_INCL_ID == 450353#undef LEDA_ROOT_INCL_ID#include <LEDA/POSTAMBLE.h>#endifLEDA_END_NAMESPACE#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -