json_plugin_router.h
Go to the documentation of this file.
1 //
2 // Created by nakakura on 22/08/31.
3 //
4 
5 #ifndef SKYWAY_PLUGIN_UDP_PIPE_JSON_PLUGIN_ROUTER_H
6 #define SKYWAY_PLUGIN_UDP_PIPE_JSON_PLUGIN_ROUTER_H
7 
8 #include <fruit/fruit.h>
10 #include <rapidjson/document.h>
11 #include <rapidjson/error/en.h>
12 #include <rapidjson/stringbuffer.h>
13 #include <rapidjson/writer.h>
14 #include <ros/ros.h>
15 
16 #include "../socket/udp_socket.h"
17 #include "plugin_router.h"
18 #include "skyway/skyway_plugin.h"
19 
20 using namespace rapidjson;
21 using fruit::Component;
22 using fruit::createComponent;
23 using fruit::Injector;
24 
26  private:
28  std::vector<boost::shared_ptr<skyway_plugin::SkyWayJsonPlugin>> plugins_;
29  udp::endpoint target_socket_;
30  std::unique_ptr<Socket> socket_;
31  std::shared_ptr<rapidjson::Document> config_;
32 
33  void observe_socket(std::vector<uint8_t> data);
34  void observe_plugins(std::shared_ptr<rapidjson::Document> document);
35 
36  public:
37  JsonPluginRouter() = delete;
38  INJECT(JsonPluginRouter(ASSISTED(std::shared_ptr<rapidjson::Document>) config,
39  ASSISTED(udp::endpoint) target_socket,
40  SocketFactory factory));
42 
43  virtual PluginResult TryStart() override;
44 
45  virtual uint16_t Port() override;
46 };
47 
48 struct JsonAnnotation {};
49 
50 Component<fruit::Annotated<JsonAnnotation, PluginRouterFactory>>
52 
53 #endif // SKYWAY_PLUGIN_UDP_PIPE_JSON_PLUGIN_ROUTER_H
JsonPluginRouter::plugins_
std::vector< boost::shared_ptr< skyway_plugin::SkyWayJsonPlugin > > plugins_
Definition: json_plugin_router.h:28
class_loader.h
ros.h
JsonPluginRouter::target_socket_
udp::endpoint target_socket_
Definition: json_plugin_router.h:29
PluginRouter
Definition: plugin_router.h:20
skyway_plugin.h
getJsonPluginRouterComponent
Component< fruit::Annotated< JsonAnnotation, PluginRouterFactory > > getJsonPluginRouterComponent()
Definition: json_plugin_router.cpp:105
pluginlib::ClassLoader< skyway_plugin::SkyWayJsonPlugin >
SocketFactory
std::function< std::unique_ptr< Socket >(udp::endpoint, std::shared_ptr< std::function< void(std::vector< uint8_t >)> >)> SocketFactory
Definition: udp_socket.h:69
JsonPluginRouter::config_
std::shared_ptr< rapidjson::Document > config_
Definition: json_plugin_router.h:31
JsonPluginRouter::socket_
std::unique_ptr< Socket > socket_
Definition: json_plugin_router.h:30
PluginResult
Definition: plugin_router.h:14
plugin_router.h
JsonAnnotation
Definition: json_plugin_router.h:48
JsonPluginRouter
Definition: json_plugin_router.h:25
JsonPluginRouter::plugin_loader_
pluginlib::ClassLoader< skyway_plugin::SkyWayJsonPlugin > plugin_loader_
Definition: json_plugin_router.h:27


skyway
Author(s): Toshiya Nakakura
autogenerated on Thu Oct 26 2023 02:42:21