NCBI C++ ToolKit
variant.inl
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #if defined(VARIANT__HPP) && !defined(VARIANT__INL)
2 #define VARIANT__INL
3 
4 /* $Id: variant.inl 64770 2014-10-08 13:11:24Z gouriano $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Eugene Vasilchenko
30 *
31 * File Description:
32 * !!! PUT YOUR DESCRIPTION HERE !!!
33 */
34 
35 inline
37 {
38  return m_ChoiceType;
39 }
40 
41 inline
43 {
44  return m_VariantType;
45 }
46 
47 
48 inline
50 {
51  m_Optional = true;
52  return this;
53 }
54 
55 inline
57 {
58  GetId().SetNoPrefix();
59  return this;
60 }
61 
62 inline
64 {
65  GetId().SetNotag();
66  return this;
67 }
68 
69 inline
71 {
72  GetId().SetCompressed();
73  return this;
74 }
75 
76 inline
78 {
79  GetId().SetNsQualified(qualified);
80  return this;
81 }
82 
83 inline
84 bool CVariantInfo::IsInline(void) const
85 {
86  return GetVariantType() == eInlineVariant;
87 }
88 
89 inline
90 bool CVariantInfo::IsNonObjectPointer(void) const
91 {
93 }
94 
95 inline
96 bool CVariantInfo::IsObjectPointer(void) const
97 {
99 }
100 
101 inline
102 bool CVariantInfo::IsSubClass(void) const
103 {
104  return GetVariantType() == eSubClassVariant;
105 }
106 
107 inline
108 bool CVariantInfo::IsNotPointer(void) const
109 {
110  return (GetVariantType() & ePointerFlag) == 0;
111 }
112 
113 inline
114 bool CVariantInfo::IsPointer(void) const
115 {
116  return (GetVariantType() & ePointerFlag) != 0;
117 }
118 
119 inline
120 bool CVariantInfo::IsNotObject(void) const
121 {
122  return (GetVariantType() & eObjectFlag) == 0;
123 }
124 
125 inline
126 bool CVariantInfo::IsObject(void) const
127 {
128  return (GetVariantType() & eObjectFlag) != 0;
129 }
130 
131 inline
132 bool CVariantInfo::CanBeDelayed(void) const
133 {
134  return m_DelayOffset != eNoOffset;
135 }
136 
137 inline
139 {
141 }
142 
143 inline
145 {
147 }
148 
149 inline
151 {
152  return m_GetConstFunction(this, choicePtr);
153 }
154 
155 inline
157 {
158  return m_GetFunction(this, choicePtr);
159 }
160 
161 inline
163  TObjectPtr choicePtr) const
164 {
165  m_ReadHookData.GetCurrentFunction()(stream, this, choicePtr);
166 }
167 
168 inline
170  TConstObjectPtr choicePtr) const
171 {
172  m_WriteHookData.GetCurrentFunction()(stream, this, choicePtr);
173 }
174 
175 inline
176 void CVariantInfo::SkipVariant(CObjectIStream& stream) const
177 {
178  m_SkipHookData.GetCurrentFunction()(stream, this);
179 }
180 
181 inline
183 {
184  m_CopyHookData.GetCurrentFunction()(stream, this);
185 }
186 
187 inline
189  TObjectPtr choicePtr) const
190 {
191  m_ReadHookData.GetDefaultFunction()(stream, this, choicePtr);
192 }
193 
194 inline
196  TConstObjectPtr choicePtr) const
197 {
198  m_WriteHookData.GetDefaultFunction()(stream, this, choicePtr);
199 }
200 
201 inline
203 {
204  m_SkipHookData.GetDefaultFunction()(stream, this);
205 }
206 
207 inline
209 {
210  m_CopyHookData.GetDefaultFunction()(stream, this);
211 }
212 
213 #endif /* def VARIANT__HPP && ndef VARIANT__INL */
CDelayBuffer.
Definition: delaybuf.hpp:58
CObjectIStream –.
Definition: objistr.hpp:93
CObjectOStream –.
Definition: objostr.hpp:83
CObjectStreamCopier –.
Definition: objcopy.hpp:71
static void * Add(void *object, ssize_t offset)
add offset to object reference (to get object's member)
Definition: ncbimisc.hpp:1137
bool IsSubClass(void) const
void DefaultSkipVariant(CObjectIStream &in) const
EVariantType m_VariantType
Definition: variant.hpp:180
bool m_Optional
Definition: item.hpp:128
CVariantInfo * SetOptional(void)
const CMemberId & GetId(void) const
CHookData< CWriteChoiceVariantHook, TVariantWriteFunction > m_WriteHookData
Definition: variant.hpp:188
void DefaultWriteVariant(CObjectOStream &out, TConstObjectPtr choicePtr) const
void SetNoPrefix(void)
Definition: memberid.cpp:121
void WriteVariant(CObjectOStream &out, TConstObjectPtr choicePtr) const
const CChoiceTypeInfo * m_ChoiceType
Definition: variant.hpp:178
bool IsNotPointer(void) const
CVariantInfo * SetCompressed(void)
bool IsInline(void) const
TVariantGet m_GetFunction
Definition: variant.hpp:185
bool IsObject(void) const
void ReadVariant(CObjectIStream &in, TObjectPtr choicePtr) const
CHookData< CSkipChoiceVariantHook, TVariantSkipFunction > m_SkipHookData
Definition: variant.hpp:189
CVariantInfo * SetNotag(void)
TConstObjectPtr GetVariantPtr(TConstObjectPtr choicePtr) const
CVariantInfo * SetNsQualified(bool qualified)
void CopyVariant(CObjectStreamCopier &copier) const
void SetNotag(void)
Definition: memberid.cpp:131
const CChoiceTypeInfo * GetChoiceType(void) const
bool IsNonObjectPointer(void) const
bool IsPointer(void) const
void SetCompressed(void)
Definition: memberid.cpp:141
CVariantInfo * SetNoPrefix(void)
TVariantGetConst m_GetConstFunction
Definition: variant.hpp:184
void SkipVariant(CObjectIStream &in) const
void DefaultCopyVariant(CObjectStreamCopier &copier) const
CDelayBuffer & GetDelayBuffer(TObjectPtr object) const
void SetNsQualified(bool qualified)
Definition: memberid.cpp:155
bool IsNotObject(void) const
CHookData< CReadChoiceVariantHook, TVariantReadFunction > m_ReadHookData
Definition: variant.hpp:187
bool CanBeDelayed(void) const
CHookData< CCopyChoiceVariantHook, TVariantCopyFunction > m_CopyHookData
Definition: variant.hpp:190
void DefaultReadVariant(CObjectIStream &in, TObjectPtr choicePtr) const
EVariantType GetVariantType(void) const
bool IsObjectPointer(void) const
TPointerOffsetType m_DelayOffset
Definition: variant.hpp:182
@ eInlineVariant
Definition: variant.hpp:79
@ eSubClassVariant
Definition: variant.hpp:82
@ eNonObjectPointerVariant
Definition: variant.hpp:80
@ eObjectPointerVariant
Definition: variant.hpp:81
@ eNoOffset
Definition: item.hpp:57
static TObjectType & Get(TObjectPtr object)
Definition: serialutil.hpp:56
void * TObjectPtr
Definition: serialdef.hpp:55
const void * TConstObjectPtr
Definition: serialdef.hpp:59
TFunction GetDefaultFunction(void) const
Definition: hookdata.hpp:128
TFunction GetCurrentFunction(void) const
Definition: hookdata.hpp:123
Modified on Sun Jun 16 04:30:42 2024 by modify_doxy.py rev. 669887