NCBI C++ ToolKit
statictype.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef STATICTYPE_HPP
2 #define STATICTYPE_HPP
3 
4 /* $Id: statictype.hpp 84050 2018-10-11 15:49:53Z 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 * Predefined types: INTEGER, BOOLEAN, VisibleString etc.
33 *
34 */
35 
36 #include "type.hpp"
37 
39 
40 class CStaticDataType : public CDataType {
41  typedef CDataType CParent;
42 public:
43  virtual void PrintASN(CNcbiOstream& out, int indent) const override;
44  virtual void PrintJSONSchema(CNcbiOstream& out, int indent, list<string>& required, bool contents_only=false) const override;
45  virtual void PrintXMLSchema(CNcbiOstream& out, int indent, bool contents_only=false) const override;
46  virtual void PrintDTDElement(CNcbiOstream& out, bool contents_only=false) const override;
47 
48  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
49 
50  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
51  //virtual string GetDefaultCType(void) const;
52  virtual const char* GetDefaultCType(void) const = 0;
53  virtual const char* GetXMLContents(void) const = 0;
54  virtual bool PrintXMLSchemaContents(CNcbiOstream& out, int indent, const CDataMember* mem) const;
55 };
56 
59 public:
60  virtual bool CheckValue(const CDataValue& value) const override;
61  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
62 
63  virtual CTypeRef GetTypeInfo(void) override;
64  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
65  virtual const char* GetDefaultCType(void) const override;
66  virtual const char* GetASNKeyword(void) const override;
67  virtual const char* GetDEFKeyword(void) const override;
68  virtual const char* GetXMLContents(void) const override;
69  virtual bool PrintXMLSchemaContents(CNcbiOstream& out, int indent, const CDataMember* mem) const override;
70 };
71 
74 public:
75  virtual bool CheckValue(const CDataValue& value) const override;
76  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
77  virtual string GetDefaultString(const CDataValue& value) const override;
78 
79  virtual CTypeRef GetTypeInfo(void) override;
80  virtual const char* GetDefaultCType(void) const override;
81  virtual const char* GetASNKeyword(void) const override;
82  virtual const char* GetDEFKeyword(void) const override;
83  virtual const char* GetXMLContents(void) const override;
84  virtual string GetSchemaTypeString(void) const override;
85  virtual bool PrintXMLSchemaContents(CNcbiOstream& out, int indent, const CDataMember* mem) const override;
86 
87  virtual void PrintDTDExtra(CNcbiOstream& out) const override;
88 };
89 
92 public:
93  CRealDataType(void);
94  virtual bool CheckValue(const CDataValue& value) const override;
95  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
96  virtual string GetDefaultString(const CDataValue& value) const override;
97 
98  virtual const CTypeInfo* GetRealTypeInfo(void) override;
99  virtual const char* GetDefaultCType(void) const override;
100  virtual const char* GetASNKeyword(void) const override;
101  virtual const char* GetDEFKeyword(void) const override;
102  virtual const char* GetXMLContents(void) const override;
103  virtual string GetSchemaTypeString(void) const override;
104 };
105 
108 public:
109  enum EType {
112  };
113 
115 
116  virtual bool CheckValue(const CDataValue& value) const override;
117  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
118  virtual string GetDefaultString(const CDataValue& value) const override;
119 
120  virtual const CTypeInfo* GetRealTypeInfo(void) override;
121  virtual bool NeedAutoPointer(const CTypeInfo* typeInfo) const override;
122  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
123  virtual const char* GetDefaultCType(void) const override;
124  virtual const char* GetASNKeyword(void) const override;
125  virtual const char* GetDEFKeyword(void) const override;
126  virtual const char* GetXMLContents(void) const override;
127  virtual string GetSchemaTypeString(void) const override;
128 
129  EType GetStringType(void) const
130  {
131  return m_Type;
132  }
133 protected:
135 };
136 
139 public:
140  CStringStoreDataType(void);
141 
142  virtual const CTypeInfo* GetRealTypeInfo(void) override;
143  virtual bool NeedAutoPointer(const CTypeInfo* typeInfo) const override;
144  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
145  virtual const char* GetASNKeyword(void) const override;
146  virtual const char* GetDEFKeyword(void) const override;
147 };
148 
151 public:
152  CBitStringDataType(CDataType* bitenum = nullptr);
153  virtual void FixTypeTree(void) const override;
154  virtual bool CheckValue(const CDataValue& value) const override;
155  virtual const CTypeInfo* GetRealTypeInfo(void) override;
156  virtual bool NeedAutoPointer(const CTypeInfo* typeInfo) const override;
157  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
158  virtual const char* GetDefaultCType(void) const override;
159  virtual const char* GetASNKeyword(void) const override;
160  virtual const char* GetDEFKeyword(void) const override;
161  virtual const char* GetXMLContents(void) const override;
162  virtual bool PrintXMLSchemaContents(CNcbiOstream& out, int indent, const CDataMember* mem) const override;
163 private:
165 };
166 
169 public:
170  virtual bool CheckValue(const CDataValue& value) const override;
171  virtual const CTypeInfo* GetRealTypeInfo(void) override;
172  virtual bool NeedAutoPointer(const CTypeInfo* typeInfo) const override;
173  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
174  virtual const char* GetDefaultCType(void) const override;
175  virtual const char* GetASNKeyword(void) const override;
176  virtual const char* GetDEFKeyword(void) const override;
177  virtual const char* GetXMLContents(void) const override;
178  virtual string GetSchemaTypeString(void) const override;
179  virtual bool IsCompressed(void) const;
180 protected:
181  virtual bool x_AsBitString(void) const;
182 };
183 
186 public:
187  virtual string GetSchemaTypeString(void) const override;
188  virtual bool IsCompressed(void) const override;
189 protected:
190  virtual bool x_AsBitString(void) const override;
191 };
192 
195 public:
196  CIntDataType(void);
197  virtual bool CheckValue(const CDataValue& value) const override;
198  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
199  virtual string GetDefaultString(const CDataValue& value) const override;
200 
201  virtual CTypeRef GetTypeInfo(void) override;
202  virtual const char* GetDefaultCType(void) const override;
203  virtual const char* GetASNKeyword(void) const override;
204  virtual const char* GetDEFKeyword(void) const override;
205  virtual const char* GetXMLContents(void) const override;
206  virtual string GetSchemaTypeString(void) const override;
207 };
208 
211 public:
212  CBigIntDataType(bool bAsnBigInt = false) : m_bAsnBigInt(bAsnBigInt) {
213  }
214  virtual bool CheckValue(const CDataValue& value) const override;
215  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
216  virtual string GetDefaultString(const CDataValue& value) const override;
217 
218  virtual CTypeRef GetTypeInfo(void) override;
219  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
220  virtual const char* GetDefaultCType(void) const override;
221  virtual const char* GetASNKeyword(void) const override;
222  virtual const char* GetDEFKeyword(void) const override;
223  virtual const char* GetXMLContents(void) const override;
224  virtual string GetSchemaTypeString(void) const override;
225 protected:
227 };
228 
230 public:
231  virtual bool CheckValue(const CDataValue& value) const override;
232  virtual void PrintASN(CNcbiOstream& out, int indent) const override;
233  virtual void PrintJSONSchema(CNcbiOstream& out, int indent, list<string>& required, bool contents_only=false) const override;
234  virtual void PrintXMLSchema(CNcbiOstream& out, int indent, bool contents_only=false) const override;
235  virtual void PrintDTDElement(CNcbiOstream& out, bool contents_only=false) const override;
236 
237  virtual TObjectPtr CreateDefault(const CDataValue& value) const override;
238 
239  virtual AutoPtr<CTypeStrings> GetFullCType(void) const override;
240  virtual const char* GetDefaultCType(void) const override;
241  virtual const char* GetASNKeyword(void) const override;
242  virtual const char* GetDEFKeyword(void) const override;
243  virtual const char* GetXMLContents(void) const override;
244 };
245 
247 
248 #endif
virtual void PrintDTDElement(CNcbiOstream &out, bool contents_only=false) const override
virtual void PrintASN(CNcbiOstream &out, int indent) const override
virtual bool CheckValue(const CDataValue &value) const override
virtual const char * GetDEFKeyword(void) const override
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
virtual void PrintXMLSchema(CNcbiOstream &out, int indent, bool contents_only=false) const override
virtual void PrintJSONSchema(CNcbiOstream &out, int indent, list< string > &required, bool contents_only=false) const override
virtual const char * GetXMLContents(void) const override
virtual const char * GetASNKeyword(void) const override
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
virtual const char * GetDefaultCType(void) const override
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:891
virtual bool IsCompressed(void) const override
Definition: statictype.cpp:896
COctetStringDataType CParent
Definition: statictype.hpp:185
virtual bool x_AsBitString(void) const override
Definition: statictype.cpp:901
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:959
virtual string GetDefaultString(const CDataValue &value) const override
Definition: statictype.cpp:990
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:974
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:964
virtual CTypeRef GetTypeInfo(void) override
Definition: statictype.cpp:995
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:985
virtual const char * GetDefaultCType(void) const override
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:969
CBigIntDataType(bool bAsnBigInt=false)
Definition: statictype.hpp:212
CIntDataType CParent
Definition: statictype.hpp:210
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:979
virtual bool NeedAutoPointer(const CTypeInfo *typeInfo) const override
Definition: statictype.cpp:780
CDataType * m_BitStringEnum
Definition: statictype.hpp:164
CBitStringDataType(CDataType *bitenum=nullptr)
Definition: statictype.cpp:755
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:767
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:796
CStaticDataType CParent
Definition: statictype.hpp:150
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:791
virtual bool PrintXMLSchemaContents(CNcbiOstream &out, int indent, const CDataMember *mem) const override
Definition: statictype.cpp:801
virtual const CTypeInfo * GetRealTypeInfo(void) override
Definition: statictype.cpp:773
virtual void FixTypeTree(void) const override
Definition: statictype.cpp:760
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:745
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:750
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:785
CStaticDataType CParent
Definition: statictype.hpp:73
virtual CTypeRef GetTypeInfo(void) override
Definition: statictype.cpp:491
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:387
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:398
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:392
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:498
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:480
virtual void PrintDTDExtra(CNcbiOstream &out) const override
Definition: statictype.cpp:456
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:474
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:382
virtual string GetDefaultString(const CDataValue &value) const override
Definition: statictype.cpp:485
virtual bool PrintXMLSchemaContents(CNcbiOstream &out, int indent, const CDataMember *mem) const override
Definition: statictype.cpp:411
void * TObjectPtr
Definition: type.hpp:158
CStaticDataType CParent
Definition: statictype.hpp:194
virtual CTypeRef GetTypeInfo(void) override
Definition: statictype.cpp:947
virtual string GetDefaultString(const CDataValue &value) const override
Definition: statictype.cpp:942
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:926
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:916
CIntDataType(void)
Definition: statictype.cpp:906
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:937
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:921
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:911
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:954
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:931
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:329
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:377
CStaticDataType CParent
Definition: statictype.hpp:58
virtual bool PrintXMLSchemaContents(CNcbiOstream &out, int indent, const CDataMember *mem) const override
Definition: statictype.cpp:334
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:319
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:359
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:372
virtual CTypeRef GetTypeInfo(void) override
Definition: statictype.cpp:365
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:353
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:324
virtual const CTypeInfo * GetRealTypeInfo(void) override
Definition: statictype.cpp:852
virtual bool x_AsBitString(void) const
Definition: statictype.cpp:885
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:846
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:823
virtual bool NeedAutoPointer(const CTypeInfo *typeInfo) const override
Definition: statictype.cpp:863
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:841
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:868
CBitStringDataType CParent
Definition: statictype.hpp:168
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:818
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:828
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:836
virtual bool IsCompressed(void) const
Definition: statictype.cpp:880
CStaticDataType CParent
Definition: statictype.hpp:91
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:523
virtual string GetDefaultString(const CDataValue &value) const override
Definition: statictype.cpp:561
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:508
CRealDataType(void)
Definition: statictype.cpp:503
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:585
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:518
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:513
virtual const CTypeInfo * GetRealTypeInfo(void) override
Definition: statictype.cpp:578
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:528
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:546
virtual void PrintASN(CNcbiOstream &out, int indent) const override
Definition: statictype.cpp:57
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:51
virtual const char * GetXMLContents(void) const =0
virtual void PrintXMLSchema(CNcbiOstream &out, int indent, bool contents_only=false) const override
Definition: statictype.cpp:142
virtual void PrintDTDElement(CNcbiOstream &out, bool contents_only=false) const override
Definition: statictype.cpp:260
virtual const char * GetDefaultCType(void) const =0
virtual void PrintJSONSchema(CNcbiOstream &out, int indent, list< string > &required, bool contents_only=false) const override
Definition: statictype.cpp:63
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:300
CDataType CParent
Definition: statictype.hpp:41
virtual bool PrintXMLSchemaContents(CNcbiOstream &out, int indent, const CDataMember *mem) const
Definition: statictype.cpp:250
virtual const CTypeInfo * GetRealTypeInfo(void) override
Definition: statictype.cpp:677
CStaticDataType CParent
Definition: statictype.hpp:107
virtual TObjectPtr CreateDefault(const CDataValue &value) const override
Definition: statictype.cpp:634
virtual const char * GetXMLContents(void) const override
Definition: statictype.cpp:618
virtual const char * GetDefaultCType(void) const override
Definition: statictype.cpp:704
virtual string GetSchemaTypeString(void) const override
Definition: statictype.cpp:623
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:602
virtual bool NeedAutoPointer(const CTypeInfo *typeInfo) const override
Definition: statictype.cpp:686
virtual string GetDefaultString(const CDataValue &value) const override
Definition: statictype.cpp:651
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:691
virtual bool CheckValue(const CDataValue &value) const override
Definition: statictype.cpp:628
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:610
EType GetStringType(void) const
Definition: statictype.hpp:129
CStringDataType(EType type=eStringTypeVisible)
Definition: statictype.cpp:590
CStringDataType CParent
Definition: statictype.hpp:138
virtual const char * GetASNKeyword(void) const override
Definition: statictype.cpp:716
virtual AutoPtr< CTypeStrings > GetFullCType(void) const override
Definition: statictype.cpp:736
virtual bool NeedAutoPointer(const CTypeInfo *typeInfo) const override
Definition: statictype.cpp:731
virtual const CTypeInfo * GetRealTypeInfo(void) override
Definition: statictype.cpp:726
virtual const char * GetDEFKeyword(void) const override
Definition: statictype.cpp:721
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Definition: typeinfo.hpp:76
std::ofstream out("events_result.xml")
main entry point for tests
void * TObjectPtr
Definition: serialdef.hpp:55
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
string indent(" ")
Definition: type.c:6
Modified on Fri Sep 20 14:58:30 2024 by modify_doxy.py rev. 669887