6 #include <idl_defines.h> 7 #include <ast_structure.h> 9 #include <utl_identifier.h> 10 #include <ast_union.h> 11 #include <ast_array.h> 20 switch (type->unaliased_type()->node_type()) {
21 case AST_Decl::NT_pre_defined:
22 case AST_Decl::NT_string:
23 case AST_Decl::NT_wstring:
24 case AST_Decl::NT_enum:
26 case AST_Decl::NT_struct:
28 case AST_Decl::NT_union:
30 case AST_Decl::NT_array:
32 case AST_Decl::NT_sequence:
80 , implied_keys_(false)
124 AST_Type* type = root->field_type()->unaliased_type();
193 AST_Structure* struct_root =
dynamic_cast<AST_Structure*
>(
root_);
197 const Fields fields(struct_root);
206 bool key_annotation_value;
207 const bool has_key_annotation =
be_global->check_key(*i, key_annotation_value);
208 if (has_key_annotation && key_annotation_value) {
209 implied_keys_ =
false;
218 bool key_annotation_value;
219 const bool has_key_annotation =
be_global->check_key(*i, key_annotation_value);
220 const bool implied_key =
implied_keys_ && !(has_key_annotation && !key_annotation_value);
221 if (key_annotation_value || implied_key) {
227 throw Error(*i, std::string(
"field is ") + (implied_key ?
"implicitly" :
"explicitly") +
228 " marked as key, but does not contain any keys.");
236 }
else if (
pos_ == 0) {
244 AST_Array* array_node =
dynamic_cast<AST_Array*
>(
root_);
251 for (
unsigned i = 0; i < array_dimension_count; i++) {
257 AST_Type* type_node = array_node->base_type();
258 AST_Type* unaliased_type_node = type_node->unaliased_type();
265 throw Error(array_node,
"array type is marked as key, but its base type " 266 "does not contain any keys.");
276 AST_Union* union_node =
dynamic_cast<AST_Union*
>(
root_);
284 throw Error(
root_,
"sequence types are not supported as keys");
332 return !(*
this == other);
337 std::stringstream ss;
344 std::stringstream ss;
351 const char* error_msg =
"Can't get path for invalid topic key iterator!";
353 AST_Structure* struct_root =
dynamic_cast<AST_Structure*
>(
root_);
358 ss << (
level_ ?
"." :
"");
362 ss << field->local_name()->get_string();
368 std::vector<size_t>::reverse_iterator di, dfinished =
dimensions_.rend();
371 std::vector<size_t> results;
372 for (di =
dimensions_.rbegin(); di != dfinished; ++di) {
374 results.push_back(acc % *di);
378 std::vector<size_t>::reverse_iterator
379 ri = results.rbegin(),
380 rfinished = results.rend();
381 for (; ri != rfinished; ++ri) {
382 ss <<
'[' << *ri <<
']';
414 AST_Field* field = 0;
434 return field->field_type();
RootType root_type() const
size_t element_count_
Element Count in the Array.
bool operator==(const Iterator &other) const
static RootType root_type(AST_Type *type)
virtual const char * what() const
AST_Decl * current_value_
Current value of the entire iterator stack.
Iterator & operator=(const Iterator &other)
AST_Decl * operator*() const
static FilterEvaluator::AstNodeWrapper child(const FilterEvaluator::AstNodeWrapper &node, size_t idx)
bool operator!=(const Iterator &other) const
AST_Type * get_ast_type() const
bool implied_keys_
Used in struct field key iteration.
std::string canonical_name(UTL_ScopedName *sn)
static Iterator end_value()
RootType parents_root_type() const
std::vector< size_t > dimensions_
The Dimensions of the Array.
void path_i(std::stringstream &ss, bool canonical=false)
Error & operator=(const Error &error)
std::string canonical_path()
BE_GlobalData * be_global
TopicKeys & operator=(const TopicKeys &other)
RootType root_type() const