Qore DataProvider Module Reference  2.2
AbstractDataProviderType.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
27 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 
98 const DTT_FromFile = "from_file";
99 
101 const DTT_FromLocation = "from_location";
102 
104 const DTT_ClientOnly = "client_only";
106 
108 class AbstractDataProviderType : public Serializable {
109 
110 public:
111  static Type nothingType = Reflection::NothingType;
112  static Type anyType = Reflection::AutoType;
113  // not initialized here to workaround issue #4048 (circular initializtion error)
114  static AbstractDataProviderType anyDataType;
115 
116 protected:
118  hash<auto> options;
119 
121  *hash<auto> tags;
122 
123 public:
124 
127 
128 
130 
134  constructor(hash<auto> options, *hash<auto> tags);
135 
136 
138  *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
139 
140 
142 
148  hash<DataTypeInfo> getInputInfo();
149 
150 
152  hash<DataTypeInfo> getInfo();
153 
154 
156  *hash<string, hash<DataFieldInfo>> getFieldInfo();
157 
158 
161 
162 
164  bool isAssignableFrom(Type t);
165 
166 
168  bool isList();
169 
170 
172  bool isMandatory();
173 
174 
176  *AbstractDataField getField(string field_name);
177 
178 
180  bool hasType();
181 
182 
184  string getBaseTypeName();
185 
186 
189 
190 
192  *hash<string, bool> getDirectTypeHash();
193 
194 
197 
198 
201 
202 
204  auto getOptionValue(string opt);
205 
206 
208  *hash<auto> getOptions();
209 
210 
212 
217  setOption(string opt, auto value);
218 
219 
221 
225  setOptions(hash<auto> options);
226 
227 
229  auto getTag(string tag);
230 
231 
233  *hash<auto> getTags();
234 
235 
237 
243 
244 
246 
254 
255 
257  abstract string getName();
258 
260  abstract *Type getValueType();
261 
264 
266  abstract *hash<string, AbstractDataField> getFields();
267 
269  abstract hash<string, bool> getAcceptTypeHash();
270 
272  abstract hash<string, bool> getReturnTypeHash();
273 
275 
279  abstract auto acceptsValue(auto value);
280 
282  static AbstractDataProviderType get(Type type, *hash<auto> options, *hash<auto> tags);
283 
285 
288  static AbstractDataProviderType get(string typename, *hash<auto> options);
289 
291 protected:
292  setOptionIntern(string opt, auto value);
293 public:
294 
295 };
296 };
describes a data type based on a hashdecl
Definition: AbstractDataField.qc.dox.h:47
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:108
bool hasType()
Returns True if the type is not a wildcard type.
*hash< string, hash< DataFieldInfo > > getFieldInfo()
Returns information on fields supported.
int getBaseTypeCode()
Returns the base type code for the type.
*hash< auto > tags
type tags
Definition: AbstractDataProviderType.qc.dox.h:121
bool isAssignableFrom(AbstractDataProviderType t)
Returns True if this type can be assigned from values of the argument type.
*AbstractDataProviderType getFieldType(string field_name)
get the given field type if it exists, otherwise return NOTHING
hash< auto > options
type options
Definition: AbstractDataProviderType.qc.dox.h:118
hash< DataTypeInfo > getInfo()
Returns a description of the type as a hash.
bool isAssignableFrom(Type t)
Returns True if this type can be assigned from values of the argument type.
abstract *AbstractDataProviderType getElementType()
Returns the subtype (for lists or hashes) if there is only one.
*hash< string, bool > getDirectTypeHash()
Returns a hash of native base type code keys where no translations are performed; keys are type codes...
hash< DataTypeInfo > getInputInfo()
Returns a description of the type as an input type.
bool isMandatory()
Returns True if the type must have a value.
bool isList()
Returns True if this type is a list.
string getBaseTypeName()
Returns the base type name for the type; must be a standard Qore base type name.
bool isOrNothingType()
Returns True if the type also accepts NOTHING.
abstract auto acceptsValue(auto value)
Returns the value if the value can be assigned to the type.
static AbstractDataProviderType get(string typename, *hash< auto > options)
Returns an appropriate object for the given type.
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
AbstractDataProviderType getOrNothingType()
Returns an "or nothing" type equivalent to the current type.
abstract string getName()
Returns the type name.
abstract *hash< string, AbstractDataField > getFields()
Returns the fields of the data structure; if any.
setOptionIntern(string opt, auto value)
sets the given option without any validation of the option
setOptions(hash< auto > options)
sets options on the type
abstract *Type getValueType()
Returns the base type for the type, if any.
*AbstractDataField getField(string field_name)
Returns the given field, if present, or NOTHING if not.
*hash< auto > getOptions()
Returns options set on the type.
constructor(hash< auto > options, *hash< auto > tags)
creates the type and sets options
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
setOption(string opt, auto value)
sets the given option on the type
abstract hash< string, bool > getReturnTypeHash()
Returns a hash of types returned by this type; keys are type names.
*hash< auto > getTags()
Returns tags set on the type.
abstract hash< string, bool > getAcceptTypeHash()
Returns a hash of types accepted by this type; keys are type names.
static AbstractDataProviderType get(Type type, *hash< auto > options, *hash< auto > tags)
Returns an appropriate object for the given type.
auto getOptionValue(string opt)
Returns the value of the given option.
auto getTag(string tag)
Returns the value of the given tag.
const False
const NothingType
string type(auto arg)
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
const DTT_FromLocation
Tag indicates that a string value can indicate a location.
Definition: AbstractDataProviderType.qc.dox.h:101
const OptimalQoreDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition: AbstractDataProviderType.qc.dox.h:35
const TypeCodeMap
maps type codes to type names
Definition: AbstractDataProviderType.qc.dox.h:29
const DTT_FromFile
Tag indicating that a string value can be taken from a file.
Definition: AbstractDataProviderType.qc.dox.h:98
const OptimalQoreSoftDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition: AbstractDataProviderType.qc.dox.h:41
const DTT_ClientOnly
Tag indicates that the value is only applicable in client contexts.
Definition: AbstractDataProviderType.qc.dox.h:104
describes type options
Definition: AbstractDataProviderType.qc.dox.h:49
string desc
the description of the option
Definition: AbstractDataProviderType.qc.dox.h:54
string type
the option value type
Definition: AbstractDataProviderType.qc.dox.h:51
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:58
*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
*hash< DataTypeInfo > default_field_type_info
default type for fields not listed in fields
Definition: AbstractDataProviderType.qc.dox.h:87
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
output: transformation options supported by the type
Definition: AbstractDataProviderType.qc.dox.h:63
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 mandatory
output: can be null / missing?
Definition: AbstractDataProviderType.qc.dox.h:72
list< string > types_returned
input: list of types returned
Definition: AbstractDataProviderType.qc.dox.h:78
string base_type
output: base type
Definition: AbstractDataProviderType.qc.dox.h:69
list< string > types_accepted
output: list of types accepted
Definition: AbstractDataProviderType.qc.dox.h:75
hash< string, hash< DataFieldInfo > > fields
any fields supported by the type
Definition: AbstractDataProviderType.qc.dox.h:81
string name
the name of the type
Definition: AbstractDataProviderType.qc.dox.h:60