Qore DataProvider Module Reference  2.1.2
AbstractDataProviderType.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
26 namespace DataProvider {
29 const TypeCodeMap = ...;
30 
31 
33 
36 
37 
39 
42 
43 
45 const DataTypeMap = ...;
46 
47 
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 
85 
87  *hash<DataTypeInfo> default_field_type_info;
88 
90  *hash<auto> tags;
91 };
92 
97 const DTT_FromFile = "from_file";
99 
101 const DTT_FromLocation = "from_location";
103 
105 class AbstractDataProviderType : public Serializable {
106 
107 public:
108  static Type nothingType = Reflection::NothingType;
109  static Type anyType = Reflection::AutoType;
110  // not initialized here to workaround issue #4048 (circular initializtion error)
111  static AbstractDataProviderType anyDataType;
112 
113 protected:
115  hash<auto> options;
116 
118  *hash<auto> tags;
119 
120 public:
121 
123  constructor();
124 
125 
127 
131  constructor(hash<auto> options, *hash<auto> tags);
132 
133 
135  *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
136 
137 
139 
145  hash<DataTypeInfo> getInputInfo();
146 
147 
149  hash<DataTypeInfo> getInfo();
150 
151 
153  *hash<string, hash<DataFieldInfo>> getFieldInfo();
154 
155 
158 
159 
161  bool isAssignableFrom(Type t);
162 
163 
165  bool isList();
166 
167 
169  bool isMandatory();
170 
171 
173  *AbstractDataField getField(string field_name);
174 
175 
177  bool hasType();
178 
179 
181  string getBaseTypeName();
182 
183 
185  int getBaseTypeCode();
186 
187 
189  *hash<string, bool> getDirectTypeHash();
190 
191 
193  bool isOrNothingType();
194 
195 
197  *AbstractDataProviderType getFieldType(string field_name);
198 
199 
201  auto getOptionValue(string opt);
202 
203 
205  *hash<auto> getOptions();
206 
207 
209 
214  setOption(string opt, auto value);
215 
216 
218 
222  setOptions(hash<auto> options);
223 
224 
226  auto getTag(string tag);
227 
228 
230  *hash<auto> getTags();
231 
232 
234 
240 
241 
243 
251 
252 
254  abstract string getName();
255 
257  abstract *Type getValueType();
258 
261 
263  abstract *hash<string, AbstractDataField> getFields();
264 
266  abstract hash<string, bool> getAcceptTypeHash();
267 
269  abstract hash<string, bool> getReturnTypeHash();
270 
272 
276  abstract auto acceptsValue(auto value);
277 
279  static AbstractDataProviderType get(Type type, *hash<auto> options, *hash<auto> tags);
280 
282 
285  static AbstractDataProviderType get(string typename, *hash<auto> options);
286 
288 protected:
289  setOptionIntern(string opt, auto value);
290 public:
291 
292 };
293 };
const TypeCodeMap
maps type codes to type names
Definition: AbstractDataProviderType.qc.dox.h:29
*AbstractDataField getField(string field_name)
Returns the given field, if present, or NOTHING if not.
string name
the name of the type
Definition: AbstractDataProviderType.qc.dox.h:60
*hash< auto > getOptions()
Returns options set on the type.
const DTT_FromLocation
Tag indicates that a string value can indicate a location.
Definition: AbstractDataProviderType.qc.dox.h:101
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:58
setOption(string opt, auto value)
sets the given option on the type
const OptimalQoreSoftDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names ...
Definition: AbstractDataProviderType.qc.dox.h:41
hash< DataTypeInfo > getInfo()
Returns a description of the type as a hash.
*hash< auto > options
output: current transformation option values
Definition: AbstractDataProviderType.qc.dox.h:66
*hash< auto > tags
Any tags set on the type.
Definition: AbstractDataProviderType.qc.dox.h:90
bool isMandatory()
Returns True if the type must have a value.
abstract auto acceptsValue(auto value)
Returns the value if the value can be assigned to the type.
abstract *hash< string, AbstractDataField > getFields()
Returns the fields of the data structure; if any.
hash< string, hash< DataFieldInfo > > fields
any fields supported by the type
Definition: AbstractDataProviderType.qc.dox.h:81
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
string base_type
output: base type
Definition: AbstractDataProviderType.qc.dox.h:69
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
output: transformation options supported by the type
Definition: AbstractDataProviderType.qc.dox.h:63
const False
describes type options
Definition: AbstractDataProviderType.qc.dox.h:49
*hash< auto > tags
type tags
Definition: AbstractDataProviderType.qc.dox.h:118
const NothingType
bool hasType()
Returns True if the type is not a wildcard type.
bool mandatory
output: can be null / missing?
Definition: AbstractDataProviderType.qc.dox.h:72
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
string type
the option value type
Definition: AbstractDataProviderType.qc.dox.h:51
list< string > types_accepted
output: list of types accepted
Definition: AbstractDataProviderType.qc.dox.h:75
setOptions(hash< auto > options)
sets options on the type
const OptimalQoreDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names ...
Definition: AbstractDataProviderType.qc.dox.h:35
abstract *Type getValueType()
Returns the base type for the type, if any.
*hash< auto > getTags()
Returns tags set on the type.
bool isAssignableFrom(AbstractDataProviderType t)
Returns True if this type can be assigned from values of the argument type.
hash< auto > options
type options
Definition: AbstractDataProviderType.qc.dox.h:115
abstract hash< string, bool > getReturnTypeHash()
Returns a hash of types returned by this type; keys are type names.
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:105
string desc
the description of the option
Definition: AbstractDataProviderType.qc.dox.h:54
string type(auto arg)
const DTT_FromFile
Tag indicating that a string value can be taken from a file.
Definition: AbstractDataProviderType.qc.dox.h:98
abstract hash< string, bool > getAcceptTypeHash()
Returns a hash of types accepted by this type; keys are type names.
describes a data type based on a hashdecl
Definition: AbstractDataField.qc.dox.h:47
AbstractDataProviderType getOrNothingType()
Returns an "or nothing" type equivalent to the current type.
list< string > types_returned
input: list of types returned
Definition: AbstractDataProviderType.qc.dox.h:78
int getBaseTypeCode()
Returns the base type code for the type.
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27
const DataTypeMap
maps Qore type name constant values to data type objects
Definition: AbstractDataProviderType.qc.dox.h:45
*hash< string, hash< DataFieldInfo > > getFieldInfo()
Returns information on fields supported.
abstract *AbstractDataProviderType getElementType()
Returns the subtype (for lists or hashes) if there is only one.
string getBaseTypeName()
Returns the base type name for the type; must be a standard Qore base type name.
auto getTag(string tag)
Returns the value of the given tag.
*AbstractDataProviderType getFieldType(string field_name)
get the given field type if it exists, otherwise return NOTHING
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:84
bool isList()
Returns True if this type is a list.
abstract string getName()
Returns the type name.
hash< DataTypeInfo > getInputInfo()
Returns a description of the type as an input type.
*hash< DataTypeInfo > default_field_type_info
default type for fields not listed in fields
Definition: AbstractDataProviderType.qc.dox.h:87
auto getOptionValue(string opt)
Returns the value of the given option.
setOptionIntern(string opt, auto value)
sets the given option without any validation of the option
*hash< string, bool > getDirectTypeHash()
Returns a hash of native base type code keys where no translations are performed; keys are type codes...
bool isOrNothingType()
Returns True if the type also accepts NOTHING.