RMW desert 1.0
Loading...
Searching...
No Matches
DesertSubscriber.h
Go to the documentation of this file.
1/****************************************************************************
2 * Copyright (C) 2024 Davide Costa *
3 * *
4 * This file is part of RMW desert. *
5 * *
6 * RMW desert is free software: you can redistribute it and/or modify it *
7 * under the terms of the GNU General Public License as published by the *
8 * Free Software Foundation, either version 3 of the License, or any *
9 * later version. *
10 * *
11 * RMW desert is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with RMW desert. If not, see <http://www.gnu.org/licenses/>. *
18 ****************************************************************************/
19
32#ifndef DESERT_SUBSCRIBER_H_
33#define DESERT_SUBSCRIBER_H_
34
37#include "rosidl_typesupport_introspection_cpp/identifier.hpp"
38#include "rosidl_typesupport_introspection_c/identifier.h"
39#include "rosidl_typesupport_introspection_cpp/message_introspection.hpp"
40#include "rosidl_typesupport_introspection_c/message_introspection.h"
41#include "rosidl_typesupport_introspection_cpp/service_introspection.hpp"
42#include "rosidl_typesupport_introspection_c/service_introspection.h"
43#include "rosidl_typesupport_introspection_cpp/field_types.hpp"
44#include "rosidl_typesupport_introspection_c/field_types.h"
45
46#include "rosidl_runtime_c/message_type_support_struct.h"
47
48#include "rmw/types.h"
49
50#include <vector>
51#include <string>
52#include <regex>
53
56#include "CBorStream.h"
58
60{
61 public:
69 DesertSubscriber(std::string topic_name, const rosidl_message_type_support_t * type_supports, rmw_gid_t gid);
70
80 bool has_data();
90 void read_data(void * msg);
91
99 rmw_gid_t get_gid();
107 std::string get_topic_name();
115 std::string get_type_name();
116
117 private:
118 uint8_t _id;
119 rmw_gid_t _gid;
120 std::string _name;
121 cbor::RxStream _data_stream;
122
123 int _c_cpp_identifier;
124 const void * _members;
125
126 const void * get_members(const rosidl_message_type_support_t * type_support);
127 const rosidl_message_type_support_t * get_type_support(const rosidl_message_type_support_t * type_supports);
128
129};
130
131#endif
Classes used to convert data types into a CBOR encoded stream.
Namespace containing serialization functions.
Definition DesertSubscriber.h:60
void read_data(void *msg)
Read a publication from the publisher.
Definition DesertSubscriber.cpp:19
std::string get_topic_name()
Retreive the topic name of the current entity.
Definition DesertSubscriber.cpp:40
rmw_gid_t get_gid()
Retreive the gid of the current entity.
Definition DesertSubscriber.cpp:35
bool has_data()
Check if there is available data for the registered topic.
Definition DesertSubscriber.cpp:13
std::string get_type_name()
Retreive the message type of the current entity.
Definition DesertSubscriber.cpp:45
Definition CBorStream.h:244