Qore DataProvider Module Reference  1.1
AbstractDataProviderType.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
25 // assume local scope for variables, do not use "$" signs
26 // require type definitions everywhere
28 // enable all warnings
29 
30 
32 namespace DataProvider {
34 const TypeCodeMap = ...;
35 
36 
38 
41 
42 
44 
47 
48 
50 const DataTypeMap = ...;
51 
52 
56  string type;
57 
59  string desc;
60 };
61 
63 public struct DataTypeInfo {
65  string name;
66 
68  *hash<string, hash<DataProviderTypeOptionInfo>> supported_options;
69 
71  *hash<auto> options;
72 
74  string base_type;
75 
77  bool mandatory;
78 
80  list<string> types_accepted;
81 
83  list<string> types_returned;
84 
86  hash<string, hash<DataFieldInfo>> fields;
87 
90 };
91 
93 class AbstractDataProviderType : public Serializable {
94 
95 public:
96  static Type nothingType = Reflection::NothingType;
97  static Type anyType = Reflection::AutoType;
98  // not initialized here to workaround issue #4048 (circular initializtion error)
99  static AbstractDataProviderType anyDataType;
100 
101 protected:
103  hash<auto> options;
104 
105 public:
106 
108  constructor();
109 
110 
112 
116  constructor(hash<auto> options);
117 
118 
120  *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
121 
122 
124 
128  hash<DataTypeInfo> getInputInfo();
129 
130 
132  hash<DataTypeInfo> getInfo();
133 
134 
136  *hash<string, hash<DataFieldInfo>> getFieldInfo();
137 
138 
141 
142 
144  bool isAssignableFrom(Type t);
145 
146 
148  bool isList();
149 
150 
152  bool isMandatory();
153 
154 
156  *AbstractDataField getField(string field_name);
157 
158 
160  bool hasType();
161 
162 
164  string getBaseTypeName();
165 
166 
168  int getBaseTypeCode();
169 
170 
172  *hash<string, bool> getDirectTypeHash();
173 
174 
176  bool isOrNothingType();
177 
178 
180  *AbstractDataProviderType getFieldType(string field_name);
181 
182 
184  auto getOptionValue(string opt);
185 
186 
188  *hash<auto> getOptions();
189 
190 
192 
197  setOption(string opt, auto value);
198 
199 
201 
205  setOptions(hash<auto> options);
206 
207 
209 
215 
216 
218 
226 
227 
229  abstract string getName();
230 
232  abstract *Type getValueType();
233 
236 
238  abstract *hash<string, AbstractDataField> getFields();
239 
241  abstract hash<string, bool> getAcceptTypeHash();
242 
244  abstract hash<string, bool> getReturnTypeHash();
245 
247 
251  abstract auto acceptsValue(auto value);
252 
254  static AbstractDataProviderType get(Type type, *hash<auto> options);
255 
257 
260  static AbstractDataProviderType get(string typename, *hash<auto> options);
261 
263 protected:
264  setOptionIntern(string opt, auto value);
265 public:
266 
267 };
268 };
const TypeCodeMap
maps type codes to type names
Definition: AbstractDataProviderType.qc.dox.h:34
*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:65
*hash< auto > getOptions()
Returns options set on the type.
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:63
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:46
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:71
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:86
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
string base_type
output: base type
Definition: AbstractDataProviderType.qc.dox.h:74
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
output: transformation options supported by the type
Definition: AbstractDataProviderType.qc.dox.h:68
const False
describes type options
Definition: AbstractDataProviderType.qc.dox.h:54
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:77
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
string type
the option value type
Definition: AbstractDataProviderType.qc.dox.h:56
list< string > types_accepted
output: list of types accepted
Definition: AbstractDataProviderType.qc.dox.h:80
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:40
abstract *Type getValueType()
Returns the base type for the type, if any.
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:103
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:93
string desc
the description of the option
Definition: AbstractDataProviderType.qc.dox.h:59
string type(auto arg)
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:49
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:83
int getBaseTypeCode()
Returns the base type code for the type.
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:32
const DataTypeMap
maps Qore type name constant values to data type objects
Definition: AbstractDataProviderType.qc.dox.h:50
*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.
*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
Definition: AbstractDataProviderType.qc.dox.h:89
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.
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.