Qore DataProvider Module Reference  1.0.2
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("nothing");
97  static Type anyType("auto");
98 
99 protected:
101  hash<auto> options;
102 
103 public:
104 
107 
108 
110 
114  constructor(hash<auto> options);
115 
116 
118  *hash<string, hash<DataProviderTypeOptionInfo>> getSupportedOptions();
119 
120 
122 
126  hash<DataTypeInfo> getInputInfo();
127 
128 
130  hash<DataTypeInfo> getInfo();
131 
132 
134  *hash<string, hash<DataFieldInfo>> getFieldInfo();
135 
136 
139 
140 
142  bool isAssignableFrom(Type t);
143 
144 
146  bool isList();
147 
148 
150  bool isMandatory();
151 
152 
154  *AbstractDataField getField(string field_name);
155 
156 
158  bool hasType();
159 
160 
162  string getBaseTypeName();
163 
164 
167 
168 
170  *hash<string, bool> getDirectTypeHash();
171 
172 
175 
176 
179 
180 
182  auto getOptionValue(string opt);
183 
184 
186  *hash<auto> getOptions();
187 
188 
190 
195  setOption(string opt, auto value);
196 
197 
199 
203  setOptions(hash<auto> options);
204 
205 
207 
213 
214 
216 
224 
225 
227  abstract string getName();
228 
230  abstract *Type getValueType();
231 
234 
236  abstract *hash<string, AbstractDataField> getFields();
237 
239  abstract hash<string, bool> getAcceptTypeHash();
240 
242  abstract hash<string, bool> getReturnTypeHash();
243 
245 
249  abstract auto acceptsValue(auto value);
250 
252  static AbstractDataProviderType get(Type type, *hash<auto> options);
253 
255 
258  static AbstractDataProviderType get(string typename, *hash<auto> options);
259 
261 protected:
262  setOptionIntern(string opt, auto value);
263 public:
264 
265 };
266 };
DataProvider::AbstractDataProviderType::getReturnTypeHash
abstract hash< string, bool > getReturnTypeHash()
Returns a hash of types returned by this type; keys are type names.
DataProvider::DataProviderTypeOptionInfo::type
string type
the option value type
Definition: AbstractDataProviderType.qc.dox.h:56
DataProvider::DataTypeInfo::base_type
string base_type
output: base type
Definition: AbstractDataProviderType.qc.dox.h:74
DataProvider::AbstractDataProviderType::getSoftType
AbstractDataProviderType getSoftType()
Returns a "soft" type equivalent to the current type.
DataProvider::AbstractDataProviderType::isAssignableFrom
bool isAssignableFrom(Type t)
Returns True if this type can be assigned from values of the argument type.
DataProvider::AbstractDataProviderType::constructor
constructor(hash< auto > options)
creates the type and sets options
DataProvider::AbstractDataProviderType
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:93
DataProvider::AbstractDataProviderType::getBaseTypeName
string getBaseTypeName()
Returns the base type name for the type; must be a standard Qore base type name.
DataProvider::AbstractDataProviderType::setOption
setOption(string opt, auto value)
sets the given option on the type
DataProvider::AbstractDataProviderType::hasType
bool hasType()
Returns True if the type is not a wildcard type.
DataProvider::AbstractDataProviderType::get
static AbstractDataProviderType get(string typename, *hash< auto > options)
Returns an appropriate object for the given type.
DataProvider::DataTypeInfo::can_manage_fields
bool can_manage_fields
if fields can be added dynamically to the type
Definition: AbstractDataProviderType.qc.dox.h:89
type
string type(auto arg)
DataProvider::AbstractDataProviderType::getInfo
hash< DataTypeInfo > getInfo()
Returns a description of the type as a hash.
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(Type type, *hash< auto > options)
Returns an appropriate object for the given type.
DataProvider::AbstractDataProviderType::getInputInfo
hash< DataTypeInfo > getInputInfo()
Returns a description of the type as an input type.
DataProvider::AbstractDataField
describes a data type based on a hashdecl
Definition: AbstractDataField.qc.dox.h:49
DataProvider
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:32
DataProvider::AbstractDataProviderType::isAssignableFrom
bool isAssignableFrom(AbstractDataProviderType t)
Returns True if this type can be assigned from values of the argument type.
DataProvider::DataTypeInfo::options
*hash< auto > options
output: current transformation option values
Definition: AbstractDataProviderType.qc.dox.h:71
DataProvider::DataTypeInfo::types_returned
list< string > types_returned
input: list of types returned
Definition: AbstractDataProviderType.qc.dox.h:83
DataProvider::DataProviderTypeOptionInfo::desc
string desc
the description of the option
Definition: AbstractDataProviderType.qc.dox.h:59
DataProvider::AbstractDataProviderType::getElementType
abstract *AbstractDataProviderType getElementType()
Returns the subtype (for lists or hashes) if there is only one.
DataProvider::DataProviderTypeOptionInfo
describes type options
Definition: AbstractDataProviderType.qc.dox.h:54
DataProvider::AbstractDataProviderType::getFields
abstract *hash< string, AbstractDataField > getFields()
Returns the fields of the data structure; if any.
DataProvider::AbstractDataProviderType::getBaseTypeCode
int getBaseTypeCode()
Returns the base type code for the type.
DataProvider::AbstractDataProviderType::getOptionValue
auto getOptionValue(string opt)
Returns the value of the given option.
DataProvider::DataTypeInfo::name
string name
the name of the type
Definition: AbstractDataProviderType.qc.dox.h:65
DataProvider::AbstractDataProviderType::getFieldType
*AbstractDataProviderType getFieldType(string field_name)
get the given field type if it exists, otherwise return NOTHING
DataProvider::AbstractDataProviderType::getOrNothingType
AbstractDataProviderType getOrNothingType()
Returns an "or nothing" type equivalent to the current type.
DataProvider::AbstractDataProviderType::setOptions
setOptions(hash< auto > options)
sets options on the type
DataProvider::AbstractDataProviderType::getSupportedOptions
*hash< string, hash< DataProviderTypeOptionInfo > > getSupportedOptions()
Returns supported options.
DataProvider::AbstractDataProviderType::getFieldInfo
*hash< string, hash< DataFieldInfo > > getFieldInfo()
Returns information on fields supported.
DataProvider::OptimalQoreSoftDataTypeMap
const OptimalQoreSoftDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition: AbstractDataProviderType.qc.dox.h:46
DataProvider::DataTypeInfo
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:63
DataProvider::AbstractDataProviderType::getOptions
*hash< auto > getOptions()
Returns options set on the type.
False
const False
DataProvider::DataTypeInfo::mandatory
bool mandatory
output: can be null / missing?
Definition: AbstractDataProviderType.qc.dox.h:77
DataProvider::TypeCodeMap
const TypeCodeMap
maps type codes to type names
Definition: AbstractDataProviderType.qc.dox.h:34
DataProvider::AbstractDataProviderType::options
hash< auto > options
type options
Definition: AbstractDataProviderType.qc.dox.h:101
DataProvider::AbstractDataProviderType::getName
abstract string getName()
Returns the type name.
DataProvider::DataTypeInfo::fields
hash< string, hash< DataFieldInfo > > fields
any fields supported by the type
Definition: AbstractDataProviderType.qc.dox.h:86
DataProvider::AbstractDataProviderType::getValueType
abstract *Type getValueType()
Returns the base type for the type, if any.
DataProvider::DataTypeInfo::types_accepted
list< string > types_accepted
output: list of types accepted
Definition: AbstractDataProviderType.qc.dox.h:80
DataProvider::OptimalQoreDataTypeMap
const OptimalQoreDataTypeMap
maps Qore type name constant values from the Type namespace to optimal Qore types names
Definition: AbstractDataProviderType.qc.dox.h:40
DataProvider::AbstractDataProviderType::isList
bool isList()
Returns True if this type is a list.
DataProvider::AbstractDataProviderType::isMandatory
bool isMandatory()
Returns True if the type must have a value.
DataProvider::AbstractDataProviderType::getField
*AbstractDataField getField(string field_name)
Returns the given field, if present, or NOTHING if not.
DataProvider::AbstractDataProviderType::constructor
constructor()
creates the type
DataProvider::AbstractDataProviderType::getAcceptTypeHash
abstract hash< string, bool > getAcceptTypeHash()
Returns a hash of types accepted by this type; keys are type names.
DataProvider::AbstractDataProviderType::setOptionIntern
setOptionIntern(string opt, auto value)
sets the given option without any validation of the option
DataProvider::AbstractDataProviderType::isOrNothingType
bool isOrNothingType()
Returns True if the type also accepts NOTHING.
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::DataTypeMap
const DataTypeMap
maps Qore type name constant values to data type objects
Definition: AbstractDataProviderType.qc.dox.h:50
DataProvider::DataTypeInfo::supported_options
*hash< string, hash< DataProviderTypeOptionInfo > > supported_options
output: transformation options supported by the type
Definition: AbstractDataProviderType.qc.dox.h:68