client-cpp  0.10.0
LoggingUtils.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
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 LOGGINGUTILS_HPP_
18 #define LOGGINGUTILS_HPP_
19 
20 #include <cstdint>
21 #include <cstddef>
22 #include <string>
23 #include <vector>
24 
25 #include <boost/shared_array.hpp>
26 
27 #include "kaa/gen/EndpointGen.hpp"
34 
35 namespace kaa {
36 
37 class LoggingUtils {
38 public:
39  static std::string toString(const SyncRequest::notificationSyncRequest_t& request);
40 
41  static std::string toString(const SyncRequest::configurationSyncRequest_t& request);
42 
43  static std::string toString(const ProtocolVersionPair& protocolVersion);
44 
45  static std::string toString(const SyncRequest::bootstrapSyncRequest_t& request);
46 
47  static std::string toString(const SyncRequest::profileSyncRequest_t& request);
48 
49  static std::string toString(const SyncRequest::syncRequestMetaData_t& request);
50 
51  static std::string toString(const SyncRequest::eventSyncRequest_t& request);
52 
53  static std::string toString(const UserSyncRequest::userAttachRequest_t& request);
54 
55  static std::string toString(const SyncRequest::userSyncRequest_t& request);
56 
57  static std::string toString(const SyncResponse::configurationSyncResponse_t& response);
58 
59  static std::string toString(const SyncResponse::profileSyncResponse_t& response);
60 
61  static std::string toString(const SyncResponse::bootstrapSyncResponse_t& response);
62 
63  static std::string toString(const SyncResponse::eventSyncResponse_t& response);
64 
65  static std::string toString(const SyncResponse::notificationSyncResponse_t& response);
66 
67  static std::string toString(const UserSyncResponse::userAttachResponse_t& response);
68 
69  static std::string toString(const UserSyncResponse::userDetachNotification_t& response);
70 
71  static std::string toString(const SyncResponse::userSyncResponse_t& response);
72 
73  static std::string toString(const SyncResponse::redirectSyncResponse_t& response);
74 
75  static std::string toString(const TransportProtocolId& protocolId);
76 
77  static std::string toString(const std::vector<std::uint8_t>& vec) {
78  return toString(vec.data(), vec.size());
79  }
80 
81  static std::string toString(const boost::shared_array<std::uint8_t>& vec, std::size_t length) {
82  return toString(vec.get(), length);
83  }
84 
85  static std::string toString(const SharedDataBuffer& buffer) {
86  return toString(buffer.first, buffer.second);
87  }
88 
89  static std::string toString(const std::string& data) {
90  return toString(reinterpret_cast<const std::uint8_t*>(data.data()), data.length());
91  }
92 
93  static std::string toString(const std::uint8_t* vec, std::size_t length);
94 
95  static std::string toString(SyncResponseStatus status);
96 
97  static std::string toString(const NotificationSyncRequest::acceptedUnicastNotifications_t& notifications);
98 
99  static std::string toString(const NotificationSyncRequest::topicStates_t& states);
100 
101  static std::string toString(const NotificationSyncRequest::subscriptionCommands_t& commands);
102 
103  static std::string toString(SubscriptionCommandType type);
104 
105  static std::string toString(const Notification& notification);
106 
107  static std::string toString(const NotificationSyncResponse::notifications_t& notifications);
108 
109  static std::string toString(NotificationType type);
110 
111  static std::string toString(const NotificationSyncResponse::availableTopics_t& topics);
112 
113  static std::string toString(SubscriptionType type);
114 
115  static std::string toString(const UserSyncRequest::endpointAttachRequests_t& attachRequests);
116 
117  static std::string toString(const UserSyncRequest::endpointDetachRequests_t& detachRequests);
118 
119  static std::string toString(const UserSyncResponse::endpointAttachResponses_t& attachResponses);
120 
121  static std::string toString(const UserSyncResponse::endpointDetachResponses_t& detachResponse);
122 
123  static std::string toString(SyncResponseResultType type);
124 
125  static std::string toString(const EventSyncRequest::events_t& events);
126 
127  static std::string toString(const EventSyncResponse::events_t& events);
128 
129  static std::string toString(const EventSyncRequest::eventListenersRequests_t& request);
130 
131  static std::string toString(const EventSyncResponse::eventListenersResponses_t& response);
132 
133  static std::string toString(const EventSyncResponse::eventSequenceNumberResponse_t& response);
134 
135  static std::string toString(TransportType type);
136 
137  static std::string toString(const SyncRequest::logSyncRequest_t& logSyncRequest);
138 
139  static std::string toString(const SyncResponse::logSyncResponse_t& logSyncResponse);
140 
141  static std::string toString(LogDeliveryErrorCode code);
142 
143  static std::string toString(KaaFailoverReason reason);
144 
145  static std::string toString(FailoverStrategyAction action);
146 
147  static std::string toString(const FailoverStrategyDecision& decision);
148 
149  static std::string toString(const ITransportConnectionInfo& connectionInfo);
150 
151  static std::string toString(ServerType type);
152 
153 private:
154  static std::string toString(const std::vector<Event>& events);
155 };
156 
157 } // namespace kaa
158 
159 
160 #endif /* LOGGINGUTILS_HPP_ */
KaaFailoverReason
static std::string toString(const std::vector< std::uint8_t > &vec)
static std::string toString(const std::string &data)
ServerType
Definition: ServerType.hpp:22
static std::string toString(const boost::shared_array< std::uint8_t > &vec, std::size_t length)
static std::string toString(const SharedDataBuffer &buffer)
static std::string toString(const SyncRequest::notificationSyncRequest_t &request)
std::pair< boost::shared_array< std::uint8_t >, std::uint32_t > SharedDataBuffer
FailoverStrategyAction