TransportTypes.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef IGN_TRANSPORT_TRANSPORTTYPES_HH_
18 #define IGN_TRANSPORT_TRANSPORTTYPES_HH_
19 
20 #ifdef _MSC_VER
21 #pragma warning(push, 0)
22 #endif
23 #include <google/protobuf/message.h>
24 #ifdef _MSC_VER
25 #pragma warning(pop)
26 #endif
27 
28 #include <chrono>
29 #include <functional>
30 #include <map>
31 #include <memory>
32 #include <string>
33 #include <vector>
34 
36 
37 namespace ignition
38 {
39  namespace transport
40  {
42  class IRepHandler;
43  class IReqHandler;
44  class ISubscriptionHandler;
45  class MessageInfo;
46 
52  template<typename T>
53  using Addresses_M = std::map<std::string, std::vector<T>>;
54 
58 
62 
65  using ProtoMsg = google::protobuf::Message;
66 
69  using ProtoMsgPtr = std::shared_ptr<ProtoMsg>;
70 
73  using ISubscriptionHandlerPtr = std::shared_ptr<ISubscriptionHandler>;
74 
81  std::map<std::string, ISubscriptionHandlerPtr>;
82 
85  using IRepHandlerPtr = std::shared_ptr<IRepHandler>;
86 
89  using IReqHandlerPtr = std::shared_ptr<IReqHandler>;
90 
96  using IReqHandler_M =
97  std::map<std::string, std::map<std::string, IReqHandlerPtr>>;
98 
104  template <typename T>
105  using DiscoveryCallback = std::function<void(const T &_publisher)>;
106 
110  using MsgDiscoveryCallback =
111  std::function<void(const MessagePublisher &_publisher)>;
112 
116  using SrvDiscoveryCallback =
117  std::function<void(const ServicePublisher &_publisher)>;
118 
123  template <typename T>
124  using MsgCallback =
125  std::function<void(const T &_msg, const MessageInfo &_info)>;
126 
129  using Timestamp = std::chrono::steady_clock::time_point;
130 
132  const std::string kGenericMessageType = "google.protobug.Message";
133  }
134 }
135 #endif
std::map< std::string, std::vector< T >> Addresses_M
Definition: TransportTypes.hh:53
std::function< void(const T &_msg, const MessageInfo &_info)> MsgCallback
Definition: TransportTypes.hh:125
Addresses_M< ServicePublisher > SrvAddresses_M
Definition: TransportTypes.hh:61
google::protobuf::Message ProtoMsg
Definition: TransportTypes.hh:65
std::shared_ptr< IRepHandler > IRepHandlerPtr
Definition: TransportTypes.hh:85
std::shared_ptr< ProtoMsg > ProtoMsgPtr
Definition: TransportTypes.hh:69
std::function< void(const T &_publisher)> DiscoveryCallback
Definition: TransportTypes.hh:105
std::shared_ptr< ISubscriptionHandler > ISubscriptionHandlerPtr
Definition: TransportTypes.hh:73
Addresses_M< MessagePublisher > MsgAddresses_M
Definition: TransportTypes.hh:57
std::shared_ptr< IReqHandler > IReqHandlerPtr
Definition: TransportTypes.hh:89
std::function< void(const ServicePublisher &_publisher)> SrvDiscoveryCallback
Definition: TransportTypes.hh:117
std::map< std::string, ISubscriptionHandlerPtr > ISubscriptionHandler_M
Definition: TransportTypes.hh:81
std::chrono::steady_clock::time_point Timestamp
Definition: TransportTypes.hh:129
const std::string kGenericMessageType
The string type used for generic messages.
Definition: TransportTypes.hh:132
Definition: AdvertiseOptions.hh:27
std::map< std::string, std::map< std::string, IReqHandlerPtr >> IReqHandler_M
Definition: TransportTypes.hh:97
std::function< void(const MessagePublisher &_publisher)> MsgDiscoveryCallback
Definition: TransportTypes.hh:111