Zigbee Protocol Controller 1.6.0
attribute_mapper_ast_path_eval.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * # License
3 * <b>Copyright 2021 Silicon Laboratories Inc. www.silabs.com</b>
4 ******************************************************************************
5 * The licensor of this software is Silicon Laboratories Inc. Your use of this
6 * software is governed by the terms of Silicon Labs Master Software License
7 * Agreement (MSLA) available at
8 * www.silabs.com/about-us/legal/master-software-license-agreement. This
9 * software is distributed to you in Source Code format and is governed by the
10 * sections of the MSLA applicable to Source Code.
11 *
12 *****************************************************************************/
13
22#ifndef ATTRIBUTE_MAPPER_AST_PATH_EVAL_HPP
23#define ATTRIBUTE_MAPPER_AST_PATH_EVAL_HPP
24
25#include <string>
26#include <map>
27#include <float.h>
28#include <boost/optional.hpp>
29#include "attribute.hpp"
31
32namespace ast
33{
34struct nil;
35struct signed_;
36struct expression;
37struct condition;
38struct attribute;
39struct attribute_path_subscript;
40struct mapping;
41struct assignment;
42
57 explicit attribute_path_eval(const attribute_store::attribute context) :
59 {}
60
62 attribute_store::attribute operator()(const ast::operand &oper);
63
65 attribute_store::attribute operator()(const nil &nul);
66
68 attribute_store::attribute operator()(const attribute_store_type_t type_id);
69
71 attribute_store::attribute
72 operator()(const attribute_path_subscript &subscript) const;
73
75 attribute_store::attribute operator()(
76 const std::vector<attribute_path_element> &paths);
77
81 inline bool all_elements_parsed() const
82 {
83 return elements_left == 0;
84 }
85
89 inline bool last_token_failed() const
90 {
91 return elements_left == 1;
92 }
93
98 {
99 return last_type_id;
100 }
101
105 size_t get_depth(const std::vector<attribute_path_element> &paths) const;
106
107 private:
108 //ID of last type passed
111 attribute_store::attribute context = 0;
112};
113
114} // namespace ast
115
116#endif //ATTRIBUTE_MAPPER_AST_EVAL_HPP
117
attribute store C++ wrapper.
Definition: attribute_mapper_ast.hpp:39
x3::variant< ast::nil, uint32_t, float, x3::forward_ast< attribute >, x3::forward_ast< signed_ >, x3::forward_ast< expression >, x3::forward_ast< condition >, x3::forward_ast< function_invokation > > operand
Operands.
Definition: attribute_mapper_ast.hpp:95
The attribute path evaluator evalues a full attribute path and returns the matching attribute store a...
Definition: attribute_mapper_ast_path_eval.hpp:51
attribute_store::attribute operator()(const ast::operand &oper)
Evaluates numbers and expressions into attributes.
attribute_store::attribute operator()(const std::vector< attribute_path_element > &paths)
parse a path list return the last successfull evaluated attribute
bool last_token_failed() const
Definition: attribute_mapper_ast_path_eval.hpp:89
attribute_store_type_t last_fail_type() const
Definition: attribute_mapper_ast_path_eval.hpp:97
size_t get_depth(const std::vector< attribute_path_element > &paths) const
attribute_store::attribute operator()(const attribute_path_subscript &subscript) const
Subscript operator.
bool all_elements_parsed() const
Definition: attribute_mapper_ast_path_eval.hpp:81
attribute_path_eval(const attribute_store::attribute context)
Construct a new attribute path eval object.
Definition: attribute_mapper_ast_path_eval.hpp:57
attribute_store::attribute operator()(const nil &nul)
hat operator ^ (parent)
int elements_left
Definition: attribute_mapper_ast_path_eval.hpp:110
attribute_store_type_t last_type_id
Definition: attribute_mapper_ast_path_eval.hpp:109
attribute_store::attribute context
Definition: attribute_mapper_ast_path_eval.hpp:111
attribute_store::attribute operator()(const attribute_store_type_t type_id)
just given by type
Attribute path subscript.
Definition: attribute_mapper_ast.hpp:160
Definition: attribute_mapper_ast.hpp:42