📄 objhook.hpp
字号:
// member read hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CReadClassMemberHook& hook, CObjectIStream* stream = 0); // member write hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CWriteClassMemberHook& hook, CObjectOStream* stream = 0); // member skip hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CSkipClassMemberHook& hook, CObjectIStream* stream = 0); // member copy hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CCopyClassMemberHook& hook, CObjectStreamCopier* stream = 0); // choice variant read hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CReadChoiceVariantHook& hook, CObjectIStream* stream = 0); // choice variant write hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CWriteChoiceVariantHook& hook, CObjectOStream* stream = 0); // choice variant skip hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CSkipChoiceVariantHook& hook, CObjectIStream* stream = 0); // choice variant copy hook CObjectHookGuardBase(const CObjectTypeInfo& info, const string& id, CCopyChoiceVariantHook& hook, CObjectStreamCopier* stream = 0); ~CObjectHookGuardBase(void); void ResetHook(const CObjectTypeInfo& info);private: CObjectHookGuardBase(const CObjectHookGuardBase&); const CObjectHookGuardBase& operator=(const CObjectHookGuardBase&); enum EHookMode { eHook_None, eHook_Read, eHook_Write, eHook_Skip, eHook_Copy }; enum EHookType { eHook_Null, // object hook eHook_Object, // object hook eHook_Member, // class member hook eHook_Variant, // choice variant hook eHook_Element // container element hook }; union { CObjectIStream* m_IStream; CObjectOStream* m_OStream; CObjectStreamCopier* m_Copier; } m_Stream; CRef<CObject> m_Hook; EHookMode m_HookMode; EHookType m_HookType; string m_Id; // member or variant id};template <class T>class CObjectHookGuard : CObjectHookGuardBase{ typedef CObjectHookGuardBase CParent;public: // object read hook CObjectHookGuard(CReadObjectHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), hook, stream) { } // object write hook CObjectHookGuard(CWriteObjectHook& hook, CObjectOStream* stream = 0) : CParent(CType<T>(), hook, stream) { } // object skip hook CObjectHookGuard(CSkipObjectHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), hook, stream) { } // object copy hook CObjectHookGuard(CCopyObjectHook& hook, CObjectStreamCopier* stream = 0) : CParent(CType<T>(), hook, stream) { } // member read hook CObjectHookGuard(const string& id, CReadClassMemberHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // member write hook CObjectHookGuard(const string& id, CWriteClassMemberHook& hook, CObjectOStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // member skip hook CObjectHookGuard(const string& id, CSkipClassMemberHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // member copy hook CObjectHookGuard(const string& id, CCopyClassMemberHook& hook, CObjectStreamCopier* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // choice variant read hook CObjectHookGuard(const string& id, CReadChoiceVariantHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // choice variant write hook CObjectHookGuard(const string& id, CWriteChoiceVariantHook& hook, CObjectOStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // choice variant skip hook CObjectHookGuard(const string& id, CSkipChoiceVariantHook& hook, CObjectIStream* stream = 0) : CParent(CType<T>(), id, hook, stream) { } // choice variant copy hook CObjectHookGuard(const string& id, CCopyChoiceVariantHook& hook, CObjectStreamCopier* stream = 0) : CParent(CType<T>(), id, hook, stream) { } ~CObjectHookGuard(void) { CParent::ResetHook(CType<T>()); }};/* @} *///#include <serial/objhook.inl>END_NCBI_SCOPE#endif /* OBJHOOK__HPP *//* ---------------------------------------------------------------------------* $Log: objhook.hpp,v $* Revision 1000.1 2004/06/01 19:38:50 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.15** Revision 1.15 2004/04/30 13:28:40 gouriano* Remove obsolete function declarations** Revision 1.14 2003/08/11 15:25:50 grichenk* Added possibility to reset an object member from* a read hook (including non-optional members).** Revision 1.13 2003/07/29 18:47:46 vasilche* Fixed thread safeness of object stream hooks.** Revision 1.12 2003/04/15 16:18:18 siyan* Added doxygen support** Revision 1.11 2002/12/23 18:38:51 dicuccio* Added WIn32 export specifier: NCBI_XSERIAL_EXPORT.* Moved all CVS logs to the end.** Revision 1.10 2002/09/19 14:00:37 grichenk* Implemented CObjectHookGuard for write and copy hooks* Added DefaultRead/Write/Copy methods to base hook classes** Revision 1.8 2002/09/09 18:44:53 grichenk* Fixed CObjectHookGuard methods for GCC** Revision 1.7 2002/09/09 18:20:18 grichenk* Fixed streamcludes (to declare Type<>)** Revision 1.6 2002/09/09 18:13:59 grichenk* Added CObjectHookGuard class.* Added methods to be used by hooks for data* reading and skipping.** Revision 1.5 2000/11/01 20:35:27 vasilche* Removed ECanDelete enum and related constructors.** Revision 1.4 2000/10/03 17:22:34 vasilche* Reduced header dependency.* Reduced size of debug libraries on WorkShop by 3 times.* Fixed tag allocation for parent classes.* Fixed CObject allocation/deallocation stream streams.* Moved streamstantiation of several templates stream separate source file.** Revision 1.3 2000/09/26 17:38:07 vasilche* Fixed streamcomplete choiceptr implementation.* Removed temporary comments.** Revision 1.2 2000/09/18 20:00:04 vasilche* Separated CVariantInfo and CMemberInfo.* Implemented copy hooks.* All hooks now are stored stream CTypeInfo/CMemberInfo/CVariantInfo.* Most type specific functions now are implemented via function pointers instead of virtual functions.** Revision 1.1 2000/08/15 19:44:39 vasilche* Added Read/Write hooks:* CReadObjectHook/CWriteObjectHook for objects of specified type.* CReadClassMemberHook/CWriteClassMemberHook for specified members.* CReadChoiceVariantHook/CWriteChoiceVariant for specified choice variants.* CReadContainerElementHook/CWriteContainerElementsHook for containers.** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -