⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serialimpl.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 3 页
字号:
/* * =========================================================================== * PRODUCTION $Log: serialimpl.hpp,v $ * PRODUCTION Revision 1000.3  2004/04/12 17:15:44  gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.47 * PRODUCTION * =========================================================================== */#ifndef SERIALIMPL__HPP#define SERIALIMPL__HPP/*  $Id: serialimpl.hpp,v 1000.3 2004/04/12 17:15:44 gouriano Exp $* ===========================================================================**                            PUBLIC DOMAIN NOTICE*               National Center for Biotechnology Information**  This software/database is a "United States Government Work" under the*  terms of the United States Copyright Act.  It was written as part of*  the author's official duties as a United States Government employee and*  thus cannot be copyrighted.  This software/database is freely available*  to the public for use. The National Library of Medicine and the U.S.*  Government have not placed any restriction on its use or reproduction.**  Although all reasonable efforts have been taken to ensure the accuracy*  and reliability of the software and data, the NLM and the U.S.*  Government do not and cannot warrant the performance or results that*  may be obtained by using this software or data. The NLM and the U.S.*  Government disclaim all warranties, express or implied, including*  warranties of performance, merchantability or fitness for any particular*  purpose.**  Please cite the author in any work or product based on this material.** ===========================================================================** Author: Eugene Vasilchenko** File Description:*   File to be included in modules implementing GetTypeInfo methods.**/#include <corelib/ncbistd.hpp>#include <corelib/ncbiobj.hpp>#include <corelib/ncbithr.hpp>#include <serial/typeinfo.hpp>#include <serial/stdtypes.hpp>#include <serial/stltypes.hpp>#include <serial/ptrinfo.hpp>#include <serial/enumerated.hpp>#include <serial/classinfo.hpp>#include <serial/choice.hpp>#include <serial/choiceptr.hpp>#include <serial/autoptrinfo.hpp>#include <serial/serialbase.hpp>#include <serial/exception.hpp>#include <serial/classinfohelper.hpp>/** @addtogroup GenClassSupport * * @{ */struct valnode;BEGIN_NCBI_SCOPE// forward declarationclass CMemberInfo;class CClassTypeInfoBase;class CClassTypeInfo;class CChoiceTypeInfo;class CDelayBufferData;//// define type info getter for standard classestemplate<typename T>inlineTTypeInfoGetter GetStdTypeInfoGetter(const T* ){    return &CStdTypeInfo<T>::GetTypeInfo;}// some compilers cannot resolve overloading by// (char* const*) and (const char* const*) in template// so we'll add explicit implementations:inlineTTypeInfoGetter GetStdTypeInfoGetter(char* const* ){    return &CStdTypeInfo<char*>::GetTypeInfo;}inlineTTypeInfoGetter GetStdTypeInfoGetter(const char* const* ){    return &CStdTypeInfo<const char*>::GetTypeInfo;}// macros used in ADD_*_MEMBER macros to specify complex type// example: ADD_MEMBER(member, STL_set, (STD, (string)))#define SERIAL_TYPE(TypeMacro) NCBI_NAME2(SERIAL_TYPE_,TypeMacro)#define SERIAL_REF(TypeMacro) NCBI_NAME2(SERIAL_REF_,TypeMacro)#define SERIAL_TYPE_CLASS(ClassName) ClassName#define SERIAL_REF_CLASS(ClassName) &ClassName::GetTypeInfo#define SERIAL_TYPE_STD(CType) CType#define SERIAL_REF_STD(CType) &NCBI_NS_NCBI::CStdTypeInfo<CType>::GetTypeInfo#define SERIAL_TYPE_StringStore() NCBI_NS_STD::string#define SERIAL_REF_StringStore() \    &NCBI_NS_NCBI::CStdTypeInfo<string>::GetTypeInfoStringStore#define SERIAL_TYPE_null() bool#define SERIAL_REF_null() \    &NCBI_NS_NCBI::CStdTypeInfo<bool>::GetTypeInfoNullBool#define SERIAL_TYPE_ENUM(CType, EnumName) CType#define SERIAL_REF_ENUM(CType, EnumName) \    NCBI_NS_NCBI::CreateEnumeratedTypeInfo(CType(0), ENUM_METHOD_NAME(EnumName)())#define SERIAL_TYPE_ENUM_IN(CType, CppContext, EnumName) CppContext CType#define SERIAL_REF_ENUM_IN(CType, CppContext, EnumName) \    NCBI_NS_NCBI::CreateEnumeratedTypeInfo(CppContext CType(0), CppContext ENUM_METHOD_NAME(EnumName)())#define SERIAL_TYPE_POINTER(TypeMacro,TypeMacroArgs) \    SERIAL_TYPE(TypeMacro)TypeMacroArgs*#define SERIAL_REF_POINTER(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CPointerTypeInfo::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_multiset(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::multiset<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_multiset(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_multiset<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_set(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::set<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_set(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_set<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_multimap(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \    NCBI_NS_STD::multimap<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >#define SERIAL_REF_STL_multimap(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \    CTypeRef(&NCBI_NS_NCBI::CStlClassInfo_multimap<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)#define SERIAL_TYPE_STL_map(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \    NCBI_NS_STD::map<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >#define SERIAL_REF_STL_map(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \    CTypeRef(&NCBI_NS_NCBI::CStlClassInfo_map<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)#define SERIAL_TYPE_STL_list(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_list(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_list_set(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_list_set(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetSetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_vector(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_vector(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_vector_set(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_vector_set(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetSetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_CHAR_vector(CharType) NCBI_NS_STD::vector<CharType>#define SERIAL_REF_STL_CHAR_vector(CharType) \    &NCBI_NS_NCBI::CStdTypeInfo< SERIAL_TYPE(STL_CHAR_vector)(CharType) >::GetTypeInfo#define SERIAL_TYPE_STL_auto_ptr(TypeMacro,TypeMacroArgs) \    NCBI_NS_STD::auto_ptr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_auto_ptr(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CStlClassInfo_auto_ptr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_AutoPtr(TypeMacro,TypeMacroArgs) \    NCBI_NS_NCBI::AutoPtr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_AutoPtr(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CAutoPtrTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_CRef(TypeMacro,TypeMacroArgs) \    NCBI_NS_NCBI::CRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_CRef(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CRefTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_STL_CConstRef(TypeMacro,TypeMacroArgs) \    NCBI_NS_NCBI::CConstRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_STL_CConstRef(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CConstRefTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs#define SERIAL_TYPE_CHOICE(TypeMacro,TypeMacroArgs) \    SERIAL_TYPE(TypeMacro)TypeMacroArgs#define SERIAL_REF_CHOICE(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CChoicePointerTypeInfo::GetTypeInfo, \    SERIAL_REF(TypeMacro)TypeMacroArgs//#define SERIAL_TYPE_CHOICERef(ClassName) NCBI_NS_NCBI::CRef<ClassName>//#define SERIAL_REF_CHOICERef(ClassName) &ClassName::GetChoiceRefTypeInfo#define SERIAL_TYPE_CHOICERef(TypeMacro,TypeMacroArgs) \    NCBI_NS_NCBI::CRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >#define SERIAL_REF_CHOICERef(TypeMacro,TypeMacroArgs) \    &NCBI_NS_NCBI::CChoicePointerTypeInfo::GetTypeInfo, \    SERIAL_REF(TypeMacro)TypeMacroArgstemplate<typename T>struct Check{    static const void* Ptr(const T* member)        {            return member;        }    static const void* PtrPtr(T*const* member)        {            return member;        }    static const void* ObjectPtrPtr(T*const* member)        {            return member;        }    static const void* ObjectPtrPtr(CSerialObject*const* member)        {            return member;        }private:    Check(void);    ~Check(void);    Check(const Check<T>&);    Check<T>& operator=(const Check<T>&);};// Functions preventing memory leaks due to undestroyed type info objectsNCBI_XSERIAL_EXPORTvoid RegisterEnumTypeValuesObject(CEnumeratedTypeValues* object);NCBI_XSERIAL_EXPORTvoid RegisterTypeInfoObject(CTypeInfo* object);template<typename T>inlineTTypeInfo EnumTypeInfo(const T* member, const CEnumeratedTypeValues* enumInfo)

⌨️ 快捷键说明

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