Ariles
common.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2018-2020 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 
15 
16 
17 // http://docs.ros.org/api/xmlrpcpp/html/classXmlRpc_1_1XmlRpcValue.html
18 #include <XmlRpcValue.h>
19 
20 
21 namespace ariles2
22 {
23  namespace ns_rosparam
24  {
26 
27 
28  class ARILES2_LIB_LOCAL ImplBase
29  {
30  public:
31  /// Stack of nodes.
32  std::vector<NodeWrapper> node_stack_;
33 
34  std::string root_name_;
35  XmlRpc::XmlRpcValue root_value_;
36 
37  ::ros::NodeHandle nh_;
38 
39 
40  public:
41  /**
42  * @brief Get current node
43  *
44  * @return pointer to the current node
45  */
46  XmlRpc::XmlRpcValue &getRawNode(const std::size_t depth)
47  {
48  if (node_stack_[depth].isArray())
49  {
50  return (getRawNode(depth - 1)[node_stack_[depth].index_]);
51  }
52  return (*node_stack_[depth].node_);
53  }
54 
55 
56  XmlRpc::XmlRpcValue &getRawNode()
57  {
58  return (getRawNode(node_stack_.size() - 1));
59  }
60  };
61  } // namespace ns_rosparam
62 } // namespace ariles2
ariles2
Definition: basic.h:16
ariles2::ns_rosparam::ImplBase::root_value_
XmlRpc::XmlRpcValue root_value_
Definition: common.h:35
ariles2::ns_rosparam::ImplBase
Definition: common.h:28
ariles2::ns_rosparam::ImplBase::node_stack_
std::vector< NodeWrapper > node_stack_
Stack of nodes.
Definition: common.h:32
ariles2::ns_rosparam::ImplBase::getRawNode
XmlRpc::XmlRpcValue & getRawNode()
Definition: common.h:56
ariles2::ns_rosparam::NodeWrapper
serialization::Node< XmlRpc::XmlRpcValue * > NodeWrapper
Definition: common.h:25
rosparam.h
ariles2::ns_rosparam::ImplBase::getRawNode
XmlRpc::XmlRpcValue & getRawNode(const std::size_t depth)
Get current node.
Definition: common.h:46
ariles2::serialization::Node
Definition: serialization.h:49
ariles2::ns_rosparam::ImplBase::nh_
::ros::NodeHandle nh_
Definition: common.h:37
ariles2::ns_rosparam::ImplBase::root_name_
std::string root_name_
Definition: common.h:34