ros2_introspection.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright 2016-2017 Davide Faconti
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 * *******************************************************************/
34 #pragma once
35 
36 #include <unordered_map>
38 #include <rosbag2_cpp/typesupport_helpers.hpp>
39 #include <rosbag2_cpp/types/introspection_message.hpp>
40 #include <rosidl_typesupport_cpp/identifier.hpp>
41 #include <rosidl_typesupport_introspection_cpp/identifier.hpp>
42 
44 
45 struct FlatMessage {
46 
48  const StringTree* tree;
49 
52  std::vector< std::pair<StringTreeLeaf, double> > values;
53 
56  std::vector< std::pair<StringTreeLeaf, std::string> > strings;
57 
61  std::vector< std::pair<StringTreeLeaf, BufferView> > blobs;
62 };
63 
64 struct TopicInfo{
65 
66  TopicInfo(const std::string& type);
67 
68  std::string topic_type;
70 
71  std::shared_ptr<rcpputils::SharedLibrary> _introspection_library;
72  const rosidl_message_type_support_t *introspection_support;
73 
74  std::shared_ptr<rcpputils::SharedLibrary> _support_library;
75  const rosidl_message_type_support_t *type_support;
76 
77  static rcutils_allocator_t allocator;
78 };
79 
80 enum MaxArrayPolicy: bool {
83 };
84 
85 class Parser{
86 
87 public:
88  Parser(const std::string &topic_name, const std::string& type_name);
89 
90  enum{ MAX_ARRAY_SIZE = 9999 };
91 
92  void setMaxArrayPolicy( MaxArrayPolicy discard_policy, size_t max_size );
93 
94  MaxArrayPolicy maxArrayPolicy() const;
95 
96  size_t maxArraySize() const;
97 
98  bool deserializeIntoFlatMessage(const rcutils_uint8_array_t *msg,
99  FlatMessage* flat_container_output) const;
100 
101  const TopicInfo& topicInfo() const;
102 
103 private:
104 
106 
108 
110 
112 };
113 
114 bool TypeHasHeader(const rosidl_message_type_support_t* type_support);
115 
116 }
type
static rcutils_allocator_t allocator
std::shared_ptr< rcpputils::SharedLibrary > _support_library
std::vector< std::pair< StringTreeLeaf, std::string > > strings
const rosidl_message_type_support_t * type_support
std::shared_ptr< rcpputils::SharedLibrary > _introspection_library
const StringTree * tree
Tree that the StringTreeLeaf(s) refer to.
std::vector< std::pair< StringTreeLeaf, double > > values
std::string type_name(lua_State *L, type t)
const rosidl_message_type_support_t * introspection_support
std::vector< std::pair< StringTreeLeaf, BufferView > > blobs
bool TypeHasHeader(const rosidl_message_type_support_t *type_support)
msg


plotjuggler_ros
Author(s): Davide Faconti
autogenerated on Fri Jun 23 2023 02:28:03