| Qore DataProvider Module Reference 3.2.2

Loading...
Searching...
No Matches
AbstractDataProviderType.qc.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
24
25
27 namespace DataProvider {
29 const TypeCodeMap = ...;
30
31
33
35 const OptimalQoreDataTypeMap = ...;
36
37
39
41 const OptimalQoreSoftDataTypeMap = ...;
42
43
45 const DataTypeMap = ...;
46
47
49 const AbstractDataProviderTypeMap = ...;
50
51
53 public struct DataProviderTypeOptionInfo {
55 string type;
56
58 string desc;
59
61 bool publish;
62};
63
65 public struct DataTypeInfo {
67 string name;
68
70 string display_name;
71
73 string short_desc;
74
76 string desc;
77
79 *string path;
80
82 *hash<string, hash<DataProviderTypeOptionInfo>> supported_options;
83
85 *hash<auto> options;
86
88 string base_type;
89
91 bool mandatory;
92
94 list<string> types_accepted;
95
97 list<string> types_returned;
98
100 *hash<string, hash<DataFieldInfo>> fields;
101
103 *hash<DataTypeInfo> element_type;
104
106 auto default_value;
107
109 bool can_manage_fields = False;
110
112 *hash<DataTypeInfo> default_field_type_info;
113
115 string unique_key;
116
118 bool recursive;
119
121 *hash<auto> tags;
122};
123
129 const DTT_FromFile = "from_file";
130
132 const DTT_FromLocation = "from_location";
133
135 const DTT_ClientOnly = "client_only";
137
139 class AbstractDataProviderType : public Qore::Serializable {
140
141 public:
142 static Type nothingType = Reflection::NothingType;
143 static Type anyType = Reflection::AutoType;
144 // not initialized here to workaround issue #4048 (circular initializtion error)
145 static AbstractDataProviderType anyDataType;
146
148 const DefaultDesc = "no description available";
149
150 protected:
152 hash<auto> options;
153
155 *hash<auto> tags;
156
158 *string path;
159
160 public:
161
163 constructor();
164
165
167 constructor(string path);
168
169
171
177 constructor(hash<auto> options, *hash<auto> tags, *string path);
178
179
181
187 constructor(*hash<auto> options, hash<auto> tags, *string path);
188
189
191 string getDesc();
192
193
195
197 *string getPath();
198
199
201
203 setPath(string path);
204
205
207
209 clearPath();
210
211
213 *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
214
215
217
223 hash<DataTypeInfo> getInputInfo(*bool simple);
224
225
227 hash<DataTypeInfo> getInfo(*bool simple);
228
229
231 *hash<string, hash<DataFieldInfo>> getFieldInfo();
232
233
235 bool isAssignableFrom(AbstractDataProviderType t);
236
237
239 bool isAssignableFrom(Type t);
240
241
243
254 bool hasDefaultValue();
255
256
258
269 auto getDefaultValue();
270
271
273 bool isList();
274
275
277 bool isMandatory();
278
279
281 *AbstractDataField getField(string field_name);
282
283
285 bool hasType();
286
287
289 string getBaseTypeName();
290
291
293 int getBaseTypeCode();
294
295
297 *hash<string, bool> getDirectTypeHash();
298
299
301 bool isOrNothingType();
302
303
305 *AbstractDataProviderType getFieldType(string field_name);
306
307
309 auto getOptionValue(string opt);
310
311
313 *hash<auto> getOptions();
314
315
317
319 *hash<auto> getPublicOptions();
320
321
323
328 setOption(string opt, auto value);
329
330
332
336 setOptions(hash<auto> options);
337
338
340 auto getTag(string tag);
341
342
344 *hash<auto> getTags();
345
346
348 setDynamicTag();
349
350
352
357 AbstractDataProviderType getSoftType();
358
359
361
368 AbstractDataProviderType getOrNothingType();
369
370
372
379 AbstractDataProviderType getMandatoryType();
380
381
383
388 auto getExampleValue(*hash<string, bool> emap, *string fname);
389
390
392
396 string getDisplayName();
397
398
400
404 string getShortDescription();
405
406
408 abstract string getName();
409
411 abstract *Type getValueType();
412
414 abstract *AbstractDataProviderType getElementType();
415
417 abstract *hash<string, AbstractDataField> getFields();
418
420 abstract hash<string, bool> getAcceptTypeHash(*bool simple);
421
423 abstract hash<string, bool> getReturnTypeHash(*bool simple);
424
426
430 abstract auto acceptsValue(auto value);
431
433 static AbstractDataProviderType get(Type type, *hash<auto> options, *hash<auto> tags, auto default_value, *hash<NameDescInfo> attr);
434
436
439 static AbstractDataProviderType get(string typename, *hash<auto> options);
440
442
444 static AbstractDataProviderType get(hash<DataTypeInfo> info);
445
447 protected:
448 setOptionIntern(string opt, auto value);
449 public:
450
451};
452};
453
454 namespace Priv {
456 thread_local hash<string, bool> rimap;
457};
DataProvider::AbstractDataField
describes a data type based on a hashdecl
Definition AbstractDataField.qc.dox.h:74
DataProvider::AbstractDataProviderType
describes a data type
Definition AbstractDataProviderType.qc.dox.h:139
DataProvider::AbstractDataProviderType::getReturnTypeHash
abstract hash< string, bool > getReturnTypeHash(*bool simple)
Returns a hash of types returned by this type; keys are type names.
DataProvider::AbstractDataProviderType::hasType
bool hasType()
Returns True if the type is not a wildcard type.
DataProvider::AbstractDataProviderType::setDynamicTag
setDynamicTag()
Sets the dynamic tag on the type.
DataProvider::AbstractDataProviderType::getBaseTypeCode
int getBaseTypeCode()
Returns the base type code for the type.
DataProvider::AbstractDataProviderType::get
static AbstractDataProviderType get(Type type, *hash< auto > options, *hash< auto > tags, auto default_value, *hash< NameDescInfo > attr)
Returns an appropriate object for the given type.
DataProvider::AbstractDataProviderType::tags
*hash< auto > tags
type tags
Definition AbstractDataProviderType.qc.dox.h:155
DataProvider::AbstractDataProviderType::getSupportedOptions
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
DataProvider::AbstractDataProviderType::isAssignableFrom
bool isAssignableFrom(AbstractDataProviderType t)
Returns True if this type can be assigned from values of the argument type.
DataProvider::AbstractDataProviderType::getFieldType
*AbstractDataProviderType getFieldType(string field_name)
get the given field type if it exists, otherwise return NOTHING
DataProvider::AbstractDataProviderType::options
hash< auto > options
type options
Definition AbstractDataProviderType.qc.dox.h:152
DataProvider::AbstractDataProviderType::getInputInfo
hash< DataTypeInfo > getInputInfo(*bool simple)
Returns a description of the type as an input type.
DataProvider::AbstractDataProviderType::getDirectTypeHash
*hash< string, bool > getDirectTypeHash()
Returns a hash of native base type code keys where no translations are performed; keys are type codes...
DataProvider::AbstractDataProviderType::clearPath
clearPath()
Clears the type path for the type.
DataProvider::AbstractDataProviderType::get
static AbstractDataProviderType get(hash< DataTypeInfo > info)
Returns an appropriate object for the given type description.
DataProvider::AbstractDataProviderType::hasDefaultValue
bool hasDefaultValue()
! Returns True if this type has a default value
DataProvider::AbstractDataProviderType::isAssignableFrom
bool isAssignableFrom(Type t)
Returns True if this type can be assigned from values of the argument type.
DataProvider::AbstractDataProviderType::getElementType
abstract *AbstractDataProviderType getElementType()
Returns the subtype (for lists or hashes) if there is only one.
DataProvider::AbstractDataProviderType::getPath
*string getPath()
Returns the type path in the type cache, if any.
DataProvider::AbstractDataProviderType::isMandatory
bool isMandatory()
Returns True if the type must have a value.
DataProvider::AbstractDataProviderType::getFields
abstract *hash< string, AbstractDataField > getFields()
Returns the fields of the data structure; if any.
DataProvider::AbstractDataProviderType::isList
bool isList()
Returns True if this type is a list.
DataProvider::AbstractDataProviderType::getBaseTypeName
string getBaseTypeName()
Returns the base type name for the type; must be a standard Qore base type name.
DataProvider::AbstractDataProviderType::isOrNothingType
bool isOrNothingType()
Returns True if the type also accepts NOTHING.
DataProvider::AbstractDataProviderType::getTags
*hash< auto > getTags()
Returns tags set on the type.
DataProvider::AbstractDataProviderType::getPublicOptions
*hash< auto > getPublicOptions()
Returns options with the publish flag set on the type.
DataProvider::AbstractDataProviderType::DefaultDesc
const DefaultDesc
Default description.
Definition AbstractDataProviderType.qc.dox.h:148
DataProvider::AbstractDataProviderType::getDisplayName
string getDisplayName()
Returns the type's display name.
DataProvider::AbstractDataProviderType::getAcceptTypeHash
abstract hash< string, bool > getAcceptTypeHash(*bool simple)
Returns a hash of types accepted by this type; keys are type names.
DataProvider::AbstractDataProviderType::acceptsValue
abstract auto acceptsValue(auto value)
Returns the value if the value can be assigned to the type.
DataProvider::AbstractDataProviderType::get
static AbstractDataProviderType get(string typename, *hash< auto > options)
Returns an appropriate object for the given type.
DataProvider::AbstractDataProviderType::getOrNothingType
AbstractDataProviderType getOrNothingType()
Returns an "or nothing" type equivalent to the current type.
DataProvider::AbstractDataProviderType::getName
abstract string getName()
Returns the type name.
DataProvider::AbstractDataProviderType::getShortDescription
string getShortDescription()
Returns the type's short description.
DataProvider::AbstractDataProviderType::setOptionIntern
setOptionIntern(string opt, auto value)
sets the given option without any validation of the option
DataProvider::AbstractDataProviderType::setOptions
setOptions(hash< auto > options)
sets options on the type
DataProvider::AbstractDataProviderType::path
*string path
The type path, if any.
Definition AbstractDataProviderType.qc.dox.h:158
DataProvider::AbstractDataProviderType::getValueType
abstract *Type getValueType()
Returns the base type for the type, if any.
DataProvider::AbstractDataProviderType::constructor
constructor(string path)
creates the type
DataProvider::AbstractDataProviderType::getExampleValue
auto getExampleValue(*hash< string, bool > emap, *string fname)
Returns any example value for type, if any.
DataProvider::AbstractDataProviderType::getFieldInfo
*hash< string, hash< DataFieldInfo > > getFieldInfo()
Returns information on fields supported.
DataProvider::AbstractDataProviderType::getField
*AbstractDataField getField(string field_name)
Returns the given field, if present, or NOTHING if not.
DataProvider::AbstractDataProviderType::constructor
constructor(*hash< auto > options, hash< auto > tags, *string path)
creates the type and sets options
DataProvider::AbstractDataProviderType::getOptions
*hash< auto > getOptions()
Returns options set on the type.
DataProvider::AbstractDataProviderType::setPath
setPath(string path)
Sets the type path for the type.
DataProvider::AbstractDataProviderType::getDefaultValue
auto getDefaultValue()
DataProvider::AbstractDataProviderType::constructor
constructor()
creates the type
DataProvider::AbstractDataProviderType::getSoftType
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
DataProvider::AbstractDataProviderType::setOption
setOption(string opt, auto value)
sets the given option on the type
DataProvider::AbstractDataProviderType::getMandatoryType
AbstractDataProviderType getMandatoryType()
Returns a mandatory (i.e. not "or nothing") type equivalent to the current type.
DataProvider::AbstractDataProviderType::getOptionValue
auto getOptionValue(string opt)
Returns the value of the given option.
DataProvider::AbstractDataProviderType::getInfo
hash< DataTypeInfo > getInfo(*bool simple)
Returns a description of the type as a hash.
DataProvider::AbstractDataProviderType::getTag
auto getTag(string tag)
Returns the value of the given tag.
DataProvider::AbstractDataProviderType::constructor
constructor(hash< auto > options, *hash< auto > tags, *string path)
creates the type and sets options
DataProvider::AbstractDataProviderType::getDesc
string getDesc()
Returns the description.
Qore::Serializable
DataProvider::DTT_FromLocation
const DTT_FromLocation
Tag indicates that a string value can indicate a location.
Definition AbstractDataProviderType.qc.dox.h:132
DataProvider::DTT_FromFile
const DTT_FromFile
Definition AbstractDataProviderType.qc.dox.h:129
DataProvider::DTT_ClientOnly
const DTT_ClientOnly
Tag indicates that the value is only applicable in client contexts.
Definition AbstractDataProviderType.qc.dox.h:135
DataProvider
Qore AbstractDataField class definition.
Definition AbstractDataField.qc.dox.h:27
DataProvider::DataTypeMap
const DataTypeMap
Maps Qore type name constant values to data type objects.
Definition AbstractDataProviderType.qc.dox.h:45
DataProvider::OptimalQoreDataTypeMap
const OptimalQoreDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition AbstractDataProviderType.qc.dox.h:35
DataProvider::TypeCodeMap
const TypeCodeMap
maps type codes to type names
Definition AbstractDataProviderType.qc.dox.h:29
DataProvider::AbstractDataProviderTypeMap
const AbstractDataProviderTypeMap
Maps Qore type name constant values to AbstractDataProviderType values.
Definition AbstractDataProviderType.qc.dox.h:49
DataProvider::OptimalQoreSoftDataTypeMap
const OptimalQoreSoftDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition AbstractDataProviderType.qc.dox.h:41
Priv
Private definitions.
Definition AbstractDataProviderType.qc.dox.h:454
Priv::rimap
thread_local hash< string, bool > rimap
Recursive info map: unique key -> True.
Definition AbstractDataProviderType.qc.dox.h:456
DataProvider::DataProviderTypeOptionInfo
describes type options
Definition AbstractDataProviderType.qc.dox.h:53
DataProvider::DataProviderTypeOptionInfo::publish
bool publish
Flag to publish the option as a `type_option`.
Definition AbstractDataProviderType.qc.dox.h:61
DataProvider::DataProviderTypeOptionInfo::desc
string desc
the description of the option
Definition AbstractDataProviderType.qc.dox.h:58
DataProvider::DataProviderTypeOptionInfo::type
string type
the option value type
Definition AbstractDataProviderType.qc.dox.h:55
DataProvider::DataTypeInfo
describes a data type
Definition AbstractDataProviderType.qc.dox.h:65
DataProvider::DataTypeInfo::options
*hash< auto > options
Output: current transformation option values.
Definition AbstractDataProviderType.qc.dox.h:85
DataProvider::DataTypeInfo::tags
*hash< auto > tags
Any tags set on the type.
Definition AbstractDataProviderType.qc.dox.h:121
DataProvider::DataTypeInfo::short_desc
string short_desc
A short description for the type, plain text formatting.
Definition AbstractDataProviderType.qc.dox.h:73
DataProvider::DataTypeInfo::default_field_type_info
*hash< DataTypeInfo > default_field_type_info
Default type for fields not listed in fields.
Definition AbstractDataProviderType.qc.dox.h:112
DataProvider::DataTypeInfo::path
*string path
The type path in the type cache, if known.
Definition AbstractDataProviderType.qc.dox.h:79
DataProvider::DataTypeInfo::recursive
bool recursive
Recursive flag.
Definition AbstractDataProviderType.qc.dox.h:118
DataProvider::DataTypeInfo::supported_options
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
Output: transformation options supported by the type.
Definition AbstractDataProviderType.qc.dox.h:82
DataProvider::DataTypeInfo::can_manage_fields
bool can_manage_fields
If fields can be added dynamically to the type and if the type will accept any field at runtime.
Definition AbstractDataProviderType.qc.dox.h:109
DataProvider::DataTypeInfo::fields
*hash< string, hash< DataFieldInfo > > fields
Any fields supported by the type; will be NOTHING when recursive is True.
Definition AbstractDataProviderType.qc.dox.h:100
DataProvider::DataTypeInfo::mandatory
bool mandatory
Output: can be null / missing?
Definition AbstractDataProviderType.qc.dox.h:91
DataProvider::DataTypeInfo::element_type
*hash< DataTypeInfo > element_type
A type description of any element type.
Definition AbstractDataProviderType.qc.dox.h:103
DataProvider::DataTypeInfo::types_returned
list< string > types_returned
Input: list of types returned.
Definition AbstractDataProviderType.qc.dox.h:97
DataProvider::DataTypeInfo::display_name
string display_name
The display name for the type.
Definition AbstractDataProviderType.qc.dox.h:70
DataProvider::DataTypeInfo::unique_key
string unique_key
Unique type identifier.
Definition AbstractDataProviderType.qc.dox.h:115
DataProvider::DataTypeInfo::desc
string desc
The description of the type.
Definition AbstractDataProviderType.qc.dox.h:76
DataProvider::DataTypeInfo::base_type
string base_type
Output: base type.
Definition AbstractDataProviderType.qc.dox.h:88
DataProvider::DataTypeInfo::types_accepted
list< string > types_accepted
Output: list of types accepted.
Definition AbstractDataProviderType.qc.dox.h:94
DataProvider::DataTypeInfo::default_value
auto default_value
The default value for the type.
Definition AbstractDataProviderType.qc.dox.h:106
DataProvider::DataTypeInfo::name
string name
The name of the type.
Definition AbstractDataProviderType.qc.dox.h:67