RMW desert 1.0
Loading...
Searching...
No Matches
DesertNode.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_NODE_H_
33#define DESERT_NODE_H_
34
37#include "rmw/rmw.h"
38#include "rmw/types.h"
39
40#include <vector>
41#include <string>
42
45#include "CBorStream.h"
46#include "DesertPublisher.h"
47#include "DesertSubscriber.h"
48#include "DesertClient.h"
49#include "DesertService.h"
50#include "Discovery.h"
51#include "TopicsConfig.h"
52
54{
55 public:
63 DesertNode(std::string name, std::string namespace_, rmw_gid_t gid);
65
75
85
94 void add_client(DesertClient * cli);
95
104 void add_service(DesertService * ser);
105
115
125
134 void remove_client(DesertClient * cli);
135
144 void remove_service(DesertService * ser);
145
153 rmw_gid_t get_gid();
154
155 private:
156 rmw_gid_t _gid;
157 std::string _name;
158 std::string _namespace;
159 cbor::TxStream _discovery_beacon_data_stream;
160 cbor::RxStream _discovery_request_data_stream;
161
162 std::vector<DesertPublisher *> _publishers;
163 std::vector<DesertSubscriber *> _subscribers;
164 std::vector<DesertClient *> _clients;
165 std::vector<DesertService *> _services;
166
167 void publish_all_beacons();
168
169 bool _discovery_done;
170 std::thread _discovery_request_thread;
171
172 void _discovery_request();
173
174};
175
176#endif
Classes used to convert data types into a CBOR encoded stream.
Implementation of the Client structure for DESERT.
Implementation of the Publisher structure for DESERT.
Implementation of the Service structure for DESERT.
Implementation of the Subscriber structure for DESERT.
Namespace used to provide discovery functionalities.
Class used to store configurations.
Definition DesertClient.h:61
Definition DesertNode.h:54
void add_service(DesertService *ser)
Add a service to the current node.
Definition DesertNode.cpp:65
void add_subscriber(DesertSubscriber *sub)
Add a subscriber to the current node.
Definition DesertNode.cpp:39
void add_publisher(DesertPublisher *pub)
Add a publisher to the current node.
Definition DesertNode.cpp:26
rmw_gid_t get_gid()
Retreive the gid of the current entity.
Definition DesertNode.cpp:142
void remove_subscriber(DesertSubscriber *sub)
Remove a subscriber from the current node.
Definition DesertNode.cpp:94
void remove_publisher(DesertPublisher *pub)
Remove a publisher from the current node.
Definition DesertNode.cpp:78
void remove_service(DesertService *ser)
Remove a service from the current node.
Definition DesertNode.cpp:126
void remove_client(DesertClient *cli)
Remove a client from the current node.
Definition DesertNode.cpp:110
void add_client(DesertClient *cli)
Add a client to the current node.
Definition DesertNode.cpp:52
Definition DesertPublisher.h:61
Definition DesertService.h:61
Definition DesertSubscriber.h:60
Definition CBorStream.h:244
Definition CBorStream.h:87