| Qore DataProvider Module Reference 1.2.1

AbstractDataProviderType.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3
26 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 public struct DataProviderTypeOptionInfo {
51 string type;
52
54 string desc;
55 };
56
58 public struct DataTypeInfo {
60 string name;
61
63 *hash<string, hash<DataProviderTypeOptionInfo>> supported_options;
64
66 *hash<auto> options;
67
69 string base_type;
70
72 bool mandatory;
73
75 list<string> types_accepted;
76
78 list<string> types_returned;
79
81 hash<string, hash<DataFieldInfo>> fields;
82
84 bool can_manage_fields = False;
85 };
86
88 class AbstractDataProviderType : public Serializable {
89
90 public:
91 static Type nothingType = Reflection::NothingType;
92 static Type anyType = Reflection::AutoType;
93 // not initialized here to workaround issue #4048 (circular initializtion error)
94 static AbstractDataProviderType anyDataType;
95
96 protected:
98 hash<auto> options;
99
100 public:
101
103 constructor();
104
105
107
111 constructor(hash<auto> options);
112
113
115 *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
116
117
119
125 hash<DataTypeInfo> getInputInfo();
126
127
129 hash<DataTypeInfo> getInfo();
130
131
133 *hash<string, hash<DataFieldInfo>> getFieldInfo();
134
135
137 bool isAssignableFrom(AbstractDataProviderType t);
138
139
141 bool isAssignableFrom(Type t);
142
143
145 bool isList();
146
147
149 bool isMandatory();
150
151
153 *AbstractDataField getField(string field_name);
154
155
157 bool hasType();
158
159
161 string getBaseTypeName();
162
163
165 int getBaseTypeCode();
166
167
169 *hash<string, bool> getDirectTypeHash();
170
171
173 bool isOrNothingType();
174
175
177 *AbstractDataProviderType getFieldType(string field_name);
178
179
181 auto getOptionValue(string opt);
182
183
185 *hash<auto> getOptions();
186
187
189
194 setOption(string opt, auto value);
195
196
198
202 setOptions(hash<auto> options);
203
204
206
211 AbstractDataProviderType getSoftType();
212
213
215
222 AbstractDataProviderType getOrNothingType();
223
224
226 abstract string getName();
227
229 abstract *Type getValueType();
230
232 abstract *AbstractDataProviderType getElementType();
233
235 abstract *hash<string, AbstractDataField> getFields();
236
238 abstract hash<string, bool> getAcceptTypeHash();
239
241 abstract hash<string, bool> getReturnTypeHash();
242
244
248 abstract auto acceptsValue(auto value);
249
251 static AbstractDataProviderType get(Type type, *hash<auto> options);
252
254
257 static AbstractDataProviderType get(string typename, *hash<auto> options);
258
260 protected:
261 setOptionIntern(string opt, auto value);
262 public:
263
264 };
265 };
DataProvider::TypeCodeMap
const TypeCodeMap
maps type codes to type names
Definition: AbstractDataProviderType.qc.dox.h:29
DataProvider::AbstractDataProviderType::getField
*AbstractDataField getField(string field_name)
Returns the given field, if present, or NOTHING if not.
DataProvider::DataTypeInfo::name
string name
the name of the type
Definition: AbstractDataProviderType.qc.dox.h:60
DataProvider::AbstractDataProviderType::getOptions
*hash< auto > getOptions()
Returns options set on the type.
DataProvider::DataTypeInfo
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:58
DataProvider::AbstractDataProviderType::setOption
setOption(string opt, auto value)
sets the given option on the type
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
DataProvider::AbstractDataProviderType::getInfo
hash< DataTypeInfo > getInfo()
Returns a description of the type as a hash.
DataProvider::DataTypeInfo::options
*hash< auto > options
output: current transformation option values
Definition: AbstractDataProviderType.qc.dox.h:66
DataProvider::AbstractDataProviderType::isMandatory
bool isMandatory()
Returns True if the type must have a value.
DataProvider::AbstractDataProviderType::acceptsValue
abstract auto acceptsValue(auto value)
Returns the value if the value can be assigned to the type.
DataProvider::AbstractDataProviderType::getFields
abstract *hash< string, AbstractDataField > getFields()
Returns the fields of the data structure; if any.
DataProvider::DataTypeInfo::fields
hash< string, hash< DataFieldInfo > > fields
any fields supported by the type
Definition: AbstractDataProviderType.qc.dox.h:81
DataProvider::AbstractDataProviderType::getSupportedOptions
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
DataProvider::DataTypeInfo::base_type
string base_type
output: base type
Definition: AbstractDataProviderType.qc.dox.h:69
DataProvider::DataTypeInfo::supported_options
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
output: transformation options supported by the type
Definition: AbstractDataProviderType.qc.dox.h:63
False
const False
DataProvider::DataProviderTypeOptionInfo
describes type options
Definition: AbstractDataProviderType.qc.dox.h:49
NothingType
const NothingType
DataProvider::AbstractDataProviderType::hasType
bool hasType()
Returns True if the type is not a wildcard type.
DataProvider::DataTypeInfo::mandatory
bool mandatory
output: can be null / missing?
Definition: AbstractDataProviderType.qc.dox.h:72
DataProvider::AbstractDataProviderType::getSoftType
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
DataProvider::DataProviderTypeOptionInfo::type
string type
the option value type
Definition: AbstractDataProviderType.qc.dox.h:51
DataProvider::DataTypeInfo::types_accepted
list< string > types_accepted
output: list of types accepted
Definition: AbstractDataProviderType.qc.dox.h:75
DataProvider::AbstractDataProviderType::setOptions
setOptions(hash< auto > options)
sets options on the type
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::AbstractDataProviderType::getValueType
abstract *Type getValueType()
Returns the base type for the type, if any.
DataProvider::AbstractDataProviderType::isAssignableFrom
bool isAssignableFrom(AbstractDataProviderType t)
Returns True if this type can be assigned from values of the argument type.
DataProvider::AbstractDataProviderType::options
hash< auto > options
type options
Definition: AbstractDataProviderType.qc.dox.h:98
DataProvider::AbstractDataProviderType::getReturnTypeHash
abstract hash< string, bool > getReturnTypeHash()
Returns a hash of types returned by this type; keys are type names.
DataProvider::AbstractDataProviderType
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:88
DataProvider::DataProviderTypeOptionInfo::desc
string desc
the description of the option
Definition: AbstractDataProviderType.qc.dox.h:54
type
string type(auto arg)
DataProvider::AbstractDataProviderType::getAcceptTypeHash
abstract hash< string, bool > getAcceptTypeHash()
Returns a hash of types accepted by this type; keys are type names.
DataProvider::AbstractDataField
describes a data type based on a hashdecl
Definition: AbstractDataField.qc.dox.h:44
DataProvider::AbstractDataProviderType::getOrNothingType
AbstractDataProviderType getOrNothingType()
Returns an "or nothing" type equivalent to the current type.
DataProvider::DataTypeInfo::types_returned
list< string > types_returned
input: list of types returned
Definition: AbstractDataProviderType.qc.dox.h:78
DataProvider::AbstractDataProviderType::getBaseTypeCode
int getBaseTypeCode()
Returns the base type code for the type.
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::AbstractDataProviderType::getFieldInfo
*hash< string, hash< DataFieldInfo > > getFieldInfo()
Returns information on fields supported.
DataProvider::AbstractDataProviderType::getElementType
abstract *AbstractDataProviderType getElementType()
Returns the subtype (for lists or hashes) if there is only one.
DataProvider::AbstractDataProviderType::getBaseTypeName
string getBaseTypeName()
Returns the base type name for the type; must be a standard Qore base type name.
DataProvider::AbstractDataProviderType::getFieldType
*AbstractDataProviderType getFieldType(string field_name)
get the given field type if it exists, otherwise return NOTHING
DataProvider::DataTypeInfo::can_manage_fields
bool can_manage_fields
if fields can be added dynamically to the type
Definition: AbstractDataProviderType.qc.dox.h:84
DataProvider::AbstractDataProviderType::isList
bool isList()
Returns True if this type is a list.
DataProvider::AbstractDataProviderType::getName
abstract string getName()
Returns the type name.
DataProvider::AbstractDataProviderType::getInputInfo
hash< DataTypeInfo > getInputInfo()
Returns a description of the type as an input type.
DataProvider::AbstractDataProviderType::getOptionValue
auto getOptionValue(string opt)
Returns the value of the given option.
DataProvider::AbstractDataProviderType::constructor
constructor()
creates the type
DataProvider::AbstractDataProviderType::setOptionIntern
setOptionIntern(string opt, auto value)
sets the given option without any validation of the option
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::isOrNothingType
bool isOrNothingType()
Returns True if the type also accepts NOTHING.