1 #ifndef SERIALIMPL__HPP
2 #define SERIALIMPL__HPP
63 class CDelayBufferData;
93 #define SERIAL_TYPE(TypeMacro) NCBI_NAME2(SERIAL_TYPE_,TypeMacro)
94 #define SERIAL_REF(TypeMacro) NCBI_NAME2(SERIAL_REF_,TypeMacro)
96 #define SERIAL_TYPE_CLASS(ClassName) ClassName
97 #define SERIAL_REF_CLASS(ClassName) &ClassName::GetTypeInfo
99 #define SERIAL_TYPE_STD(CType) CType
100 #define SERIAL_REF_STD(CType) &NCBI_NS_NCBI::CStdTypeInfo<CType>::GetTypeInfo
102 #define SERIAL_TYPE_StringStore() NCBI_NS_STD::string
103 #define SERIAL_REF_StringStore() \
104 &NCBI_NS_NCBI::CStdTypeInfo<string>::GetTypeInfoStringStore
106 #define SERIAL_TYPE_null() bool
107 #define SERIAL_REF_null() \
108 &NCBI_NS_NCBI::CStdTypeInfo<bool>::GetTypeInfoNullBool
110 #define SERIAL_TYPE_CStringUTF8() NCBI_NS_NCBI::CStringUTF8
111 #define SERIAL_REF_CStringUTF8() \
112 &NCBI_NS_NCBI::CStdTypeInfo<NCBI_NS_NCBI::utf8_string_type>::GetTypeInfo
114 #define SERIAL_TYPE_BigInt() Int8
115 #define SERIAL_REF_BigInt() \
116 &NCBI_NS_NCBI::CStdTypeInfo<NCBI_NS_NCBI::bigint_type>::GetTypeInfo
118 #define SERIAL_TYPE_ENUM(CType, EnumName) CType
119 #define SERIAL_REF_ENUM(CType, EnumName) \
120 NCBI_NS_NCBI::CreateEnumeratedTypeInfo(CType(0), ENUM_METHOD_NAME(EnumName)())
122 #define SERIAL_TYPE_ENUM_IN(CType, CppContext, EnumName) CppContext CType
123 #define SERIAL_REF_ENUM_IN(CType, CppContext, EnumName) \
124 NCBI_NS_NCBI::CreateEnumeratedTypeInfo(CppContext CType(0), CppContext ENUM_METHOD_NAME(EnumName)())
126 #define SERIAL_TYPE_POINTER(TypeMacro,TypeMacroArgs) \
127 SERIAL_TYPE(TypeMacro)TypeMacroArgs*
128 #define SERIAL_REF_POINTER(TypeMacro,TypeMacroArgs) \
129 &NCBI_NS_NCBI::CPointerTypeInfo::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
131 #define SERIAL_TYPE_STL_multiset(TypeMacro,TypeMacroArgs) \
132 NCBI_NS_STD::multiset<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
133 #define SERIAL_REF_STL_multiset(TypeMacro,TypeMacroArgs) \
134 &NCBI_NS_NCBI::CStlClassInfo_multiset<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
136 #define SERIAL_TYPE_STL_set(TypeMacro,TypeMacroArgs) \
137 NCBI_NS_STD::set<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
138 #define SERIAL_REF_STL_set(TypeMacro,TypeMacroArgs) \
139 &NCBI_NS_NCBI::CStlClassInfo_set<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
141 #define SERIAL_TYPE_STL_multiset2(TypeMacro,TypeMacroArgs,ComparatorType) \
142 NCBI_NS_STD::multiset<SERIAL_TYPE(TypeMacro)TypeMacroArgs, ComparatorType >
143 #define SERIAL_REF_STL_multiset2(TypeMacro,TypeMacroArgs,ComparatorType) \
144 &NCBI_NS_NCBI::CStlClassInfo_multiset2<SERIAL_TYPE(TypeMacro)TypeMacroArgs,ComparatorType >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
146 #define SERIAL_TYPE_STL_set2(TypeMacro,TypeMacroArgs,ComparatorType) \
147 NCBI_NS_STD::set<SERIAL_TYPE(TypeMacro)TypeMacroArgs,ComparatorType >
148 #define SERIAL_REF_STL_set2(TypeMacro,TypeMacroArgs,ComparatorType) \
149 &NCBI_NS_NCBI::CStlClassInfo_set2<SERIAL_TYPE(TypeMacro)TypeMacroArgs,ComparatorType >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
151 #define SERIAL_TYPE_STL_multimap(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \
152 NCBI_NS_STD::multimap<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >
153 #define SERIAL_REF_STL_multimap(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \
154 CTypeRef(&NCBI_NS_NCBI::CStlClassInfo_multimap<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)
156 #define SERIAL_TYPE_STL_map(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \
157 NCBI_NS_STD::map<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >
158 #define SERIAL_REF_STL_map(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs) \
159 CTypeRef(&NCBI_NS_NCBI::CStlClassInfo_map<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)
161 #define SERIAL_TYPE_STL_multimap3(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs,ComparatorType) \
162 NCBI_NS_STD::multimap<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs, ComparatorType >
163 #define SERIAL_REF_STL_multimap3(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs,ComparatorType) \
164 CTypeRef(NCBI_NS_NCBI::CStlClassInfo_multimap3<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs,ComparatorType >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)
166 #define SERIAL_TYPE_STL_map3(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs,ComparatorType) \
167 NCBI_NS_STD::map<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs, ComparatorType >
168 #define SERIAL_REF_STL_map3(KeyTypeMacro,KeyTypeMacroArgs,ValueTypeMacro,ValueTypeMacroArgs,ComparatorType) \
169 CTypeRef(NCBI_NS_NCBI::CStlClassInfo_map3<SERIAL_TYPE(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_TYPE(ValueTypeMacro)ValueTypeMacroArgs,ComparatorType >::GetTypeInfo, SERIAL_REF(KeyTypeMacro)KeyTypeMacroArgs,SERIAL_REF(ValueTypeMacro)ValueTypeMacroArgs)
171 #define SERIAL_TYPE_STL_list(TypeMacro,TypeMacroArgs) \
172 NCBI_NS_STD::list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
173 #define SERIAL_REF_STL_list(TypeMacro,TypeMacroArgs) \
174 &NCBI_NS_NCBI::CStlClassInfo_list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
176 #define SERIAL_TYPE_STL_list_set(TypeMacro,TypeMacroArgs) \
177 NCBI_NS_STD::list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
178 #define SERIAL_REF_STL_list_set(TypeMacro,TypeMacroArgs) \
179 &NCBI_NS_NCBI::CStlClassInfo_list<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetSetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
181 #define SERIAL_TYPE_STL_vector(TypeMacro,TypeMacroArgs) \
182 NCBI_NS_STD::vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
183 #define SERIAL_REF_STL_vector(TypeMacro,TypeMacroArgs) \
184 &NCBI_NS_NCBI::CStlClassInfo_vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
186 #define SERIAL_TYPE_STL_vector_set(TypeMacro,TypeMacroArgs) \
187 NCBI_NS_STD::vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
188 #define SERIAL_REF_STL_vector_set(TypeMacro,TypeMacroArgs) \
189 &NCBI_NS_NCBI::CStlClassInfo_vector<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetSetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
191 #define SERIAL_TYPE_STL_CHAR_vector(CharType) NCBI_NS_STD::vector<CharType>
192 #define SERIAL_REF_STL_CHAR_vector(CharType) \
193 &NCBI_NS_NCBI::CStdTypeInfo< SERIAL_TYPE(STL_CHAR_vector)(CharType) >::GetTypeInfo
195 #define SERIAL_TYPE_STL_auto_ptr(TypeMacro,TypeMacroArgs) \
196 NCBI_NS_STD::shared_ptr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
197 #define SERIAL_REF_STL_auto_ptr(TypeMacro,TypeMacroArgs) \
198 &NCBI_NS_NCBI::CStlClassInfo_auto_ptr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
200 #define SERIAL_TYPE_STL_AutoPtr(TypeMacro,TypeMacroArgs) \
201 NCBI_NS_NCBI::AutoPtr<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
202 #define SERIAL_REF_STL_AutoPtr(TypeMacro,TypeMacroArgs) \
203 &NCBI_NS_NCBI::CAutoPtrTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
205 #define SERIAL_TYPE_STL_CRef(TypeMacro,TypeMacroArgs) \
206 NCBI_NS_NCBI::CRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
207 #define SERIAL_REF_STL_CRef(TypeMacro,TypeMacroArgs) \
208 &NCBI_NS_NCBI::CRefTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
210 #define SERIAL_TYPE_STL_CConstRef(TypeMacro,TypeMacroArgs) \
211 NCBI_NS_NCBI::CConstRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
212 #define SERIAL_REF_STL_CConstRef(TypeMacro,TypeMacroArgs) \
213 &NCBI_NS_NCBI::CConstRefTypeInfo<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::GetTypeInfo, SERIAL_REF(TypeMacro)TypeMacroArgs
215 #define SERIAL_TYPE_CHOICE(TypeMacro,TypeMacroArgs) \
216 SERIAL_TYPE(TypeMacro)TypeMacroArgs
217 #define SERIAL_REF_CHOICE(TypeMacro,TypeMacroArgs) \
218 &NCBI_NS_NCBI::CChoicePointerTypeInfo::GetTypeInfo, \
219 SERIAL_REF(TypeMacro)TypeMacroArgs
223 #define SERIAL_TYPE_CHOICERef(TypeMacro,TypeMacroArgs) \
224 NCBI_NS_NCBI::CRef<SERIAL_TYPE(TypeMacro)TypeMacroArgs >
225 #define SERIAL_REF_CHOICERef(TypeMacro,TypeMacroArgs) \
226 &NCBI_NS_NCBI::CChoicePointerTypeInfo::GetTypeInfo, \
227 SERIAL_REF(TypeMacro)TypeMacroArgs
233 static const void*
Ptr(
const T* member)
274 #define XSERIAL_TYPEINFO_WRITELOCK NCBI_NS_NCBI::CWriteLockGuard GUARD(NCBI_NS_NCBI::GetTypeInfoLock())
275 #define XSERIAL_TYPEINFO_READLOCK NCBI_NS_NCBI::CReadLockGuard GUARD(NCBI_NS_NCBI::GetTypeInfoLock())
277 #define XSERIAL_TYPEINFO_WRITELOCK NCBI_NS_NCBI::CMutexGuard GUARD(NCBI_NS_NCBI::GetTypeInfoMutex())
278 #define XSERIAL_TYPEINFO_READLOCK NCBI_NS_NCBI::CMutexGuard GUARD(NCBI_NS_NCBI::GetTypeInfoMutex())
282 #define DECLARE_BASE_OBJECT(ClassName) ClassName* base = 0
283 #define BASE_OBJECT() static_cast<const CClass_Base*>(base)
284 #define MEMBER_PTR(MemberName) &BASE_OBJECT()->MemberName
285 #define CLASS_PTR(ClassName) static_cast<const ClassName*>(BASE_OBJECT())
287 #define BEGIN_BASE_TYPE_INFO(ClassName,BaseClassName,Method,InfoType,Code) \
288 const NCBI_NS_NCBI::CTypeInfo* Method(void) \
290 typedef ClassName CClass; \
291 typedef BaseClassName CClass_Base; \
292 static std::atomic<InfoType*> s_info; \
293 InfoType* info = s_info.load(std::memory_order_acquire); \
295 XSERIAL_TYPEINFO_WRITELOCK; \
296 info = s_info.load(std::memory_order_acquire); \
298 DECLARE_BASE_OBJECT(CClass); \
300 NCBI_NS_NCBI::RegisterTypeInfoObject(info);
301 #define BEGIN_TYPE_INFO(ClassName, Method, InfoType, Code) \
302 BEGIN_BASE_TYPE_INFO(ClassName, ClassName, Method, InfoType, Code)
304 #define END_TYPE_INFO \
305 s_info.store(info, std::memory_order_release); \
311 #define END_STRUCT_INFO \
312 info->AssignItemsTags(); \
317 #define SERIAL_MEMBER(MemberName,TypeMacro,TypeMacroArgs) \
318 NCBI_NS_NCBI::Check<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::Ptr(MEMBER_PTR(MemberName)), SERIAL_REF(TypeMacro)TypeMacroArgs
319 #define SERIAL_BUF_MEMBER(MemberName,TypeMacro,TypeMacroArgs) \
320 NCBI_NS_NCBI::Check<NCBI_NS_NCBI::CUnionBuffer<SERIAL_TYPE(TypeMacro)TypeMacroArgs > >::Ptr(MEMBER_PTR(MemberName)), SERIAL_REF(TypeMacro)TypeMacroArgs
321 #define SERIAL_STD_MEMBER(MemberName) \
322 MEMBER_PTR(MemberName),NCBI_NS_NCBI::GetStdTypeInfoGetter(MEMBER_PTR(MemberName))
323 #define SERIAL_CLASS_MEMBER(MemberName) \
324 MEMBER_PTR(MemberName),&MEMBER_PTR(MemberName).GetTypeInfo
325 #define SERIAL_ENUM_MEMBER(MemberName,EnumName) \
326 MEMBER_PTR(MemberName), NCBI_NS_NCBI::EnumTypeInfo(MEMBER_PTR(MemberName), ENUM_METHOD_NAME(EnumName)())
327 #define SERIAL_ENUM_IN_MEMBER(MemberName,CppContext,EnumName) \
328 MEMBER_PTR(MemberName), NCBI_NS_NCBI::EnumTypeInfo(MEMBER_PTR(MemberName),CppContext ENUM_METHOD_NAME(EnumName)())
329 #define SERIAL_REF_MEMBER(MemberName,ClassName) \
330 SERIAL_MEMBER(MemberName,STL_CRef,(CLASS,(ClassName)))
331 #define SERIAL_PTR_CHOICE_VARIANT(MemberName,TypeMacro,TypeMacroArgs) \
332 NCBI_NS_NCBI::Check<SERIAL_TYPE(TypeMacro)TypeMacroArgs >::PtrPtr(MEMBER_PTR(MemberName)), SERIAL_REF(TypeMacro)TypeMacroArgs
333 #define SERIAL_REF_CHOICE_VARIANT(MemberName,ClassName) \
334 NCBI_NS_NCBI::Check<SERIAL_TYPE(CLASS)(ClassName)>::ObjectPtrPtr(MEMBER_PTR(MemberName)), SERIAL_REF(CLASS)(ClassName)
335 #define SERIAL_BASE_CLASS(ClassName) \
336 CLASS_PTR(ClassName),&(CLASS_PTR(ClassName)->GetTypeInfo)
339 #define ADD_NAMED_NULL_MEMBER(MemberAlias,TypeMacro,TypeMacroArgs) \
340 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
341 BASE_OBJECT(),SERIAL_REF(TypeMacro)TypeMacroArgs)
342 #define ADD_NAMED_MEMBER(MemberAlias,MemberName,TypeMacro,TypeMacroArgs) \
343 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
344 SERIAL_MEMBER(MemberName,TypeMacro,TypeMacroArgs))
345 #define ADD_NAMED_STD_MEMBER(MemberAlias,MemberName) \
346 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
347 SERIAL_STD_MEMBER(MemberName))
348 #define ADD_NAMED_CLASS_MEMBER(MemberAlias,MemberName) \
349 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
350 SERIAL_CLASS_MEMBER(MemberName))
351 #define ADD_NAMED_ENUM_MEMBER(MemberAlias,MemberName,EnumName) \
352 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
353 SERIAL_ENUM_MEMBER(MemberName,EnumName))
354 #define ADD_NAMED_ENUM_IN_MEMBER(MemberAlias,MemberName,CppContext,EnumName) \
355 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
356 SERIAL_ENUM_IN_MEMBER(MemberName,CppContext,EnumName))
357 #define ADD_NAMED_REF_MEMBER(MemberAlias,MemberName,ClassName) \
358 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
359 SERIAL_REF_MEMBER(MemberName,ClassName))
360 #define ADD_NAMED_BASE_CLASS(MemberAlias,ClassName) \
361 NCBI_NS_NCBI::AddMember(info,MemberAlias, \
362 SERIAL_BASE_CLASS(ClassName))
365 #define ADD_MEMBER(MemberName,TypeMacro,TypeMacroArgs) \
366 ADD_NAMED_MEMBER(#MemberName,MemberName,TypeMacro,TypeMacroArgs)
367 #define ADD_STD_MEMBER(MemberName) \
368 ADD_NAMED_STD_MEMBER(#MemberName,MemberName)
369 #define ADD_CLASS_MEMBER(MemberName) \
370 ADD_NAMED_CLASS_MEMBER(#MemberName,MemberName)
371 #define ADD_ENUM_MEMBER(MemberName,EnumName) \
372 ADD_NAMED_ENUM_MEMBER(#MemberName,MemberName,EnumName)
373 #define ADD_ENUM_IN_MEMBER(MemberName,CppContext,EnumName) \
374 ADD_NAMED_ENUM_MEMBER(#MemberName,MemberName,CppContext,EnumName)
375 #define ADD_REF_MEMBER(MemberName,ClassName) \
376 ADD_NAMED_REF_MEMBER(#MemberName,MemberName,ClassName)
379 #define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias,TypeMacro,TypeMacroArgs) \
380 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
381 BASE_OBJECT(),SERIAL_REF(TypeMacro)TypeMacroArgs)
382 #define ADD_NAMED_CHOICE_VARIANT(MemberAlias,MemberName,TypeMacro,TypeMacroArgs) \
383 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
384 SERIAL_MEMBER(MemberName,TypeMacro,TypeMacroArgs))
385 #define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias,MemberName,TypeMacro,TypeMacroArgs) \
386 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
387 SERIAL_BUF_MEMBER(MemberName,TypeMacro,TypeMacroArgs))
388 #define ADD_NAMED_STD_CHOICE_VARIANT(MemberAlias,MemberName) \
389 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
390 SERIAL_STD_MEMBER(MemberName))
391 #define ADD_NAMED_ENUM_CHOICE_VARIANT(MemberAlias,MemberName,EnumName) \
392 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
393 SERIAL_ENUM_MEMBER(MemberName,EnumName))
394 #define ADD_NAMED_ENUM_IN_CHOICE_VARIANT(MemberAlias,MemberName,CppContext,EnumName) \
395 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
396 SERIAL_ENUM_IN_MEMBER(MemberName,CppContext,EnumName))
397 #define ADD_NAMED_PTR_CHOICE_VARIANT(MemberAlias,MemberName,TypeMacro,TypeMacroArgs) \
398 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
399 SERIAL_PTR_CHOICE_VARIANT(MemberName,TypeMacro,TypeMacroArgs))->SetPointer()
400 #define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias,MemberName,ClassName) \
401 NCBI_NS_NCBI::AddVariant(info,MemberAlias, \
402 SERIAL_REF_CHOICE_VARIANT(MemberName,ClassName))->SetObjectPointer()
405 #define ADD_CHOICE_VARIANT(MemberName,TypeMacro,TypeMacroArgs) \
406 ADD_NAMED_CHOICE_VARIANT(#MemberName,MemberName,TypeMacro,TypeMacroArgs)
407 #define ADD_STD_CHOICE_VARIANT(MemberName) \
408 ADD_NAMED_STD_CHOICE_VARIANT(#MemberName,MemberName)
409 #define ADD_ENUM_CHOICE_VARIANT(MemberName,EnumName) \
410 ADD_NAMED_ENUM_CHOICE_VARIANT(#MemberName,MemberName,EnumName)
411 #define ADD_ENUM_IN_CHOICE_VARIANT(MemberName,CppContext,EnumName) \
412 ADD_NAMED_ENUM_IN_CHOICE_VARIANT(#MemberName,MemberName,CppContext,EnumName)
413 #define ADD_PTR_CHOICE_VARIANT(MemberName,TypeMacro,TypeMacroArgs) \
414 ADD_NAMED_PTR_CHOICE_VARIANT(#MemberName,MemberName,TypeMacro,TypeMacroArgs)
415 #define ADD_REF_CHOICE_VARIANT(MemberName,ClassName) \
416 ADD_NAMED_REF_CHOICE_VARIANT(#MemberName,MemberName,ClassName)
419 #define BEGIN_NAMED_CLASS_INFO(ClassAlias,ClassName) \
420 BEGIN_TYPE_INFO(ClassName, \
421 ClassName::GetTypeInfo, \
422 NCBI_NS_NCBI::CClassTypeInfo, \
423 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateClassInfo(ClassAlias))
424 #define BEGIN_CLASS_INFO(ClassName) \
425 BEGIN_NAMED_CLASS_INFO(#ClassName, ClassName)
426 #define BEGIN_NAMED_BASE_CLASS_INFO(ClassAlias,ClassName) \
427 BEGIN_BASE_TYPE_INFO(ClassName, NCBI_NAME2(ClassName,_Base), \
428 NCBI_NAME2(ClassName,_Base)::GetTypeInfo, \
429 NCBI_NS_NCBI::CClassTypeInfo, \
430 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateClassInfo(ClassAlias))
431 #define BEGIN_BASE_CLASS_INFO(ClassName) \
432 BEGIN_NAMED_BASE_CLASS_INFO(#ClassName, ClassName)
434 #define SET_CLASS_IMPLICIT() info->SetImplicit()
435 #define BEGIN_NAMED_IMPLICIT_CLASS_INFO(ClassAlias,ClassName) \
436 BEGIN_NAMED_CLASS_INFO(ClassAlias,ClassName); SET_CLASS_IMPLICIT();
437 #define BEGIN_IMPLICIT_CLASS_INFO(ClassName) \
438 BEGIN_CLASS_INFO(ClassName); SET_CLASS_IMPLICIT();
439 #define BEGIN_NAMED_BASE_IMPLICIT_CLASS_INFO(ClassAlias,ClassName) \
440 BEGIN_NAMED_BASE_CLASS_INFO(ClassAlias,ClassName); SET_CLASS_IMPLICIT();
441 #define BEGIN_BASE_IMPLICIT_CLASS_INFO(ClassName) \
442 BEGIN_BASE_CLASS_INFO(ClassName); SET_CLASS_IMPLICIT();
444 #define SET_CLASS_MODULE(ModuleName) \
445 NCBI_NS_NCBI::SetModuleName(info, ModuleName)
447 #define SET_INTERNAL_NAME(OwnerName, MemberName) \
448 NCBI_NS_NCBI::SetInternalName(info, OwnerName, MemberName)
450 #define SET_NAMESPACE(name) \
451 info->SetNamespaceName(name)
453 #define SET_ASN_TAGGED_TYPE_INFO(method, args) \
456 #define END_CLASS_INFO \
457 NCBI_NS_NCBI::CClassInfoHelper<CClass>::SetReadWriteMemberMethods(info); \
460 #define BEGIN_NAMED_ABSTRACT_CLASS_INFO(ClassAlias,ClassName) \
461 BEGIN_TYPE_INFO(ClassName, \
462 ClassName::GetTypeInfo, \
463 NCBI_NS_NCBI::CClassTypeInfo, \
464 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateAbstractClassInfo(ClassAlias))
465 #define BEGIN_ABSTRACT_CLASS_INFO(ClassName) \
466 BEGIN_NAMED_ABSTRACT_CLASS_INFO(#ClassName, ClassName)
467 #define BEGIN_NAMED_ABSTRACT_BASE_CLASS_INFO(ClassAlias,ClassName) \
468 BEGIN_BASE_TYPE_INFO(ClassName, NCBI_NAME2(ClassName,_Base), \
469 NCBI_NAME2(ClassName,_Base)::GetTypeInfo, \
470 NCBI_NS_NCBI::CClassTypeInfo, \
471 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateAbstractClassInfo(ClassAlias))
473 #define END_ABSTRACT_CLASS_INFO \
476 #define BEGIN_NAMED_DERIVED_CLASS_INFO(ClassAlias,ClassName,ParentClassName) \
477 BEGIN_NAMED_CLASS_INFO(ClassAlias,ClassName) \
478 SET_PARENT_CLASS(ParentClassName);
479 #define BEGIN_DERIVED_CLASS_INFO(ClassName,ParentClassName) \
480 BEGIN_NAMED_DERIVED_CLASS_INFO(#ClassName, ClassName, ParentClassName)
482 #define END_DERIVED_CLASS_INFO \
485 #define BEGIN_NAMED_CHOICE_INFO(ClassAlias,ClassName) \
486 BEGIN_TYPE_INFO(ClassName, \
487 ClassName::GetTypeInfo, \
488 NCBI_NS_NCBI::CChoiceTypeInfo, \
489 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateChoiceInfo(ClassAlias))
490 #define BEGIN_CHOICE_INFO(ClassName) \
491 BEGIN_NAMED_CHOICE_INFO(#ClassName, ClassName)
492 #define BEGIN_NAMED_BASE_CHOICE_INFO(ClassAlias,ClassName) \
493 BEGIN_BASE_TYPE_INFO(ClassName, NCBI_NAME2(ClassName,_Base), \
494 NCBI_NAME2(ClassName,_Base)::GetTypeInfo, \
495 NCBI_NS_NCBI::CChoiceTypeInfo, \
496 NCBI_NS_NCBI::CClassInfoHelper<CClass>::CreateChoiceInfo(ClassAlias))
497 #define BEGIN_BASE_CHOICE_INFO(ClassName) \
498 BEGIN_NAMED_BASE_CHOICE_INFO(#ClassName, ClassName)
500 #define SET_CHOICE_MODULE(ModuleName) \
501 NCBI_NS_NCBI::SetModuleName(info, ModuleName)
503 #define SET_CHOICE_DELAYED() \
504 info->SetSelectDelay(&NCBI_NS_NCBI::CClassInfoHelper<CClass>::SelectDelayBuffer)
506 #define END_CHOICE_INFO \
507 NCBI_NS_NCBI::CClassInfoHelper<CClass>::SetReadWriteVariantMethods(info); \
508 info->SetSelectorInfo(MEMBER_PTR(m_choice), sizeof(BASE_OBJECT()->m_choice)); \
512 #define SET_PARENT_CLASS(ParentClassName) \
513 info->SetParentClass(ParentClassName::GetTypeInfo())
514 #define ADD_NAMED_SUB_CLASS(SubClassAlias, SubClassName) \
515 info->AddSubClass(SubClassAlias, &SubClassName::GetTypeInfo)
516 #define ADD_SUB_CLASS(SubClassName) \
517 ADD_NAMED_SUB_CLASS(#SubClassName, SubClassName)
518 #define ADD_NAMED_NULL_SUB_CLASS(ClassAlias) \
519 info->AddSubClassNull(ClassAlias)
520 #define ADD_NULL_SUB_CLASS(ClassAlias) \
521 ADD_NAMED_NULL_SUB_CLASS("NULL")
524 #define BEGIN_ENUM_INFO_METHOD(MethodName, EnumAlias, EnumName, IsInteger) \
525 const NCBI_NS_NCBI::CEnumeratedTypeValues* MethodName(void) \
527 static NCBI_NS_NCBI::CEnumeratedTypeValues* volatile s_enumInfo = 0; \
528 NCBI_NS_NCBI::CEnumeratedTypeValues* enumInfo = s_enumInfo; \
530 XSERIAL_TYPEINFO_WRITELOCK; \
531 enumInfo = s_enumInfo; \
533 enumInfo = new NCBI_NS_NCBI::CEnumeratedTypeValues(EnumAlias, IsInteger); \
534 NCBI_NS_NCBI::RegisterEnumTypeValuesObject(enumInfo); \
536 #define END_ENUM_INFO_METHOD \
537 s_enumInfo = enumInfo; \
543 #define BEGIN_NAMED_ENUM_IN_INFO(EnumAlias, CppContext, EnumName, IsInteger) \
544 BEGIN_ENUM_INFO_METHOD(CppContext ENUM_METHOD_NAME(EnumName), EnumAlias, EnumName, IsInteger)
545 #define BEGIN_NAMED_ENUM_INFO(EnumAlias, EnumName, IsInteger) \
546 BEGIN_ENUM_INFO_METHOD(ENUM_METHOD_NAME(EnumName), EnumAlias, EnumName, IsInteger)
548 #define BEGIN_ENUM_IN_INFO(CppContext, EnumName, IsInteger) \
549 BEGIN_NAMED_ENUM_IN_INFO(#EnumName, CppContext, EnumName, IsInteger)
550 #define BEGIN_ENUM_INFO(EnumName, IsInteger) \
551 BEGIN_NAMED_ENUM_INFO(#EnumName, EnumName, IsInteger)
553 #define SET_ENUM_MODULE(ModuleName) \
554 NCBI_NS_NCBI::SetModuleName(enumInfo, ModuleName)
556 #define SET_ENUM_BITSET \
557 enumInfo->SetBitset()
559 #define SET_ENUM_INTERNAL_NAME(OwnerName, MemberName) \
560 NCBI_NS_NCBI::SetInternalName(enumInfo, OwnerName, MemberName)
562 #define ADD_ENUM_VALUE(EnumValueName, EnumValueValue) \
563 enumInfo->AddValue(EnumValueName, enumValue = EnumValueValue)
565 #define ADD_ENUM_VALUE_FLAGS(EnumValueName, EnumValueValue, EnumValueFlags) \
566 enumInfo->AddValue(EnumValueName, enumValue = EnumValueValue, EnumValueFlags)
568 #define END_ENUM_IN_INFO END_ENUM_INFO_METHOD
569 #define END_ENUM_INFO END_ENUM_INFO_METHOD
572 #define SERIAL_ALIAS(RefType) \
573 NCBI_NAME2(SERIAL_REF_, RefType)
574 #define ALIASED_TYPE_INFO(RefType, RefCode) \
575 NCBI_NAME2(RefType, RefCode)
576 #define BEGIN_ALIAS_INFO_METHOD(AliasName,ClassName,BaseClassName,SerialRef,Code) \
577 const NCBI_NS_NCBI::CTypeInfo* BaseClassName::GetTypeInfo(void) \
579 static std::atomic<NCBI_NS_NCBI::CAliasTypeInfo*> s_info; \
580 NCBI_NS_NCBI::CAliasTypeInfo* info = s_info.load(std::memory_order_acquire); \
582 XSERIAL_TYPEINFO_WRITELOCK; \
583 info = s_info.load(std::memory_order_acquire); \
585 typedef ClassName CClass; \
586 typedef BaseClassName CClass_Base; \
587 DECLARE_BASE_OBJECT(CClass); \
588 typedef NCBI_NS_NCBI::TTypeInfo (*TGetter)(void); \
589 TGetter getter = SerialRef Code; \
590 info = new NCBI_NS_NCBI::CAliasTypeInfo(AliasName, getter()); \
591 NCBI_NS_NCBI::RegisterTypeInfoObject(info);
592 #define BEGIN_ALIAS_INFO(AliasName,ClassName,RefType,RefCode) \
593 BEGIN_ALIAS_INFO_METHOD(AliasName, ClassName, \
594 NCBI_NAME2(ClassName,_Base), \
595 SERIAL_ALIAS(RefType), RefCode)
597 #define BEGIN_NESTED_ALIAS_INFO(AliasName,ClassName,RefType,RefCode) \
598 BEGIN_ALIAS_INFO_METHOD(AliasName, ClassName, \
600 SERIAL_ALIAS(RefType), RefCode)
602 #define BEGIN_ENUM_ALIAS_INFO_METHOD(AliasName,ClassName,BaseClassName,SerialRef,Code) \
603 const NCBI_NS_NCBI::CTypeInfo* BaseClassName::GetTypeInfo(void) \
605 static std::atomic<NCBI_NS_NCBI::CAliasTypeInfo*> s_info; \
606 NCBI_NS_NCBI::CAliasTypeInfo* info = s_info.load(std::memory_order_acquire); \
608 XSERIAL_TYPEINFO_WRITELOCK; \
609 info = s_info.load(std::memory_order_acquire); \
611 typedef ClassName CClass; \
612 typedef BaseClassName CClass_Base; \
613 DECLARE_BASE_OBJECT(CClass); \
614 info = new NCBI_NS_NCBI::CAliasTypeInfo(AliasName, SerialRef Code); \
615 NCBI_NS_NCBI::RegisterTypeInfoObject(info);
616 #define BEGIN_ENUM_ALIAS_INFO(AliasName,ClassName,RefType,RefCode) \
617 BEGIN_ENUM_ALIAS_INFO_METHOD(AliasName, ClassName, \
618 NCBI_NAME2(ClassName,_Base), \
619 SERIAL_ALIAS(RefType), RefCode)
621 #define BEGIN_NESTED_ENUM_ALIAS_INFO(AliasName,ClassName,RefType,RefCode) \
622 BEGIN_ENUM_ALIAS_INFO_METHOD(AliasName, ClassName, \
624 SERIAL_ALIAS(RefType), RefCode)
626 #define SET_STD_ALIAS_DATA_PTR \
627 info->SetDataOffset(NCBI_NS_NCBI::TPointerOffsetType(GetDataPtr(BASE_OBJECT())))
628 #define SET_CLASS_ALIAS_DATA_PTR \
629 info->SetDataOffset(NCBI_NS_NCBI::TPointerOffsetType(BASE_OBJECT())); \
630 info->SetCreateFunction(NCBI_NS_NCBI::CClassInfoHelper<CClass>::Create)
631 #define END_ALIAS_INFO \
632 s_info.store(info, std::memory_order_release); \
637 #define SET_ALIAS_MODULE(ModuleName) \
638 NCBI_NS_NCBI::SetModuleName(info, ModuleName)
640 #define SET_FULL_ALIAS info->SetFullAlias()
651 const char* owner_name,
const char* member_name = 0);
655 const char* owner_name,
const char* member_name = 0);
Base class for all serializable objects.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Include a standard set of the NCBI C++ Toolkit most basic headers.
CMemberInfo * AddMember(CClassTypeInfoBase *info, const char *name, const void *member, TTypeInfo t)
static const void * ObjectPtrPtr(T *const *member)
SSystemMutex & GetTypeInfoMutex(void)
static const void * ObjectPtrPtr(CSerialObject *const *member)
CVariantInfo * AddVariant(CChoiceTypeInfo *info, const char *name, const void *member, TTypeInfo t)
TTypeInfo(* TTypeInfoGetter)(void)
void RegisterEnumTypeValuesObject(CEnumeratedTypeValues *object)
TTypeInfo(* TTypeInfoGetter1)(TTypeInfo)
void SetModuleName(CTypeInfo *info, const char *name)
TTypeInfoGetter GetStdTypeInfoGetter(const T *)
static const void * Ptr(const T *member)
void RegisterTypeInfoObject(CTypeInfo *object)
Check(const Check< T > &)
static const void * PtrPtr(T *const *member)
CRWLock & GetTypeInfoLock(void)
void SetInternalName(CTypeInfo *info, const char *owner_name, const char *member_name=0)
TTypeInfo EnumTypeInfo(const T *member, const CEnumeratedTypeValues *enumInfo)
Check< T > & operator=(const Check< T > &)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
CEnumeratedTypeInfo * CreateEnumeratedTypeInfo(const T &, const CEnumeratedTypeValues *values)
#define NCBI_XSERIAL_EXPORT
Multi-threading – mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)