mhussainahmad commited on
Commit
dadadf4
·
verified ·
1 Parent(s): bd0c5f7

Upload 167 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. kortex_api/include/client/FrameHandler.h +67 -0
  3. kortex_api/include/client/IRouterClient.h +55 -0
  4. kortex_api/include/client/ITransportClient.h +61 -0
  5. kortex_api/include/client/NotificationHandler.h +96 -0
  6. kortex_api/include/client/RouterClient.h +73 -0
  7. kortex_api/include/client/SessionManager.h +48 -0
  8. kortex_api/include/client/TransportClientTcp.h +139 -0
  9. kortex_api/include/client/TransportClientUdp.h +148 -0
  10. kortex_api/include/client/version.h +19 -0
  11. kortex_api/include/client_stubs/ActuatorConfigClientRpc.h +223 -0
  12. kortex_api/include/client_stubs/ActuatorCyclicClientRpc.h +83 -0
  13. kortex_api/include/client_stubs/BaseClientRpc.h +770 -0
  14. kortex_api/include/client_stubs/BaseCyclicClientRpc.h +83 -0
  15. kortex_api/include/client_stubs/ControlConfigClientRpc.h +207 -0
  16. kortex_api/include/client_stubs/DeviceConfigClientRpc.h +230 -0
  17. kortex_api/include/client_stubs/DeviceManagerClientRpc.h +68 -0
  18. kortex_api/include/client_stubs/GripperCyclicClientRpc.h +83 -0
  19. kortex_api/include/client_stubs/InterconnectConfigClientRpc.h +133 -0
  20. kortex_api/include/client_stubs/InterconnectCyclicClientRpc.h +83 -0
  21. kortex_api/include/client_stubs/SessionClientRpc.h +83 -0
  22. kortex_api/include/client_stubs/TestClientRpc.h +165 -0
  23. kortex_api/include/client_stubs/VisionConfigClientRpc.h +121 -0
  24. kortex_api/include/common/Frame.h +71 -0
  25. kortex_api/include/common/HeaderInfo.h +81 -0
  26. kortex_api/include/common/KBasicException.h +29 -0
  27. kortex_api/include/common/KDetailedException.h +39 -0
  28. kortex_api/include/common/KError.h +42 -0
  29. kortex_api/include/common/KinovaTcpUtilities.h +23 -0
  30. kortex_api/include/common/TransportBridgeDummy.h +127 -0
  31. kortex_api/include/common/WindowsNetworking.h +21 -0
  32. kortex_api/include/common/version.h +10 -0
  33. kortex_api/include/google/protobuf/any.h +107 -0
  34. kortex_api/include/google/protobuf/any.pb.h +323 -0
  35. kortex_api/include/google/protobuf/api.pb.h +1165 -0
  36. kortex_api/include/google/protobuf/arena.h +934 -0
  37. kortex_api/include/google/protobuf/arena_impl.h +242 -0
  38. kortex_api/include/google/protobuf/arenastring.h +338 -0
  39. kortex_api/include/google/protobuf/compiler/code_generator.h +176 -0
  40. kortex_api/include/google/protobuf/compiler/command_line_interface.h +440 -0
  41. kortex_api/include/google/protobuf/compiler/cpp/cpp_generator.h +72 -0
  42. kortex_api/include/google/protobuf/compiler/csharp/csharp_generator.h +64 -0
  43. kortex_api/include/google/protobuf/compiler/csharp/csharp_names.h +104 -0
  44. kortex_api/include/google/protobuf/compiler/importer.h +327 -0
  45. kortex_api/include/google/protobuf/compiler/java/java_generator.h +72 -0
  46. kortex_api/include/google/protobuf/compiler/java/java_names.h +87 -0
  47. kortex_api/include/google/protobuf/compiler/javanano/javanano_generator.h +72 -0
  48. kortex_api/include/google/protobuf/compiler/js/js_generator.h +333 -0
  49. kortex_api/include/google/protobuf/compiler/js/well_known_types_embed.h +43 -0
  50. kortex_api/include/google/protobuf/compiler/objectivec/objectivec_generator.h +72 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ kortex_api/lib/release/KortexApiCpp_without_protobuf.lib filter=lfs diff=lfs merge=lfs -text
37
+ kortex_api/lib/release/KortexApiCpp.lib filter=lfs diff=lfs merge=lfs -text
kortex_api/include/client/FrameHandler.h ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _FRAME_HANDLER_H_
2
+ #define _FRAME_HANDLER_H_
3
+ #undef _HAS_STD_BYTE
4
+ #include <iostream>
5
+ #include <list>
6
+ #include <future>
7
+ #include <memory>
8
+ #include <queue>
9
+ #include <chrono>
10
+
11
+ #include "common/HeaderInfo.h"
12
+ #include "messages/Frame.pb.h"
13
+
14
+ using namespace std::chrono;
15
+
16
+ namespace Kinova {
17
+ namespace Api {
18
+ struct CallbackTimeoutStruct {
19
+ uint32_t m_timeout;
20
+ steady_clock::time_point m_registeredTimePoint;
21
+
22
+ explicit CallbackTimeoutStruct(uint32_t timeout)
23
+ : m_timeout(timeout) {
24
+ m_registeredTimePoint = time_point_cast<milliseconds>(steady_clock::now());
25
+ }
26
+
27
+ bool checkExpiry() {
28
+ uint32_t duration = duration_cast<milliseconds>(steady_clock::now() - m_registeredTimePoint).count();
29
+ return (duration >= m_timeout);
30
+ }
31
+ };
32
+
33
+ typedef std::function<void (const Kinova::Api::Frame &)> MessageCallback;
34
+ typedef std::queue<std::pair<uint32_t, CallbackTimeoutStruct> > TimeoutClockByMeesageCallbackQueue;
35
+
36
+ class FrameHandler {
37
+ public:
38
+ explicit FrameHandler(uint32_t maxCallbackTimeout = 60000);
39
+
40
+ ~FrameHandler() = default;
41
+
42
+ std::future<Frame> registerMessage(uint32_t msgId);
43
+
44
+ // TODO sfforget 2018-05-30 Add error callback
45
+ void registerMessageCallback(uint32_t msgId, const MessageCallback &callback);
46
+
47
+ Error manageReceivedMessage(Frame &msgFrame);
48
+
49
+ void setMessageException(HeaderInfo &headerInfo, Error &error);
50
+
51
+ private:
52
+ void cleanDanglingCallback();
53
+
54
+ std::mutex m_mutex;
55
+ uint32_t m_maxCallbackTimeout;
56
+ // IdGenerator<uint32_t> m_apiIdGenerator;
57
+
58
+ // TODO cleanup messages without response from server to avoid memory leak.
59
+ // todoErr add the validation information beside the message promise
60
+ std::unordered_map<uint32_t, std::shared_ptr<std::promise<Frame> > > m_messagePromises;
61
+ TimeoutClockByMeesageCallbackQueue m_timeoutClockByCallback;
62
+ std::unordered_map<uint32_t, MessageCallback> m_messageCallbacks;
63
+ };
64
+ }
65
+ }
66
+
67
+ #endif // _MESSAGE_MANAGER_H_
kortex_api/include/client/IRouterClient.h ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _I_ROUTER_CLIENT_H_
2
+ #define _I_ROUTER_CLIENT_H_
3
+
4
+
5
+ #include <string>
6
+ #include <future>
7
+ #include <functional>
8
+ #include <exception>
9
+
10
+ #include "messages/Frame.pb.h"
11
+
12
+ #include "ITransportClient.h"
13
+ #include "common/KError.h"
14
+
15
+ using namespace std;
16
+
17
+ namespace Kinova
18
+ {
19
+ namespace Api
20
+ {
21
+ typedef std::function<void (const Kinova::Api::Frame&)> MessageCallback;
22
+
23
+ typedef struct
24
+ {
25
+ bool andForget;
26
+ uint32_t delay_ms;
27
+ uint32_t timeout_ms;
28
+
29
+ } RouterClientSendOptions;
30
+
31
+ class IRouterClient
32
+ {
33
+ public:
34
+ virtual ~IRouterClient() {}
35
+
36
+ virtual void reset() = 0;
37
+ virtual void registerBridgingCallback(std::function<void (Frame &)> bridgingCallback) = 0;
38
+ virtual void registerNotificationCallback( uint32_t serviceId, function<Error (Frame&)> ) = 0;
39
+ virtual void registerErrorCallback( function<void(KError)> callback ) = 0;
40
+ virtual void registerHitCallback(std::function<void (FrameTypes)> hitSessionCallback) = 0;
41
+
42
+ virtual future<Frame> send(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, const RouterClientSendOptions& options ) = 0;
43
+ virtual Error sendWithCallback(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, MessageCallback callback) = 0;
44
+ virtual Error sendMsgFrame(const Frame& msgFrame) = 0;
45
+
46
+ virtual uint16_t getConnectionId() = 0;
47
+ virtual void SetActivationStatus(bool isActive) = 0;
48
+
49
+ virtual ITransportClient* getTransport() = 0;
50
+ };
51
+
52
+ } // namespace Api
53
+ } // namespace Kinova
54
+
55
+ #endif // _I_ROUTER_CLIENT_H_
kortex_api/include/client/ITransportClient.h ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _I_TRANSPORT_CLIENT_H_
2
+ #define _I_TRANSPORT_CLIENT_H_
3
+
4
+
5
+ #include <string>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include <cmath>
10
+
11
+ using namespace std;
12
+
13
+ namespace Kinova
14
+ {
15
+ namespace Api
16
+ {
17
+ // enums
18
+ enum TransportReadyStateEnum
19
+ {
20
+ CONNECTING = 0,
21
+ OPEN = 1,
22
+ CLOSING = 2,
23
+ CLOSED = 3,
24
+ UNINITIALIZED = 4,
25
+ RECONNECTING = 5,
26
+ };
27
+
28
+ // interface
29
+ class ITransportClient
30
+ {
31
+ public:
32
+ TransportReadyStateEnum readyState;
33
+
34
+ virtual ~ITransportClient() {}
35
+
36
+ virtual bool connect(std::string host, uint32_t port) = 0;
37
+ virtual void disconnect() = 0;
38
+
39
+ virtual void send(const char* txBuffer, uint32_t txSize) = 0;
40
+ virtual void onMessage(std::function<void (const char*, uint32_t)> callback) = 0;
41
+
42
+ // virtual void onClose(ConnectionClose eventClose)> callback) = 0;
43
+ // virtual void onError(ConnectionError error)> callback) = 0;
44
+
45
+ // virtual bool isClosed() = 0;
46
+ // virtual bool isClosing() = 0;
47
+ // virtual bool isConnecting() = 0;
48
+ // virtual bool isOpen() = 0;
49
+ // virtual bool isUninitialized() = 0;
50
+
51
+ virtual char* getTxBuffer(uint32_t const& allocation_size) = 0;
52
+ virtual size_t getMaxTxBufferSize() = 0;
53
+
54
+ virtual void getHostAddress(std::string &host, uint32_t &port) = 0;
55
+ };
56
+
57
+
58
+ } // namespace Api
59
+ } // namespace Kinova
60
+
61
+ #endif // _I_TRANSPORT_CLIENT_H_
kortex_api/include/client/NotificationHandler.h ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _NOTIFICATION_HANDLER_H_
2
+ #define _NOTIFICATION_HANDLER_H_
3
+
4
+
5
+ #include <memory>
6
+ #include <map>
7
+ #include <vector>
8
+ #include <functional>
9
+ #include <future>
10
+
11
+ #include "common/KBasicException.h"
12
+ #include "common/KDetailedException.h"
13
+
14
+ #include "messages/Frame.pb.h"
15
+
16
+ #include "ITransportClient.h"
17
+ #include "IRouterClient.h"
18
+
19
+ namespace Kinova
20
+ {
21
+ namespace Api
22
+ {
23
+
24
+ struct AbstractCallbackFunction
25
+ {
26
+ AbstractCallbackFunction() = default;
27
+ virtual ~AbstractCallbackFunction() = default;
28
+
29
+ virtual Error call(Frame& msgFrameNotif) = 0;
30
+ };
31
+
32
+ template <class DataType>
33
+ struct CallbackFunction : public AbstractCallbackFunction
34
+ {
35
+ static constexpr bool isOk = std::is_base_of<::google::protobuf::Message, DataType>::value;
36
+ static_assert(isOk, "DataType must inherit from ::google::protobuf::Message");
37
+
38
+ std::function< void (DataType) > m_callbackFct;
39
+
40
+ CallbackFunction(std::function< void(DataType) > callback) : AbstractCallbackFunction() { m_callbackFct = callback; }
41
+ virtual ~CallbackFunction() override {}
42
+
43
+ virtual Error call(Frame& msgFrameNotif) override
44
+ {
45
+ Error error;
46
+ error.set_error_code(ErrorCodes::ERROR_NONE);
47
+
48
+ DataType decodedMsgNotif;
49
+ if( !decodedMsgNotif.ParseFromString(msgFrameNotif.payload()) )
50
+ {
51
+ HeaderInfo headerInfo( msgFrameNotif.header() );
52
+
53
+ error.set_error_code(ERROR_PROTOCOL_CLIENT);
54
+ error.set_error_sub_code(PAYLOAD_DECODING_ERR);
55
+ error.set_error_sub_string(string("The data payload could not be deserialized : notification for serviceId=") + to_string(headerInfo.m_serviceInfo.serviceId) + " \n");
56
+ }
57
+ else
58
+ {
59
+ // todo ??? thread(m_callbackFct, move(decodedMsgNotif)).detach();
60
+ thread(m_callbackFct, decodedMsgNotif).detach();
61
+ }
62
+
63
+ return error;
64
+ }
65
+ };
66
+
67
+ // todoErr add the validation information beside the callback
68
+ typedef std::unordered_map< uint32_t, std::unique_ptr<AbstractCallbackFunction>> CallbackMap;
69
+
70
+ class NotificationHandler
71
+ {
72
+ CallbackMap m_callbackMap;
73
+ std::mutex m_mutex;
74
+
75
+ public:
76
+ NotificationHandler();
77
+ ~NotificationHandler();
78
+
79
+ template <class DataType>
80
+ void addCallback( uint32_t idKey, std::function<void(DataType)> callback )
81
+ {
82
+ std::lock_guard<std::mutex> w_scoped(m_mutex);
83
+ std::unique_ptr<AbstractCallbackFunction> fct{new CallbackFunction<DataType>(callback)};
84
+ m_callbackMap[idKey] = std::move(fct);
85
+ }
86
+
87
+ void clearIdKeyCallbacks( uint32_t idKey );
88
+ void clearAll();
89
+
90
+ Error call(Frame& msgFrameNotif);
91
+ };
92
+
93
+ }
94
+ }
95
+
96
+ #endif // _NOTIFICATION_HANDLER_H_
kortex_api/include/client/RouterClient.h ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _ROUTER_CLIENT_H_
2
+ #define _ROUTER_CLIENT_H_
3
+
4
+
5
+ #include <string>
6
+ #include <future>
7
+ #include <functional>
8
+ #include <exception>
9
+
10
+ #include "messages/Frame.pb.h"
11
+
12
+ #include "ITransportClient.h"
13
+ #include "IRouterClient.h"
14
+
15
+ #include "FrameHandler.h"
16
+
17
+
18
+ using namespace std;
19
+
20
+ namespace Kinova
21
+ {
22
+ namespace Api
23
+ {
24
+
25
+ typedef map< uint32_t, function<Error (Frame&)> > NotificationServices;
26
+
27
+ class RouterClient : public IRouterClient
28
+ {
29
+ private:
30
+ ITransportClient* const m_transport;
31
+
32
+ NotificationServices m_notificationServices;
33
+ function<void(KError)> m_errorCallback;
34
+ function<void(FrameTypes)> m_hitSessionCallback;
35
+ function<void(Frame&)> m_bridgingCallback;
36
+
37
+ FrameHandler m_frameHandler;
38
+ uint16_t m_msgId;
39
+ uint16_t m_sessionId;
40
+
41
+ //A flag indicating if the instance can be used.
42
+ bool m_isActive;
43
+
44
+ std::mutex m_send_mutex;
45
+
46
+ public:
47
+ RouterClient(ITransportClient* transport, function<void (KError)> errorCallback);
48
+ virtual ~RouterClient();
49
+
50
+ virtual void reset() override;
51
+ virtual void registerBridgingCallback(std::function<void (Frame &)> bridgingCallback) override;
52
+ virtual void registerNotificationCallback( uint32_t serviceId, function<Error (Frame&)> ) override;
53
+ virtual void registerErrorCallback( function<void(KError)> callback ) override;
54
+ virtual void registerHitCallback(std::function<void (FrameTypes)> hitSessionCallback) override;
55
+
56
+ virtual future<Frame> send(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, const RouterClientSendOptions& options ) override;
57
+ virtual Error sendWithCallback(const std::string& txPayload, uint32_t serviceVersion, uint32_t funcId, uint32_t deviceId, MessageCallback callback) override;
58
+ virtual Error sendMsgFrame(const Frame& msgFrame) override;
59
+
60
+ virtual uint16_t getConnectionId() override;
61
+ virtual void SetActivationStatus(bool isActive) override;
62
+
63
+ virtual ITransportClient* getTransport() override {return m_transport;}
64
+
65
+ private:
66
+ uint16_t generateNewMsgId();
67
+ void frameHandler(const void *rxBuffer, uint32_t rxSize);
68
+ };
69
+
70
+ } // namespace Api
71
+ } // namespace Kinova
72
+
73
+ #endif // _ROUTER_CLIENT_H_
kortex_api/include/client/SessionManager.h ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef _SESSION_MANAGER_H_
2
+ #define _SESSION_MANAGER_H_
3
+
4
+ #include <iostream>
5
+ #include <list>
6
+ #include <future>
7
+ #include <memory>
8
+ #include <functional>
9
+
10
+ #include "IRouterClient.h"
11
+ #include "messages/Frame.pb.h"
12
+ #include "messages/Session.pb.h"
13
+ #include "client_stubs/SessionClientRpc.h"
14
+
15
+ namespace Kinova
16
+ {
17
+ namespace Api
18
+ {
19
+ class SessionManager : public Session::SessionClient
20
+ {
21
+ public:
22
+ SessionManager() = delete;
23
+ explicit SessionManager(IRouterClient* router, std::function<void()> connectionTimeoutCallback = nullptr);
24
+ virtual ~SessionManager();
25
+
26
+ void CreateSession(const Session::CreateSessionInfo& info);
27
+ void CloseSession();
28
+ Session::ConnectionList GetConnections();
29
+
30
+ private:
31
+ void Hit(FrameTypes hitType);
32
+ void ThreadSessionValidation();
33
+
34
+ std::function<void()> m_connectionTimeoutCallback;
35
+
36
+ std::thread m_thread;
37
+ std::atomic<bool> m_hasBeenSent { false };
38
+ std::atomic<bool> m_hasBeenReceived { false };
39
+ std::atomic<bool> m_threadRunning { false };
40
+ Session::CreateSessionInfo m_sessionInfo;
41
+
42
+ void checkTransport();
43
+ };
44
+
45
+ }
46
+ }
47
+
48
+ #endif // _MESSAGE_MANAGER_H_
kortex_api/include/client/TransportClientTcp.h ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ***************************************************************************
2
+ * Kinova inc.
3
+ *
4
+ * Copyright (c) 2006-2018 Kinova Incorporated. All rights reserved.
5
+ ****************************************************************************/
6
+
7
+ #ifndef __TRANSPORT_CLIENT_TCP_H__
8
+ #define __TRANSPORT_CLIENT_TCP_H__
9
+
10
+ #if defined(_OS_WINDOWS)
11
+ // ---- win ----
12
+ #include <stdio.h>
13
+ #include <winsock2.h>
14
+ #elif defined(_OS_UNIX)
15
+ // --- linux ---
16
+ #include <sys/types.h>
17
+ #include <sys/socket.h>
18
+ #include <netinet/in.h>
19
+ #include <arpa/inet.h>
20
+ #include <netdb.h>
21
+ #include <sys/select.h>
22
+ #include <sys/fcntl.h>
23
+
24
+ #include <iostream>
25
+ #include <unistd.h>
26
+ #include <ctime>
27
+ #include <stdio.h>
28
+ #include <unistd.h>
29
+ #include <cerrno>
30
+ #include <cstdio>
31
+ #include <cstring>
32
+ #include <cstdlib>
33
+ #else
34
+ #pragma message("WARNING: Unknown OS Type!")
35
+ #endif
36
+
37
+ #include <atomic>
38
+ #include <thread>
39
+ #include <mutex>
40
+
41
+ #include <string>
42
+ #include <functional>
43
+ #include <exception>
44
+
45
+ #include <iostream>
46
+ #include <chrono>
47
+
48
+ #include "ITransportClient.h"
49
+ #include "common/KinovaTcpUtilities.h"
50
+ #include "common/WindowsNetworking.h"
51
+
52
+ namespace Kinova
53
+ {
54
+ namespace Api
55
+ {
56
+ class TransportClientTcp : public ITransportClient
57
+ {
58
+ private:
59
+ const uint32_t kApiPort = 10000;
60
+ // Configuration m_config;
61
+ bool m_isInitialized;
62
+ struct sockaddr_in m_socketAddr{};
63
+ socklen_t m_socketAddrSize{};
64
+ int32_t m_socketFd{};
65
+ #if defined(_OS_WINDOWS)
66
+ WSADATA m_wsa{};
67
+ #endif
68
+
69
+ bool m_isUsingRcvThread;
70
+ std::atomic<bool> m_isRunning { true };
71
+ std::mutex m_sendMutex;
72
+
73
+ // ---- non-blocking ----
74
+ fd_set m_original_rx{};
75
+ fd_set m_readfds{};
76
+
77
+ int numfd{};
78
+ struct hostent *m_host{};
79
+ struct timeval m_tv{};
80
+ // ----------------------
81
+
82
+ // 65535 - 20 (ip header) - 20 (tcp header) = 65495 bytes
83
+ static constexpr uint32_t kMaxTxBufferSize = 65495;
84
+ static constexpr uint32_t kMaxRxBufferSize = 65495;
85
+ static constexpr uint32_t kMaxBufferSize = 16777216;
86
+
87
+ bool m_bIsReceiving { false };
88
+ uint32_t m_nTotalBytesRead {0};
89
+ uint32_t m_nTotalBytesToRead {0};
90
+ uint8_t* m_tx_buffer;
91
+ uint8_t* m_rx_buffer;
92
+
93
+ uint32_t m_current_buffer_size_rx = { kMaxRxBufferSize };
94
+ uint32_t m_current_buffer_size_tx = { kMaxTxBufferSize };
95
+
96
+
97
+ KinovaTcpUtilities m_utilities_object;
98
+
99
+ std::function<void (const char*, uint32_t) > m_onMessageCallback;
100
+
101
+
102
+ public:
103
+ TransportReadyStateEnum readyState;
104
+ std::thread m_receiveThread;
105
+
106
+ explicit TransportClientTcp(bool isUsingRcvThread = true);
107
+ ~TransportClientTcp() override;
108
+
109
+ bool connect(std::string host = "127.0.0.1", uint32_t port = 10000) override;
110
+ void disconnect() override;
111
+
112
+ void send(const char* txBuffer, uint32_t txSize) override;
113
+ void onMessage(std::function<void (const char*, uint32_t)> callback) override;
114
+
115
+ char* getTxBuffer(uint32_t const& allocation_size) override;
116
+ size_t getMaxTxBufferSize() override { return kMaxBufferSize; }
117
+
118
+ int processReceive(long rcvTimeout_usec);
119
+ int processReceive(struct timeval rcvTimeout_tv);
120
+
121
+ virtual void getHostAddress(std::string &host, uint32_t &port) override {
122
+ host = mHostAddress;
123
+ port = mHostPort;
124
+ };
125
+
126
+ private:
127
+
128
+ std::string mHostAddress;
129
+ uint32_t mHostPort;
130
+
131
+ void receiveThread(std::atomic<bool> &program_is_running);
132
+
133
+ int callReceiveFrom();
134
+ };
135
+
136
+ } // namespace Api
137
+ } // namespace Kinova
138
+
139
+ #endif // __TRANSPORT_CLIENT_H__
kortex_api/include/client/TransportClientUdp.h ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ***************************************************************************
2
+ * Kinova inc.
3
+ * Project :
4
+ *
5
+ * Copyright (c) 2006-2018 Kinova Incorporated. All rights reserved.
6
+ ****************************************************************************/
7
+
8
+ #ifndef __TRANSPORT_CLIENT_UDP_H__
9
+ #define __TRANSPORT_CLIENT_UDP_H__
10
+
11
+ #if defined(_OS_WINDOWS)
12
+ // ---- win ----
13
+ #include <stdio.h>
14
+ #include <winsock2.h>
15
+ #elif defined(_OS_UNIX)
16
+ // --- linux ---
17
+ #include <sys/types.h>
18
+ #include <sys/socket.h>
19
+ #include <netinet/in.h>
20
+ #include <arpa/inet.h>
21
+ #include <netdb.h> // host struct
22
+ #include <sys/select.h> // use select() for multiplexing
23
+ #include <sys/fcntl.h> // for non-blocking
24
+
25
+ #include <iostream>
26
+ #include <unistd.h>
27
+ #include <ctime>
28
+ #include <stdio.h>
29
+ #include <unistd.h>
30
+ #include <cerrno>
31
+ #include <cstdio>
32
+ #include <cstring>
33
+ #include <cstdlib>
34
+ #else
35
+ #warning Unknown OS type!
36
+ #endif
37
+
38
+ #include <atomic>
39
+ #include <thread>
40
+ #include <mutex>
41
+
42
+ #include <string>
43
+ #include <functional>
44
+ #include <exception>
45
+
46
+ #include <iostream>
47
+ #include <chrono>
48
+
49
+ #include "ITransportClient.h"
50
+
51
+ #if defined(_OS_WINDOWS) // todogr
52
+ typedef int32_t socklen_t;
53
+ #endif
54
+
55
+ namespace Kinova
56
+ {
57
+ namespace Api
58
+ {
59
+ const uint32_t kApiPort = 10000;
60
+
61
+ class TransportClientUdp : public ITransportClient
62
+ {
63
+ // Configuration m_config;
64
+ bool m_isInitialized;
65
+ struct sockaddr_in m_socketAddr;
66
+ socklen_t m_socketAddrSize;
67
+ int32_t m_socketFd;
68
+ #if defined(_OS_WINDOWS)
69
+ WSADATA m_wsa;
70
+ #endif
71
+
72
+ bool m_isUsingRcvThread;
73
+ std::atomic<bool> m_isRunning { true };
74
+ std::mutex m_sendMutex;
75
+
76
+ // ---- non-blocking ----
77
+ fd_set m_original_rx;
78
+ fd_set m_readfds;
79
+
80
+ int numfd;
81
+ struct hostent *m_host;
82
+ struct timeval m_tv;
83
+ // ----------------------
84
+
85
+ // 65535 - 20 (ip header) - 8 (udp header) = 65507 bytes
86
+ static constexpr uint32_t kMaxTxBufferSize = 65507;
87
+ static constexpr uint32_t kMaxRxBufferSize = 65507;
88
+
89
+ char m_txBuffer[kMaxTxBufferSize];
90
+ char m_rxBuffer[kMaxRxBufferSize];
91
+
92
+ std::function<void (const char*, uint32_t) > m_onMessageCallback;
93
+
94
+ // int32_t m_countTx;
95
+ // int32_t m_countRx;
96
+ // ChronoClock m_start;
97
+ // ChronoClock m_elapsed;
98
+
99
+ public:
100
+ TransportReadyStateEnum readyState;
101
+ std::thread m_receiveThread;
102
+
103
+ TransportClientUdp(bool isUsingRcvThread = true);
104
+ virtual ~TransportClientUdp();
105
+
106
+ virtual bool connect(std::string host = "127.0.0.1", uint32_t port = Kinova::Api::kApiPort) override;
107
+ virtual void disconnect() override;
108
+
109
+ virtual void send(const char* txBuffer, uint32_t txSize) override;
110
+ virtual void onMessage(std::function<void (const char*, uint32_t)> callback) override;
111
+
112
+ // virtual void onClose(ConnectionClose eventClose)> callback) = 0;
113
+ // virtual void onError(ConnectionError error)> callback) = 0;
114
+
115
+ // virtual bool isClosed() = 0;
116
+ // virtual bool isClosing() = 0;
117
+ // virtual bool isConnecting() = 0;
118
+ // virtual bool isOpen() = 0;
119
+ // virtual bool isUninitialized() = 0;
120
+
121
+ virtual char* getTxBuffer(uint32_t const& allocation_size) override { return m_txBuffer; }
122
+ virtual size_t getMaxTxBufferSize() override { return kMaxTxBufferSize; }
123
+
124
+ // double getTimeComm();
125
+
126
+ int processReceive(long rcvTimeout_usec);
127
+ int processReceive(struct timeval rcvTimeout_tv);
128
+
129
+ virtual void getHostAddress(std::string &host, uint32_t &port) override {
130
+ host = mHostAddress;
131
+ port = mHostPort;
132
+ };
133
+
134
+ private:
135
+
136
+ std::string mHostAddress;
137
+ uint32_t mHostPort;
138
+
139
+ void receiveThread(std::atomic<bool> &program_is_running);
140
+
141
+ // return value: <0 means error (-errorCode); =0 means timeout nothing received; >0 means nbr of handles ready to recvFrom
142
+ int callReceiveFrom();
143
+ };
144
+
145
+ } // namespace Api
146
+ } // namespace Kinova
147
+
148
+ #endif // __TRANSPORT_CLIENT_H__
kortex_api/include/client/version.h ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #ifndef VERSION_H
3
+ #define VERSION_H
4
+
5
+ #define NEO_PART_NUMBER_STR ""
6
+
7
+ #define VER_MAJOR 1
8
+ #define VER_MINOR 1
9
+ #define VER_FEATURE 6
10
+ #define VER_BUILD_NUMBER 0
11
+
12
+ #define VER_COMPANYNAME_STR "Kinova Robotics"
13
+ #define VER_INTERNALNAME_STR "Kortex Cpp Client API"
14
+ #define VER_LEGALCOPYRIGHT_STR "Copyright 2018 Kinova"
15
+ #define VER_LEGALTRADEMARKS1_STR "All Rights Reserved"
16
+
17
+ #define VER_COMPANYDOMAIN_STR "www.kinovarobotics.com/"
18
+
19
+ #endif // VERSION_H
kortex_api/include/client_stubs/ActuatorConfigClientRpc.h ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __ACTUATORCONFIGCLIENT_H__
2
+ #define __ACTUATORCONFIGCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/ActuatorConfig.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace ActuatorConfig
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidGetAxisOffsets = 0xa0001,
41
+ eUidSetAxisOffsets = 0xa0002,
42
+ eUidReadTorqueCalibration = 0xa0003,
43
+ eUidWriteTorqueCalibration = 0xa0004,
44
+ eUidSetTorqueOffset = 0xa0005,
45
+ eUidGetControlMode = 0xa0006,
46
+ eUidSetControlMode = 0xa0007,
47
+ eUidGetActivatedControlLoop = 0xa0008,
48
+ eUidSetActivatedControlLoop = 0xa0009,
49
+ eUidGetVectorDriveParameters = 0xa000a,
50
+ eUidSetVectorDriveParameters = 0xa000b,
51
+ eUidGetEncoderDerivativeParameters = 0xa000c,
52
+ eUidSetEncoderDerivativeParameters = 0xa000d,
53
+ eUidGetControlLoopParameters = 0xa000e,
54
+ eUidSetControlLoopParameters = 0xa000f,
55
+ eUidStartFrequencyResponse = 0xa0010,
56
+ eUidStopFrequencyResponse = 0xa0011,
57
+ eUidStartStepResponse = 0xa0012,
58
+ eUidStopStepResponse = 0xa0013,
59
+ eUidStartRampResponse = 0xa0014,
60
+ eUidStopRampResponse = 0xa0015,
61
+ eUidSelectCustomData = 0xa0016,
62
+ eUidGetSelectedCustomData = 0xa0017,
63
+ eUidSetCommandMode = 0xa0018,
64
+ eUidClearFaults = 0xa0019,
65
+ eUidSetServoing = 0xa001a,
66
+ eUidMoveToPosition = 0xa001b,
67
+ eUidGetCommandMode = 0xa001c,
68
+ eUidGetServoing = 0xa001d,
69
+ eUidGetTorqueOffset = 0xa001e,
70
+ eUidSetCoggingFeedforwardMode = 0xa001f,
71
+ eUidGetCoggingFeedforwardMode = 0xa0020,
72
+ };
73
+
74
+ class ActuatorConfigClient
75
+ {
76
+ static const uint32_t m_serviceVersion = 1;
77
+ static const uint32_t m_serviceId = eIdActuatorConfig;
78
+ NotificationHandler m_notificationHandler;
79
+
80
+ protected:
81
+ IRouterClient* const m_clientRouter;
82
+
83
+ public:
84
+ ActuatorConfigClient(IRouterClient* clientRouter);
85
+ static uint32_t getUniqueFctId(uint16_t fctId);
86
+
87
+ AxisOffsets GetAxisOffsets(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
88
+ void GetAxisOffsets_callback(std::function< void (const Error&, const AxisOffsets&) > callback, uint32_t deviceId = 0);
89
+ std::future<AxisOffsets> GetAxisOffsets_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
90
+
91
+ void SetAxisOffsets(const AxisPosition& axisposition, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
92
+ void SetAxisOffsets_callback(const AxisPosition& axisposition, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
93
+ std::future<void> SetAxisOffsets_async(const AxisPosition& axisposition, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
94
+
95
+ TorqueCalibration ReadTorqueCalibration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
96
+ void ReadTorqueCalibration_callback(std::function< void (const Error&, const TorqueCalibration&) > callback, uint32_t deviceId = 0);
97
+ std::future<TorqueCalibration> ReadTorqueCalibration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
98
+
99
+ void WriteTorqueCalibration(const TorqueCalibration& torquecalibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
100
+ void WriteTorqueCalibration_callback(const TorqueCalibration& torquecalibration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
101
+ std::future<void> WriteTorqueCalibration_async(const TorqueCalibration& torquecalibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
102
+
103
+ void SetTorqueOffset(const TorqueOffset& torqueoffset, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
104
+ void SetTorqueOffset_callback(const TorqueOffset& torqueoffset, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
105
+ std::future<void> SetTorqueOffset_async(const TorqueOffset& torqueoffset, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
106
+
107
+ ControlModeInformation GetControlMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
108
+ void GetControlMode_callback(std::function< void (const Error&, const ControlModeInformation&) > callback, uint32_t deviceId = 0);
109
+ std::future<ControlModeInformation> GetControlMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
110
+
111
+ void SetControlMode(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
112
+ void SetControlMode_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
113
+ std::future<void> SetControlMode_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
114
+
115
+ ControlLoop GetActivatedControlLoop(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
116
+ void GetActivatedControlLoop_callback(std::function< void (const Error&, const ControlLoop&) > callback, uint32_t deviceId = 0);
117
+ std::future<ControlLoop> GetActivatedControlLoop_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
118
+
119
+ void SetActivatedControlLoop(const ControlLoop& controlloop, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
120
+ void SetActivatedControlLoop_callback(const ControlLoop& controlloop, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
121
+ std::future<void> SetActivatedControlLoop_async(const ControlLoop& controlloop, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
122
+
123
+ VectorDriveParameters GetVectorDriveParameters(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
124
+ void GetVectorDriveParameters_callback(std::function< void (const Error&, const VectorDriveParameters&) > callback, uint32_t deviceId = 0);
125
+ std::future<VectorDriveParameters> GetVectorDriveParameters_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
126
+
127
+ void SetVectorDriveParameters(const VectorDriveParameters& vectordriveparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
128
+ void SetVectorDriveParameters_callback(const VectorDriveParameters& vectordriveparameters, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
129
+ std::future<void> SetVectorDriveParameters_async(const VectorDriveParameters& vectordriveparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
130
+
131
+ EncoderDerivativeParameters GetEncoderDerivativeParameters(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
132
+ void GetEncoderDerivativeParameters_callback(std::function< void (const Error&, const EncoderDerivativeParameters&) > callback, uint32_t deviceId = 0);
133
+ std::future<EncoderDerivativeParameters> GetEncoderDerivativeParameters_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
134
+
135
+ void SetEncoderDerivativeParameters(const EncoderDerivativeParameters& encoderderivativeparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
136
+ void SetEncoderDerivativeParameters_callback(const EncoderDerivativeParameters& encoderderivativeparameters, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
137
+ std::future<void> SetEncoderDerivativeParameters_async(const EncoderDerivativeParameters& encoderderivativeparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
138
+
139
+ ControlLoopParameters GetControlLoopParameters(const LoopSelection& loopselection, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
140
+ void GetControlLoopParameters_callback(const LoopSelection& loopselection, std::function< void (const Error&, const ControlLoopParameters&) > callback, uint32_t deviceId = 0);
141
+ std::future<ControlLoopParameters> GetControlLoopParameters_async(const LoopSelection& loopselection, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
142
+
143
+ void SetControlLoopParameters(const ControlLoopParameters& controlloopparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
144
+ void SetControlLoopParameters_callback(const ControlLoopParameters& controlloopparameters, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
145
+ std::future<void> SetControlLoopParameters_async(const ControlLoopParameters& controlloopparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
146
+
147
+ void StartFrequencyResponse(const FrequencyResponse& frequencyresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
148
+ void StartFrequencyResponse_callback(const FrequencyResponse& frequencyresponse, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
149
+ std::future<void> StartFrequencyResponse_async(const FrequencyResponse& frequencyresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
150
+
151
+ void StopFrequencyResponse(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
152
+ void StopFrequencyResponse_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
153
+ std::future<void> StopFrequencyResponse_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
154
+
155
+ void StartStepResponse(const StepResponse& stepresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
156
+ void StartStepResponse_callback(const StepResponse& stepresponse, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
157
+ std::future<void> StartStepResponse_async(const StepResponse& stepresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
158
+
159
+ void StopStepResponse(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
160
+ void StopStepResponse_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
161
+ std::future<void> StopStepResponse_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
162
+
163
+ void StartRampResponse(const RampResponse& rampresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
164
+ void StartRampResponse_callback(const RampResponse& rampresponse, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
165
+ std::future<void> StartRampResponse_async(const RampResponse& rampresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
166
+
167
+ void StopRampResponse(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
168
+ void StopRampResponse_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
169
+ std::future<void> StopRampResponse_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
170
+
171
+ void SelectCustomData(const CustomDataSelection& customdataselection, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
172
+ void SelectCustomData_callback(const CustomDataSelection& customdataselection, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
173
+ std::future<void> SelectCustomData_async(const CustomDataSelection& customdataselection, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
174
+
175
+ CustomDataSelection GetSelectedCustomData(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
176
+ void GetSelectedCustomData_callback(std::function< void (const Error&, const CustomDataSelection&) > callback, uint32_t deviceId = 0);
177
+ std::future<CustomDataSelection> GetSelectedCustomData_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
178
+
179
+ void SetCommandMode(const CommandModeInformation& commandmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
180
+ void SetCommandMode_callback(const CommandModeInformation& commandmodeinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
181
+ std::future<void> SetCommandMode_async(const CommandModeInformation& commandmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
182
+
183
+ void ClearFaults(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
184
+ void ClearFaults_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
185
+ std::future<void> ClearFaults_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
186
+
187
+ void SetServoing(const Servoing& servoing, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
188
+ void SetServoing_callback(const Servoing& servoing, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
189
+ std::future<void> SetServoing_async(const Servoing& servoing, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
190
+
191
+ void MoveToPosition(const PositionCommand& positioncommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
192
+ void MoveToPosition_callback(const PositionCommand& positioncommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
193
+ std::future<void> MoveToPosition_async(const PositionCommand& positioncommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
194
+
195
+ CommandModeInformation GetCommandMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
196
+ void GetCommandMode_callback(std::function< void (const Error&, const CommandModeInformation&) > callback, uint32_t deviceId = 0);
197
+ std::future<CommandModeInformation> GetCommandMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
198
+
199
+ Servoing GetServoing(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
200
+ void GetServoing_callback(std::function< void (const Error&, const Servoing&) > callback, uint32_t deviceId = 0);
201
+ std::future<Servoing> GetServoing_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
202
+
203
+ TorqueOffset GetTorqueOffset(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
204
+ void GetTorqueOffset_callback(std::function< void (const Error&, const TorqueOffset&) > callback, uint32_t deviceId = 0);
205
+ std::future<TorqueOffset> GetTorqueOffset_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
206
+
207
+ void SetCoggingFeedforwardMode(const CoggingFeedforwardModeInformation& coggingfeedforwardmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
208
+ void SetCoggingFeedforwardMode_callback(const CoggingFeedforwardModeInformation& coggingfeedforwardmodeinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
209
+ std::future<void> SetCoggingFeedforwardMode_async(const CoggingFeedforwardModeInformation& coggingfeedforwardmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
210
+
211
+ CoggingFeedforwardModeInformation GetCoggingFeedforwardMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
212
+ void GetCoggingFeedforwardMode_callback(std::function< void (const Error&, const CoggingFeedforwardModeInformation&) > callback, uint32_t deviceId = 0);
213
+ std::future<CoggingFeedforwardModeInformation> GetCoggingFeedforwardMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
214
+
215
+
216
+ private:
217
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
218
+ };
219
+ }
220
+ }
221
+ }
222
+
223
+ #endif
kortex_api/include/client_stubs/ActuatorCyclicClientRpc.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __ACTUATORCYCLICCLIENT_H__
2
+ #define __ACTUATORCYCLICCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/ActuatorCyclic.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace ActuatorCyclic
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidRefresh = 0xb0001,
41
+ eUidRefreshCommand = 0xb0002,
42
+ eUidRefreshFeedback = 0xb0003,
43
+ eUidRefreshCustomData = 0xb0004,
44
+ };
45
+
46
+ class ActuatorCyclicClient
47
+ {
48
+ static const uint32_t m_serviceVersion = 1;
49
+ static const uint32_t m_serviceId = eIdActuatorCyclic;
50
+ NotificationHandler m_notificationHandler;
51
+
52
+ protected:
53
+ IRouterClient* const m_clientRouter;
54
+
55
+ public:
56
+ ActuatorCyclicClient(IRouterClient* clientRouter);
57
+ static uint32_t getUniqueFctId(uint16_t fctId);
58
+
59
+ Feedback Refresh(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
60
+ void Refresh_callback(const Command& command, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
61
+ std::future<Feedback> Refresh_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
62
+
63
+ void RefreshCommand(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
64
+ void RefreshCommand_callback(const Command& command, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
65
+ std::future<void> RefreshCommand_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
66
+
67
+ Feedback RefreshFeedback(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void RefreshFeedback_callback(const MessageId& messageid, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
69
+ std::future<Feedback> RefreshFeedback_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ CustomData RefreshCustomData(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void RefreshCustomData_callback(const MessageId& messageid, std::function< void (const Error&, const CustomData&) > callback, uint32_t deviceId = 0);
73
+ std::future<CustomData> RefreshCustomData_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+
76
+ private:
77
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
78
+ };
79
+ }
80
+ }
81
+ }
82
+
83
+ #endif
kortex_api/include/client_stubs/BaseClientRpc.h ADDED
@@ -0,0 +1,770 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __BASECLIENT_H__
2
+ #define __BASECLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/Base.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace Base
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidCreateUserProfile = 0x20001,
41
+ eUidUpdateUserProfile = 0x20002,
42
+ eUidReadUserProfile = 0x20003,
43
+ eUidDeleteUserProfile = 0x20004,
44
+ eUidReadAllUserProfiles = 0x20005,
45
+ eUidReadAllUsers = 0x20006,
46
+ eUidChangePassword = 0x20007,
47
+ eUidCreateSequence = 0x20008,
48
+ eUidUpdateSequence = 0x20009,
49
+ eUidReadSequence = 0x2000a,
50
+ eUidDeleteSequence = 0x2000b,
51
+ eUidReadAllSequences = 0x2000c,
52
+ eUidPlaySequence = 0x2000f,
53
+ eUidPlayAdvancedSequence = 0x20010,
54
+ eUidStopSequence = 0x20011,
55
+ eUidPauseSequence = 0x20012,
56
+ eUidResumeSequence = 0x20013,
57
+ eUidCreateProtectionZone = 0x20014,
58
+ eUidUpdateProtectionZone = 0x20015,
59
+ eUidReadProtectionZone = 0x20016,
60
+ eUidDeleteProtectionZone = 0x20017,
61
+ eUidReadAllProtectionZones = 0x20018,
62
+ eUidCreateMapping = 0x2001a,
63
+ eUidReadMapping = 0x2001b,
64
+ eUidUpdateMapping = 0x2001c,
65
+ eUidDeleteMapping = 0x2001d,
66
+ eUidReadAllMappings = 0x2001e,
67
+ eUidCreateMap = 0x20024,
68
+ eUidReadMap = 0x20025,
69
+ eUidUpdateMap = 0x20026,
70
+ eUidDeleteMap = 0x20027,
71
+ eUidReadAllMaps = 0x20028,
72
+ eUidActivateMap = 0x20029,
73
+ eUidCreateAction = 0x2002a,
74
+ eUidReadAction = 0x2002b,
75
+ eUidReadAllActions = 0x2002c,
76
+ eUidDeleteAction = 0x2002d,
77
+ eUidUpdateAction = 0x2002e,
78
+ eUidExecuteActionFromReference = 0x2002f,
79
+ eUidExecuteAction = 0x20030,
80
+ eUidPauseAction = 0x20031,
81
+ eUidStopAction = 0x20032,
82
+ eUidResumeAction = 0x20033,
83
+ eUidGetIPv4Configuration = 0x2003b,
84
+ eUidSetIPv4Configuration = 0x2003c,
85
+ eUidSetCommunicationInterfaceEnable = 0x2003d,
86
+ eUidIsCommunicationInterfaceEnable = 0x2003e,
87
+ eUidGetAvailableWifi = 0x2003f,
88
+ eUidGetWifiInformation = 0x20040,
89
+ eUidAddWifiConfiguration = 0x20041,
90
+ eUidDeleteWifiConfiguration = 0x20042,
91
+ eUidGetAllConfiguredWifis = 0x20043,
92
+ eUidConnectWifi = 0x20044,
93
+ eUidDisconnectWifi = 0x20045,
94
+ eUidGetConnectedWifiInformation = 0x20046,
95
+ eUidUnsubscribe = 0x20061,
96
+ eUidConfigurationChangeTopic = 0x20062,
97
+ eUidMappingInfoTopic = 0x20063,
98
+ eUidOperatingModeTopic = 0x20065,
99
+ eUidSequenceInfoTopic = 0x20066,
100
+ eUidProtectionZoneTopic = 0x20067,
101
+ eUidUserTopic = 0x20068,
102
+ eUidControllerTopic = 0x20069,
103
+ eUidActionTopic = 0x2006a,
104
+ eUidRobotEventTopic = 0x2006b,
105
+ eUidPlayCartesianTrajectory = 0x2006d,
106
+ eUidPlayCartesianTrajectoryPosition = 0x2006e,
107
+ eUidPlayCartesianTrajectoryOrientation = 0x2006f,
108
+ eUidStop = 0x20070,
109
+ eUidGetMeasuredCartesianPose = 0x20073,
110
+ eUidSendWrenchCommand = 0x20076,
111
+ eUidSendWrenchJoystickCommand = 0x20077,
112
+ eUidSendTwistJoystickCommand = 0x20078,
113
+ eUidSendTwistCommand = 0x20079,
114
+ eUidPlayJointTrajectory = 0x2007c,
115
+ eUidPlaySelectedJointTrajectory = 0x2007d,
116
+ eUidGetMeasuredJointAngles = 0x2007e,
117
+ eUidSendJointSpeedsCommand = 0x20084,
118
+ eUidSendSelectedJointSpeedCommand = 0x20085,
119
+ eUidSendGripperCommand = 0x20088,
120
+ eUidGetMeasuredGripperMovement = 0x20089,
121
+ eUidSetAdmittance = 0x2008b,
122
+ eUidSetOperatingMode = 0x2008d,
123
+ eUidApplyEmergencyStop = 0x20091,
124
+ eUidClearFaults = 0x20092,
125
+ eUidGetOperatingMode = 0x20097,
126
+ eUidSetServoingMode = 0x20098,
127
+ eUidGetServoingMode = 0x20099,
128
+ eUidServoingModeTopic = 0x2009a,
129
+ eUidRestoreFactorySettings = 0x200a0,
130
+ eUidReboot = 0x200a2,
131
+ eUidFactoryTopic = 0x200a4,
132
+ eUidGetAllConnectedControllers = 0x200a6,
133
+ eUidGetControllerState = 0x200a7,
134
+ eUidGetActuatorCount = 0x200ab,
135
+ eUidStartWifiScan = 0x200ac,
136
+ eUidGetConfiguredWifi = 0x200ad,
137
+ eUidNetworkTopic = 0x200ae,
138
+ eUidGetArmState = 0x200af,
139
+ eUidArmStateTopic = 0x200b0,
140
+ eUidGetIPv4Information = 0x200b1,
141
+ eUidSetWifiCountryCode = 0x200b2,
142
+ eUidGetWifiCountryCode = 0x200b3,
143
+ eUidSetCapSenseConfig = 0x200b4,
144
+ eUidGetCapSenseConfig = 0x200b5,
145
+ eUidGetAllJointsTorqueHardLimitation = 0x200b8,
146
+ eUidGetWrenchHardLimitation = 0x200ba,
147
+ eUidSendJointSpeedsJoystickCommand = 0x200bb,
148
+ eUidSendSelectedJointSpeedJoystickCommand = 0x200bc,
149
+ eUidEnableBridge = 0x200c1,
150
+ eUidDisableBridge = 0x200c2,
151
+ eUidGetBridgeList = 0x200c3,
152
+ eUidGetBridgeConfig = 0x200c4,
153
+ eUidPlayPreComputedJointTrajectory = 0x200c5,
154
+ eUidGetProductConfiguration = 0x200c6,
155
+ eUidUpdateEndEffectorTypeConfiguration = 0x200c9,
156
+ eUidRestoreFactoryProductConfiguration = 0x200ce,
157
+ eUidGetTrajectoryErrorReport = 0x200cf,
158
+ eUidGetAllJointsTorqueSoftLimitation = 0x200d1,
159
+ eUidGetWrenchSoftLimitation = 0x200d3,
160
+ eUidSetControllerConfigurationMode = 0x200d4,
161
+ eUidGetControllerConfigurationMode = 0x200d5,
162
+ eUidStartTeaching = 0x200d6,
163
+ eUidStopTeaching = 0x200d7,
164
+ eUidAddSequenceTasks = 0x200d8,
165
+ eUidUpdateSequenceTask = 0x200d9,
166
+ eUidSwapSequenceTasks = 0x200da,
167
+ eUidReadSequenceTask = 0x200db,
168
+ eUidReadAllSequenceTasks = 0x200dc,
169
+ eUidDeleteSequenceTask = 0x2000d,
170
+ eUidDeleteAllSequenceTasks = 0x2000e,
171
+ eUidTakeSnapshot = 0x200df,
172
+ eUidGetFirmwareBundleVersions = 0x200e0,
173
+ eUidExecuteWaypointTrajectory = 0x200e2,
174
+ eUidMoveSequenceTask = 0x200e3,
175
+ eUidDuplicateMapping = 0x200e4,
176
+ eUidDuplicateMap = 0x200e5,
177
+ eUidSetControllerConfiguration = 0x200e6,
178
+ eUidGetControllerConfiguration = 0x200e7,
179
+ eUidGetAllControllerConfigurations = 0x200e8,
180
+ eUidComputeForwardKinematics = 0x200e9,
181
+ eUidComputeInverseKinematics = 0x200ea,
182
+ eUidValidateWaypointList = 0x200eb,
183
+ eUidSetWifiEnableState = 0x200ec,
184
+ eUidGetWifiEnableState = 0x200ed,
185
+ eUidSetBluetoothEnableState = 0x200ee,
186
+ eUidGetBluetoothEnableState = 0x200ef,
187
+ };
188
+
189
+ class BaseClient
190
+ {
191
+ static const uint32_t m_serviceVersion = 1;
192
+ static const uint32_t m_serviceId = eIdBase;
193
+ NotificationHandler m_notificationHandler;
194
+
195
+ protected:
196
+ IRouterClient* const m_clientRouter;
197
+
198
+ public:
199
+ BaseClient(IRouterClient* clientRouter);
200
+ static uint32_t getUniqueFctId(uint16_t fctId);
201
+
202
+ Kinova::Api::Common::UserProfileHandle CreateUserProfile(const FullUserProfile& fulluserprofile, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
203
+ void CreateUserProfile_callback(const FullUserProfile& fulluserprofile, std::function< void (const Error&, const Kinova::Api::Common::UserProfileHandle&) > callback, uint32_t deviceId = 0);
204
+ std::future<Kinova::Api::Common::UserProfileHandle> CreateUserProfile_async(const FullUserProfile& fulluserprofile, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
205
+
206
+ void UpdateUserProfile(const UserProfile& userprofile, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
207
+ void UpdateUserProfile_callback(const UserProfile& userprofile, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
208
+ std::future<void> UpdateUserProfile_async(const UserProfile& userprofile, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
209
+
210
+ UserProfile ReadUserProfile(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
211
+ void ReadUserProfile_callback(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, std::function< void (const Error&, const UserProfile&) > callback, uint32_t deviceId = 0);
212
+ std::future<UserProfile> ReadUserProfile_async(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
213
+
214
+ void DeleteUserProfile(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
215
+ void DeleteUserProfile_callback(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
216
+ std::future<void> DeleteUserProfile_async(const Kinova::Api::Common::UserProfileHandle& userprofilehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
217
+
218
+ UserProfileList ReadAllUserProfiles(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
219
+ void ReadAllUserProfiles_callback(std::function< void (const Error&, const UserProfileList&) > callback, uint32_t deviceId = 0);
220
+ std::future<UserProfileList> ReadAllUserProfiles_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
221
+
222
+ UserList ReadAllUsers(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
223
+ void ReadAllUsers_callback(std::function< void (const Error&, const UserList&) > callback, uint32_t deviceId = 0);
224
+ std::future<UserList> ReadAllUsers_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
225
+
226
+ void ChangePassword(const PasswordChange& passwordchange, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
227
+ void ChangePassword_callback(const PasswordChange& passwordchange, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
228
+ std::future<void> ChangePassword_async(const PasswordChange& passwordchange, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
229
+
230
+ SequenceHandle CreateSequence(const Sequence& sequence, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
231
+ void CreateSequence_callback(const Sequence& sequence, std::function< void (const Error&, const SequenceHandle&) > callback, uint32_t deviceId = 0);
232
+ std::future<SequenceHandle> CreateSequence_async(const Sequence& sequence, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
233
+
234
+ void UpdateSequence(const Sequence& sequence, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
235
+ void UpdateSequence_callback(const Sequence& sequence, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
236
+ std::future<void> UpdateSequence_async(const Sequence& sequence, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
237
+
238
+ Sequence ReadSequence(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
239
+ void ReadSequence_callback(const SequenceHandle& sequencehandle, std::function< void (const Error&, const Sequence&) > callback, uint32_t deviceId = 0);
240
+ std::future<Sequence> ReadSequence_async(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
241
+
242
+ void DeleteSequence(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
243
+ void DeleteSequence_callback(const SequenceHandle& sequencehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
244
+ std::future<void> DeleteSequence_async(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
245
+
246
+ SequenceList ReadAllSequences(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
247
+ void ReadAllSequences_callback(std::function< void (const Error&, const SequenceList&) > callback, uint32_t deviceId = 0);
248
+ std::future<SequenceList> ReadAllSequences_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
249
+
250
+ void PlaySequence(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
251
+ void PlaySequence_callback(const SequenceHandle& sequencehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
252
+ std::future<void> PlaySequence_async(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
253
+
254
+ void PlayAdvancedSequence(const AdvancedSequenceHandle& advancedsequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
255
+ void PlayAdvancedSequence_callback(const AdvancedSequenceHandle& advancedsequencehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
256
+ std::future<void> PlayAdvancedSequence_async(const AdvancedSequenceHandle& advancedsequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
257
+
258
+ void StopSequence(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
259
+ void StopSequence_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
260
+ std::future<void> StopSequence_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
261
+
262
+ void PauseSequence(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
263
+ void PauseSequence_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
264
+ std::future<void> PauseSequence_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
265
+
266
+ void ResumeSequence(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
267
+ void ResumeSequence_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
268
+ std::future<void> ResumeSequence_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
269
+
270
+ ProtectionZoneHandle CreateProtectionZone(const ProtectionZone& protectionzone, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
271
+ void CreateProtectionZone_callback(const ProtectionZone& protectionzone, std::function< void (const Error&, const ProtectionZoneHandle&) > callback, uint32_t deviceId = 0);
272
+ std::future<ProtectionZoneHandle> CreateProtectionZone_async(const ProtectionZone& protectionzone, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
273
+
274
+ void UpdateProtectionZone(const ProtectionZone& protectionzone, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
275
+ void UpdateProtectionZone_callback(const ProtectionZone& protectionzone, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
276
+ std::future<void> UpdateProtectionZone_async(const ProtectionZone& protectionzone, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
277
+
278
+ ProtectionZone ReadProtectionZone(const ProtectionZoneHandle& protectionzonehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
279
+ void ReadProtectionZone_callback(const ProtectionZoneHandle& protectionzonehandle, std::function< void (const Error&, const ProtectionZone&) > callback, uint32_t deviceId = 0);
280
+ std::future<ProtectionZone> ReadProtectionZone_async(const ProtectionZoneHandle& protectionzonehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
281
+
282
+ void DeleteProtectionZone(const ProtectionZoneHandle& protectionzonehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
283
+ void DeleteProtectionZone_callback(const ProtectionZoneHandle& protectionzonehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
284
+ std::future<void> DeleteProtectionZone_async(const ProtectionZoneHandle& protectionzonehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
285
+
286
+ ProtectionZoneList ReadAllProtectionZones(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
287
+ void ReadAllProtectionZones_callback(std::function< void (const Error&, const ProtectionZoneList&) > callback, uint32_t deviceId = 0);
288
+ std::future<ProtectionZoneList> ReadAllProtectionZones_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
289
+
290
+ MappingHandle CreateMapping(const Mapping& mapping, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
291
+ void CreateMapping_callback(const Mapping& mapping, std::function< void (const Error&, const MappingHandle&) > callback, uint32_t deviceId = 0);
292
+ std::future<MappingHandle> CreateMapping_async(const Mapping& mapping, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
293
+
294
+ Mapping ReadMapping(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
295
+ void ReadMapping_callback(const MappingHandle& mappinghandle, std::function< void (const Error&, const Mapping&) > callback, uint32_t deviceId = 0);
296
+ std::future<Mapping> ReadMapping_async(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
297
+
298
+ void UpdateMapping(const Mapping& mapping, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
299
+ void UpdateMapping_callback(const Mapping& mapping, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
300
+ std::future<void> UpdateMapping_async(const Mapping& mapping, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
301
+
302
+ void DeleteMapping(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
303
+ void DeleteMapping_callback(const MappingHandle& mappinghandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
304
+ std::future<void> DeleteMapping_async(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
305
+
306
+ MappingList ReadAllMappings(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
307
+ void ReadAllMappings_callback(std::function< void (const Error&, const MappingList&) > callback, uint32_t deviceId = 0);
308
+ std::future<MappingList> ReadAllMappings_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
309
+
310
+ MapHandle CreateMap(const Map& map, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
311
+ void CreateMap_callback(const Map& map, std::function< void (const Error&, const MapHandle&) > callback, uint32_t deviceId = 0);
312
+ std::future<MapHandle> CreateMap_async(const Map& map, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
313
+
314
+ Map ReadMap(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
315
+ void ReadMap_callback(const MapHandle& maphandle, std::function< void (const Error&, const Map&) > callback, uint32_t deviceId = 0);
316
+ std::future<Map> ReadMap_async(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
317
+
318
+ void UpdateMap(const Map& map, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
319
+ void UpdateMap_callback(const Map& map, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
320
+ std::future<void> UpdateMap_async(const Map& map, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
321
+
322
+ void DeleteMap(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
323
+ void DeleteMap_callback(const MapHandle& maphandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
324
+ std::future<void> DeleteMap_async(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
325
+
326
+ MapList ReadAllMaps(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
327
+ void ReadAllMaps_callback(const MappingHandle& mappinghandle, std::function< void (const Error&, const MapList&) > callback, uint32_t deviceId = 0);
328
+ std::future<MapList> ReadAllMaps_async(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
329
+
330
+ void ActivateMap(const ActivateMapHandle& activatemaphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
331
+ void ActivateMap_callback(const ActivateMapHandle& activatemaphandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
332
+ std::future<void> ActivateMap_async(const ActivateMapHandle& activatemaphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
333
+
334
+ ActionHandle CreateAction(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
335
+ void CreateAction_callback(const Action& action, std::function< void (const Error&, const ActionHandle&) > callback, uint32_t deviceId = 0);
336
+ std::future<ActionHandle> CreateAction_async(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
337
+
338
+ Action ReadAction(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
339
+ void ReadAction_callback(const ActionHandle& actionhandle, std::function< void (const Error&, const Action&) > callback, uint32_t deviceId = 0);
340
+ std::future<Action> ReadAction_async(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
341
+
342
+ ActionList ReadAllActions(const RequestedActionType& requestedactiontype, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
343
+ void ReadAllActions_callback(const RequestedActionType& requestedactiontype, std::function< void (const Error&, const ActionList&) > callback, uint32_t deviceId = 0);
344
+ std::future<ActionList> ReadAllActions_async(const RequestedActionType& requestedactiontype, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
345
+
346
+ void DeleteAction(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
347
+ void DeleteAction_callback(const ActionHandle& actionhandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
348
+ std::future<void> DeleteAction_async(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
349
+
350
+ void UpdateAction(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
351
+ void UpdateAction_callback(const Action& action, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
352
+ std::future<void> UpdateAction_async(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
353
+
354
+ void ExecuteActionFromReference(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
355
+ void ExecuteActionFromReference_callback(const ActionHandle& actionhandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
356
+ std::future<void> ExecuteActionFromReference_async(const ActionHandle& actionhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
357
+
358
+ void ExecuteAction(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
359
+ void ExecuteAction_callback(const Action& action, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
360
+ std::future<void> ExecuteAction_async(const Action& action, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
361
+
362
+ void PauseAction(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
363
+ void PauseAction_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
364
+ std::future<void> PauseAction_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
365
+
366
+ void StopAction(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
367
+ void StopAction_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
368
+ std::future<void> StopAction_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
369
+
370
+ void ResumeAction(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
371
+ void ResumeAction_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
372
+ std::future<void> ResumeAction_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
373
+
374
+ IPv4Configuration GetIPv4Configuration(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
375
+ void GetIPv4Configuration_callback(const NetworkHandle& networkhandle, std::function< void (const Error&, const IPv4Configuration&) > callback, uint32_t deviceId = 0);
376
+ std::future<IPv4Configuration> GetIPv4Configuration_async(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
377
+
378
+ void SetIPv4Configuration(const FullIPv4Configuration& fullipv4configuration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
379
+ void SetIPv4Configuration_callback(const FullIPv4Configuration& fullipv4configuration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
380
+ std::future<void> SetIPv4Configuration_async(const FullIPv4Configuration& fullipv4configuration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
381
+
382
+ void SetCommunicationInterfaceEnable(const CommunicationInterfaceConfiguration& communicationinterfaceconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
383
+ void SetCommunicationInterfaceEnable_callback(const CommunicationInterfaceConfiguration& communicationinterfaceconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
384
+ std::future<void> SetCommunicationInterfaceEnable_async(const CommunicationInterfaceConfiguration& communicationinterfaceconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
385
+
386
+ CommunicationInterfaceConfiguration IsCommunicationInterfaceEnable(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
387
+ void IsCommunicationInterfaceEnable_callback(const NetworkHandle& networkhandle, std::function< void (const Error&, const CommunicationInterfaceConfiguration&) > callback, uint32_t deviceId = 0);
388
+ std::future<CommunicationInterfaceConfiguration> IsCommunicationInterfaceEnable_async(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
389
+
390
+ WifiInformationList GetAvailableWifi(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
391
+ void GetAvailableWifi_callback(std::function< void (const Error&, const WifiInformationList&) > callback, uint32_t deviceId = 0);
392
+ std::future<WifiInformationList> GetAvailableWifi_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
393
+
394
+ WifiInformation GetWifiInformation(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
395
+ void GetWifiInformation_callback(const Ssid& ssid, std::function< void (const Error&, const WifiInformation&) > callback, uint32_t deviceId = 0);
396
+ std::future<WifiInformation> GetWifiInformation_async(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
397
+
398
+ void AddWifiConfiguration(const WifiConfiguration& wificonfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
399
+ void AddWifiConfiguration_callback(const WifiConfiguration& wificonfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
400
+ std::future<void> AddWifiConfiguration_async(const WifiConfiguration& wificonfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
401
+
402
+ void DeleteWifiConfiguration(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
403
+ void DeleteWifiConfiguration_callback(const Ssid& ssid, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
404
+ std::future<void> DeleteWifiConfiguration_async(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
405
+
406
+ WifiConfigurationList GetAllConfiguredWifis(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
407
+ void GetAllConfiguredWifis_callback(std::function< void (const Error&, const WifiConfigurationList&) > callback, uint32_t deviceId = 0);
408
+ std::future<WifiConfigurationList> GetAllConfiguredWifis_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
409
+
410
+ void ConnectWifi(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
411
+ void ConnectWifi_callback(const Ssid& ssid, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
412
+ std::future<void> ConnectWifi_async(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
413
+
414
+ void DisconnectWifi(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
415
+ void DisconnectWifi_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
416
+ std::future<void> DisconnectWifi_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
417
+
418
+ WifiInformation GetConnectedWifiInformation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
419
+ void GetConnectedWifiInformation_callback(std::function< void (const Error&, const WifiInformation&) > callback, uint32_t deviceId = 0);
420
+ std::future<WifiInformation> GetConnectedWifiInformation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
421
+
422
+ void Unsubscribe(const Kinova::Api::Common::NotificationHandle& notificationhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
423
+
424
+ Kinova::Api::Common::NotificationHandle OnNotificationConfigurationChangeTopic(std::function< void (ConfigurationChangeNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
425
+
426
+ Kinova::Api::Common::NotificationHandle OnNotificationMappingInfoTopic(std::function< void (MappingInfoNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
427
+
428
+ Kinova::Api::Common::NotificationHandle OnNotificationOperatingModeTopic(std::function< void (OperatingModeNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
429
+
430
+ Kinova::Api::Common::NotificationHandle OnNotificationSequenceInfoTopic(std::function< void (SequenceInfoNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
431
+
432
+ Kinova::Api::Common::NotificationHandle OnNotificationProtectionZoneTopic(std::function< void (ProtectionZoneNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
433
+
434
+ Kinova::Api::Common::NotificationHandle OnNotificationUserTopic(std::function< void (UserNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
435
+
436
+ Kinova::Api::Common::NotificationHandle OnNotificationControllerTopic(std::function< void (ControllerNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
437
+
438
+ Kinova::Api::Common::NotificationHandle OnNotificationActionTopic(std::function< void (ActionNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
439
+
440
+ Kinova::Api::Common::NotificationHandle OnNotificationRobotEventTopic(std::function< void (RobotEventNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
441
+
442
+ DEPRECATED void PlayCartesianTrajectory(const ConstrainedPose& constrainedpose, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
443
+ DEPRECATED void PlayCartesianTrajectory_callback(const ConstrainedPose& constrainedpose, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
444
+ DEPRECATED std::future<void> PlayCartesianTrajectory_async(const ConstrainedPose& constrainedpose, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
445
+
446
+ DEPRECATED void PlayCartesianTrajectoryPosition(const ConstrainedPosition& constrainedposition, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
447
+ DEPRECATED void PlayCartesianTrajectoryPosition_callback(const ConstrainedPosition& constrainedposition, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
448
+ DEPRECATED std::future<void> PlayCartesianTrajectoryPosition_async(const ConstrainedPosition& constrainedposition, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
449
+
450
+ DEPRECATED void PlayCartesianTrajectoryOrientation(const ConstrainedOrientation& constrainedorientation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
451
+ DEPRECATED void PlayCartesianTrajectoryOrientation_callback(const ConstrainedOrientation& constrainedorientation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
452
+ DEPRECATED std::future<void> PlayCartesianTrajectoryOrientation_async(const ConstrainedOrientation& constrainedorientation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
453
+
454
+ void Stop(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
455
+ void Stop_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
456
+ std::future<void> Stop_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
457
+
458
+ Pose GetMeasuredCartesianPose(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
459
+ void GetMeasuredCartesianPose_callback(std::function< void (const Error&, const Pose&) > callback, uint32_t deviceId = 0);
460
+ std::future<Pose> GetMeasuredCartesianPose_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
461
+
462
+ void SendWrenchCommand(const WrenchCommand& wrenchcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
463
+ void SendWrenchCommand_callback(const WrenchCommand& wrenchcommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
464
+ std::future<void> SendWrenchCommand_async(const WrenchCommand& wrenchcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
465
+
466
+ void SendWrenchJoystickCommand(const WrenchCommand& wrenchcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
467
+ void SendWrenchJoystickCommand_callback(const WrenchCommand& wrenchcommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
468
+ std::future<void> SendWrenchJoystickCommand_async(const WrenchCommand& wrenchcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
469
+
470
+ void SendTwistJoystickCommand(const TwistCommand& twistcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
471
+ void SendTwistJoystickCommand_callback(const TwistCommand& twistcommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
472
+ std::future<void> SendTwistJoystickCommand_async(const TwistCommand& twistcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
473
+
474
+ void SendTwistCommand(const TwistCommand& twistcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
475
+ void SendTwistCommand_callback(const TwistCommand& twistcommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
476
+ std::future<void> SendTwistCommand_async(const TwistCommand& twistcommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
477
+
478
+ DEPRECATED void PlayJointTrajectory(const ConstrainedJointAngles& constrainedjointangles, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
479
+ DEPRECATED void PlayJointTrajectory_callback(const ConstrainedJointAngles& constrainedjointangles, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
480
+ DEPRECATED std::future<void> PlayJointTrajectory_async(const ConstrainedJointAngles& constrainedjointangles, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
481
+
482
+ DEPRECATED void PlaySelectedJointTrajectory(const ConstrainedJointAngle& constrainedjointangle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
483
+ DEPRECATED void PlaySelectedJointTrajectory_callback(const ConstrainedJointAngle& constrainedjointangle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
484
+ DEPRECATED std::future<void> PlaySelectedJointTrajectory_async(const ConstrainedJointAngle& constrainedjointangle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
485
+
486
+ JointAngles GetMeasuredJointAngles(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
487
+ void GetMeasuredJointAngles_callback(std::function< void (const Error&, const JointAngles&) > callback, uint32_t deviceId = 0);
488
+ std::future<JointAngles> GetMeasuredJointAngles_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
489
+
490
+ void SendJointSpeedsCommand(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
491
+ void SendJointSpeedsCommand_callback(const JointSpeeds& jointspeeds, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
492
+ std::future<void> SendJointSpeedsCommand_async(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
493
+
494
+ void SendSelectedJointSpeedCommand(const JointSpeed& jointspeed, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
495
+ void SendSelectedJointSpeedCommand_callback(const JointSpeed& jointspeed, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
496
+ std::future<void> SendSelectedJointSpeedCommand_async(const JointSpeed& jointspeed, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
497
+
498
+ void SendGripperCommand(const GripperCommand& grippercommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
499
+ void SendGripperCommand_callback(const GripperCommand& grippercommand, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
500
+ std::future<void> SendGripperCommand_async(const GripperCommand& grippercommand, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
501
+
502
+ Gripper GetMeasuredGripperMovement(const GripperRequest& gripperrequest, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
503
+ void GetMeasuredGripperMovement_callback(const GripperRequest& gripperrequest, std::function< void (const Error&, const Gripper&) > callback, uint32_t deviceId = 0);
504
+ std::future<Gripper> GetMeasuredGripperMovement_async(const GripperRequest& gripperrequest, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
505
+
506
+ void SetAdmittance(const Admittance& admittance, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
507
+ void SetAdmittance_callback(const Admittance& admittance, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
508
+ std::future<void> SetAdmittance_async(const Admittance& admittance, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
509
+
510
+ void SetOperatingMode(const OperatingModeInformation& operatingmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
511
+ void SetOperatingMode_callback(const OperatingModeInformation& operatingmodeinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
512
+ std::future<void> SetOperatingMode_async(const OperatingModeInformation& operatingmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
513
+
514
+ void ApplyEmergencyStop(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
515
+ void ApplyEmergencyStop_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
516
+ std::future<void> ApplyEmergencyStop_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
517
+
518
+ void ClearFaults(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
519
+ void ClearFaults_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
520
+ std::future<void> ClearFaults_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
521
+
522
+ OperatingModeInformation GetOperatingMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
523
+ void GetOperatingMode_callback(std::function< void (const Error&, const OperatingModeInformation&) > callback, uint32_t deviceId = 0);
524
+ std::future<OperatingModeInformation> GetOperatingMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
525
+
526
+ void SetServoingMode(const ServoingModeInformation& servoingmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
527
+ void SetServoingMode_callback(const ServoingModeInformation& servoingmodeinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
528
+ std::future<void> SetServoingMode_async(const ServoingModeInformation& servoingmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
529
+
530
+ ServoingModeInformation GetServoingMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
531
+ void GetServoingMode_callback(std::function< void (const Error&, const ServoingModeInformation&) > callback, uint32_t deviceId = 0);
532
+ std::future<ServoingModeInformation> GetServoingMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
533
+
534
+ Kinova::Api::Common::NotificationHandle OnNotificationServoingModeTopic(std::function< void (ServoingModeNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
535
+
536
+ void RestoreFactorySettings(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
537
+ void RestoreFactorySettings_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
538
+ std::future<void> RestoreFactorySettings_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
539
+
540
+ void Reboot(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
541
+ void Reboot_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
542
+ std::future<void> Reboot_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
543
+
544
+ Kinova::Api::Common::NotificationHandle OnNotificationFactoryTopic(std::function< void (FactoryNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
545
+
546
+ ControllerList GetAllConnectedControllers(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
547
+ void GetAllConnectedControllers_callback(std::function< void (const Error&, const ControllerList&) > callback, uint32_t deviceId = 0);
548
+ std::future<ControllerList> GetAllConnectedControllers_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
549
+
550
+ ControllerState GetControllerState(const ControllerHandle& controllerhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
551
+ void GetControllerState_callback(const ControllerHandle& controllerhandle, std::function< void (const Error&, const ControllerState&) > callback, uint32_t deviceId = 0);
552
+ std::future<ControllerState> GetControllerState_async(const ControllerHandle& controllerhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
553
+
554
+ ActuatorInformation GetActuatorCount(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
555
+ void GetActuatorCount_callback(std::function< void (const Error&, const ActuatorInformation&) > callback, uint32_t deviceId = 0);
556
+ std::future<ActuatorInformation> GetActuatorCount_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
557
+
558
+ void StartWifiScan(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
559
+ void StartWifiScan_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
560
+ std::future<void> StartWifiScan_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
561
+
562
+ WifiConfiguration GetConfiguredWifi(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
563
+ void GetConfiguredWifi_callback(const Ssid& ssid, std::function< void (const Error&, const WifiConfiguration&) > callback, uint32_t deviceId = 0);
564
+ std::future<WifiConfiguration> GetConfiguredWifi_async(const Ssid& ssid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
565
+
566
+ Kinova::Api::Common::NotificationHandle OnNotificationNetworkTopic(std::function< void (NetworkNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
567
+
568
+ ArmStateInformation GetArmState(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
569
+ void GetArmState_callback(std::function< void (const Error&, const ArmStateInformation&) > callback, uint32_t deviceId = 0);
570
+ std::future<ArmStateInformation> GetArmState_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
571
+
572
+ Kinova::Api::Common::NotificationHandle OnNotificationArmStateTopic(std::function< void (ArmStateNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
573
+
574
+ IPv4Information GetIPv4Information(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
575
+ void GetIPv4Information_callback(const NetworkHandle& networkhandle, std::function< void (const Error&, const IPv4Information&) > callback, uint32_t deviceId = 0);
576
+ std::future<IPv4Information> GetIPv4Information_async(const NetworkHandle& networkhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
577
+
578
+ void SetWifiCountryCode(const Kinova::Api::Common::CountryCode& countrycode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
579
+ void SetWifiCountryCode_callback(const Kinova::Api::Common::CountryCode& countrycode, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
580
+ std::future<void> SetWifiCountryCode_async(const Kinova::Api::Common::CountryCode& countrycode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
581
+
582
+ Kinova::Api::Common::CountryCode GetWifiCountryCode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
583
+ void GetWifiCountryCode_callback(std::function< void (const Error&, const Kinova::Api::Common::CountryCode&) > callback, uint32_t deviceId = 0);
584
+ std::future<Kinova::Api::Common::CountryCode> GetWifiCountryCode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
585
+
586
+ void SetCapSenseConfig(const CapSenseConfig& capsenseconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
587
+ void SetCapSenseConfig_callback(const CapSenseConfig& capsenseconfig, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
588
+ std::future<void> SetCapSenseConfig_async(const CapSenseConfig& capsenseconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
589
+
590
+ CapSenseConfig GetCapSenseConfig(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
591
+ void GetCapSenseConfig_callback(std::function< void (const Error&, const CapSenseConfig&) > callback, uint32_t deviceId = 0);
592
+ std::future<CapSenseConfig> GetCapSenseConfig_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
593
+
594
+ DEPRECATED JointsLimitationsList GetAllJointsTorqueHardLimitation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
595
+ DEPRECATED void GetAllJointsTorqueHardLimitation_callback(std::function< void (const Error&, const JointsLimitationsList&) > callback, uint32_t deviceId = 0);
596
+ DEPRECATED std::future<JointsLimitationsList> GetAllJointsTorqueHardLimitation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
597
+
598
+ DEPRECATED WrenchLimitation GetWrenchHardLimitation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
599
+ DEPRECATED void GetWrenchHardLimitation_callback(std::function< void (const Error&, const WrenchLimitation&) > callback, uint32_t deviceId = 0);
600
+ DEPRECATED std::future<WrenchLimitation> GetWrenchHardLimitation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
601
+
602
+ void SendJointSpeedsJoystickCommand(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
603
+ void SendJointSpeedsJoystickCommand_callback(const JointSpeeds& jointspeeds, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
604
+ std::future<void> SendJointSpeedsJoystickCommand_async(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
605
+
606
+ void SendSelectedJointSpeedJoystickCommand(const JointSpeed& jointspeed, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
607
+ void SendSelectedJointSpeedJoystickCommand_callback(const JointSpeed& jointspeed, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
608
+ std::future<void> SendSelectedJointSpeedJoystickCommand_async(const JointSpeed& jointspeed, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
609
+
610
+ BridgeResult EnableBridge(const BridgeConfig& bridgeconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
611
+ void EnableBridge_callback(const BridgeConfig& bridgeconfig, std::function< void (const Error&, const BridgeResult&) > callback, uint32_t deviceId = 0);
612
+ std::future<BridgeResult> EnableBridge_async(const BridgeConfig& bridgeconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
613
+
614
+ BridgeResult DisableBridge(const BridgeIdentifier& bridgeidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
615
+ void DisableBridge_callback(const BridgeIdentifier& bridgeidentifier, std::function< void (const Error&, const BridgeResult&) > callback, uint32_t deviceId = 0);
616
+ std::future<BridgeResult> DisableBridge_async(const BridgeIdentifier& bridgeidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
617
+
618
+ BridgeList GetBridgeList(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
619
+ void GetBridgeList_callback(std::function< void (const Error&, const BridgeList&) > callback, uint32_t deviceId = 0);
620
+ std::future<BridgeList> GetBridgeList_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
621
+
622
+ BridgeConfig GetBridgeConfig(const BridgeIdentifier& bridgeidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
623
+ void GetBridgeConfig_callback(const BridgeIdentifier& bridgeidentifier, std::function< void (const Error&, const BridgeConfig&) > callback, uint32_t deviceId = 0);
624
+ std::future<BridgeConfig> GetBridgeConfig_async(const BridgeIdentifier& bridgeidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
625
+
626
+ void PlayPreComputedJointTrajectory(const PreComputedJointTrajectory& precomputedjointtrajectory, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
627
+ void PlayPreComputedJointTrajectory_callback(const PreComputedJointTrajectory& precomputedjointtrajectory, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
628
+ std::future<void> PlayPreComputedJointTrajectory_async(const PreComputedJointTrajectory& precomputedjointtrajectory, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
629
+
630
+ Kinova::Api::ProductConfiguration::CompleteProductConfiguration GetProductConfiguration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
631
+ void GetProductConfiguration_callback(std::function< void (const Error&, const Kinova::Api::ProductConfiguration::CompleteProductConfiguration&) > callback, uint32_t deviceId = 0);
632
+ std::future<Kinova::Api::ProductConfiguration::CompleteProductConfiguration> GetProductConfiguration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
633
+
634
+ void UpdateEndEffectorTypeConfiguration(const Kinova::Api::ProductConfiguration::ProductConfigurationEndEffectorType& productconfigurationendeffectortype, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
635
+ void UpdateEndEffectorTypeConfiguration_callback(const Kinova::Api::ProductConfiguration::ProductConfigurationEndEffectorType& productconfigurationendeffectortype, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
636
+ std::future<void> UpdateEndEffectorTypeConfiguration_async(const Kinova::Api::ProductConfiguration::ProductConfigurationEndEffectorType& productconfigurationendeffectortype, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
637
+
638
+ void RestoreFactoryProductConfiguration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
639
+ void RestoreFactoryProductConfiguration_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
640
+ std::future<void> RestoreFactoryProductConfiguration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
641
+
642
+ TrajectoryErrorReport GetTrajectoryErrorReport(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
643
+ void GetTrajectoryErrorReport_callback(std::function< void (const Error&, const TrajectoryErrorReport&) > callback, uint32_t deviceId = 0);
644
+ std::future<TrajectoryErrorReport> GetTrajectoryErrorReport_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
645
+
646
+ DEPRECATED JointsLimitationsList GetAllJointsTorqueSoftLimitation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
647
+ DEPRECATED void GetAllJointsTorqueSoftLimitation_callback(std::function< void (const Error&, const JointsLimitationsList&) > callback, uint32_t deviceId = 0);
648
+ DEPRECATED std::future<JointsLimitationsList> GetAllJointsTorqueSoftLimitation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
649
+
650
+ DEPRECATED WrenchLimitation GetWrenchSoftLimitation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
651
+ DEPRECATED void GetWrenchSoftLimitation_callback(std::function< void (const Error&, const WrenchLimitation&) > callback, uint32_t deviceId = 0);
652
+ DEPRECATED std::future<WrenchLimitation> GetWrenchSoftLimitation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
653
+
654
+ void SetControllerConfigurationMode(const ControllerConfigurationMode& controllerconfigurationmode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
655
+ void SetControllerConfigurationMode_callback(const ControllerConfigurationMode& controllerconfigurationmode, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
656
+ std::future<void> SetControllerConfigurationMode_async(const ControllerConfigurationMode& controllerconfigurationmode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
657
+
658
+ ControllerConfigurationMode GetControllerConfigurationMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
659
+ void GetControllerConfigurationMode_callback(std::function< void (const Error&, const ControllerConfigurationMode&) > callback, uint32_t deviceId = 0);
660
+ std::future<ControllerConfigurationMode> GetControllerConfigurationMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
661
+
662
+ void StartTeaching(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
663
+ void StartTeaching_callback(const SequenceTaskHandle& sequencetaskhandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
664
+ std::future<void> StartTeaching_async(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
665
+
666
+ void StopTeaching(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
667
+ void StopTeaching_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
668
+ std::future<void> StopTeaching_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
669
+
670
+ SequenceTasksRange AddSequenceTasks(const SequenceTasksConfiguration& sequencetasksconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
671
+ void AddSequenceTasks_callback(const SequenceTasksConfiguration& sequencetasksconfiguration, std::function< void (const Error&, const SequenceTasksRange&) > callback, uint32_t deviceId = 0);
672
+ std::future<SequenceTasksRange> AddSequenceTasks_async(const SequenceTasksConfiguration& sequencetasksconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
673
+
674
+ void UpdateSequenceTask(const SequenceTaskConfiguration& sequencetaskconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
675
+ void UpdateSequenceTask_callback(const SequenceTaskConfiguration& sequencetaskconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
676
+ std::future<void> UpdateSequenceTask_async(const SequenceTaskConfiguration& sequencetaskconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
677
+
678
+ void SwapSequenceTasks(const SequenceTasksPair& sequencetaskspair, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
679
+ void SwapSequenceTasks_callback(const SequenceTasksPair& sequencetaskspair, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
680
+ std::future<void> SwapSequenceTasks_async(const SequenceTasksPair& sequencetaskspair, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
681
+
682
+ SequenceTask ReadSequenceTask(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
683
+ void ReadSequenceTask_callback(const SequenceTaskHandle& sequencetaskhandle, std::function< void (const Error&, const SequenceTask&) > callback, uint32_t deviceId = 0);
684
+ std::future<SequenceTask> ReadSequenceTask_async(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
685
+
686
+ SequenceTasks ReadAllSequenceTasks(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
687
+ void ReadAllSequenceTasks_callback(const SequenceHandle& sequencehandle, std::function< void (const Error&, const SequenceTasks&) > callback, uint32_t deviceId = 0);
688
+ std::future<SequenceTasks> ReadAllSequenceTasks_async(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
689
+
690
+ void DeleteSequenceTask(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
691
+ void DeleteSequenceTask_callback(const SequenceTaskHandle& sequencetaskhandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
692
+ std::future<void> DeleteSequenceTask_async(const SequenceTaskHandle& sequencetaskhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
693
+
694
+ void DeleteAllSequenceTasks(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
695
+ void DeleteAllSequenceTasks_callback(const SequenceHandle& sequencehandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
696
+ std::future<void> DeleteAllSequenceTasks_async(const SequenceHandle& sequencehandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
697
+
698
+ void TakeSnapshot(const Snapshot& snapshot, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
699
+ void TakeSnapshot_callback(const Snapshot& snapshot, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
700
+ std::future<void> TakeSnapshot_async(const Snapshot& snapshot, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
701
+
702
+ FirmwareBundleVersions GetFirmwareBundleVersions(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
703
+ void GetFirmwareBundleVersions_callback(std::function< void (const Error&, const FirmwareBundleVersions&) > callback, uint32_t deviceId = 0);
704
+ std::future<FirmwareBundleVersions> GetFirmwareBundleVersions_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
705
+
706
+ void ExecuteWaypointTrajectory(const WaypointList& waypointlist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
707
+ void ExecuteWaypointTrajectory_callback(const WaypointList& waypointlist, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
708
+ std::future<void> ExecuteWaypointTrajectory_async(const WaypointList& waypointlist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
709
+
710
+ void MoveSequenceTask(const SequenceTasksPair& sequencetaskspair, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
711
+ void MoveSequenceTask_callback(const SequenceTasksPair& sequencetaskspair, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
712
+ std::future<void> MoveSequenceTask_async(const SequenceTasksPair& sequencetaskspair, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
713
+
714
+ MappingHandle DuplicateMapping(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
715
+ void DuplicateMapping_callback(const MappingHandle& mappinghandle, std::function< void (const Error&, const MappingHandle&) > callback, uint32_t deviceId = 0);
716
+ std::future<MappingHandle> DuplicateMapping_async(const MappingHandle& mappinghandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
717
+
718
+ MapHandle DuplicateMap(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
719
+ void DuplicateMap_callback(const MapHandle& maphandle, std::function< void (const Error&, const MapHandle&) > callback, uint32_t deviceId = 0);
720
+ std::future<MapHandle> DuplicateMap_async(const MapHandle& maphandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
721
+
722
+ void SetControllerConfiguration(const ControllerConfiguration& controllerconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
723
+ void SetControllerConfiguration_callback(const ControllerConfiguration& controllerconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
724
+ std::future<void> SetControllerConfiguration_async(const ControllerConfiguration& controllerconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
725
+
726
+ ControllerConfiguration GetControllerConfiguration(const ControllerHandle& controllerhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
727
+ void GetControllerConfiguration_callback(const ControllerHandle& controllerhandle, std::function< void (const Error&, const ControllerConfiguration&) > callback, uint32_t deviceId = 0);
728
+ std::future<ControllerConfiguration> GetControllerConfiguration_async(const ControllerHandle& controllerhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
729
+
730
+ ControllerConfigurationList GetAllControllerConfigurations(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
731
+ void GetAllControllerConfigurations_callback(std::function< void (const Error&, const ControllerConfigurationList&) > callback, uint32_t deviceId = 0);
732
+ std::future<ControllerConfigurationList> GetAllControllerConfigurations_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
733
+
734
+ Pose ComputeForwardKinematics(const JointAngles& jointangles, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
735
+ void ComputeForwardKinematics_callback(const JointAngles& jointangles, std::function< void (const Error&, const Pose&) > callback, uint32_t deviceId = 0);
736
+ std::future<Pose> ComputeForwardKinematics_async(const JointAngles& jointangles, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
737
+
738
+ JointAngles ComputeInverseKinematics(const IKData& ikdata, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
739
+ void ComputeInverseKinematics_callback(const IKData& ikdata, std::function< void (const Error&, const JointAngles&) > callback, uint32_t deviceId = 0);
740
+ std::future<JointAngles> ComputeInverseKinematics_async(const IKData& ikdata, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
741
+
742
+ WaypointValidationReport ValidateWaypointList(const WaypointList& waypointlist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
743
+ void ValidateWaypointList_callback(const WaypointList& waypointlist, std::function< void (const Error&, const WaypointValidationReport&) > callback, uint32_t deviceId = 0);
744
+ std::future<WaypointValidationReport> ValidateWaypointList_async(const WaypointList& waypointlist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
745
+
746
+ void SetWifiEnableState(const WifiEnableState& wifienablestate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
747
+ void SetWifiEnableState_callback(const WifiEnableState& wifienablestate, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
748
+ std::future<void> SetWifiEnableState_async(const WifiEnableState& wifienablestate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
749
+
750
+ WifiEnableState GetWifiEnableState(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
751
+ void GetWifiEnableState_callback(std::function< void (const Error&, const WifiEnableState&) > callback, uint32_t deviceId = 0);
752
+ std::future<WifiEnableState> GetWifiEnableState_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
753
+
754
+ void SetBluetoothEnableState(const BluetoothEnableState& bluetoothenablestate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
755
+ void SetBluetoothEnableState_callback(const BluetoothEnableState& bluetoothenablestate, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
756
+ std::future<void> SetBluetoothEnableState_async(const BluetoothEnableState& bluetoothenablestate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
757
+
758
+ BluetoothEnableState GetBluetoothEnableState(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
759
+ void GetBluetoothEnableState_callback(std::function< void (const Error&, const BluetoothEnableState&) > callback, uint32_t deviceId = 0);
760
+ std::future<BluetoothEnableState> GetBluetoothEnableState_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
761
+
762
+
763
+ private:
764
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
765
+ };
766
+ }
767
+ }
768
+ }
769
+
770
+ #endif
kortex_api/include/client_stubs/BaseCyclicClientRpc.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __BASECYCLICCLIENT_H__
2
+ #define __BASECYCLICCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/BaseCyclic.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace BaseCyclic
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidRefresh = 0x30001,
41
+ eUidRefreshCommand = 0x30002,
42
+ eUidRefreshFeedback = 0x30003,
43
+ eUidRefreshCustomData = 0x30004,
44
+ };
45
+
46
+ class BaseCyclicClient
47
+ {
48
+ static const uint32_t m_serviceVersion = 1;
49
+ static const uint32_t m_serviceId = eIdBaseCyclic;
50
+ NotificationHandler m_notificationHandler;
51
+
52
+ protected:
53
+ IRouterClient* const m_clientRouter;
54
+
55
+ public:
56
+ BaseCyclicClient(IRouterClient* clientRouter);
57
+ static uint32_t getUniqueFctId(uint16_t fctId);
58
+
59
+ Feedback Refresh(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
60
+ void Refresh_callback(const Command& command, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
61
+ std::future<Feedback> Refresh_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
62
+
63
+ void RefreshCommand(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
64
+ void RefreshCommand_callback(const Command& command, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
65
+ std::future<void> RefreshCommand_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
66
+
67
+ Feedback RefreshFeedback(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void RefreshFeedback_callback(std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
69
+ std::future<Feedback> RefreshFeedback_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ CustomData RefreshCustomData(const CustomData& customdata, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void RefreshCustomData_callback(const CustomData& customdata, std::function< void (const Error&, const CustomData&) > callback, uint32_t deviceId = 0);
73
+ std::future<CustomData> RefreshCustomData_async(const CustomData& customdata, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+
76
+ private:
77
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
78
+ };
79
+ }
80
+ }
81
+ }
82
+
83
+ #endif
kortex_api/include/client_stubs/ControlConfigClientRpc.h ADDED
@@ -0,0 +1,207 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __CONTROLCONFIGCLIENT_H__
2
+ #define __CONTROLCONFIGCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/ControlConfig.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace ControlConfig
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidSetGravityVector = 0x100001,
41
+ eUidGetGravityVector = 0x100002,
42
+ eUidSetPayloadInformation = 0x100003,
43
+ eUidGetPayloadInformation = 0x100004,
44
+ eUidSetToolConfiguration = 0x100005,
45
+ eUidGetToolConfiguration = 0x100006,
46
+ eUidControlConfigurationTopic = 0x100007,
47
+ eUidUnsubscribe = 0x100008,
48
+ eUidSetCartesianReferenceFrame = 0x100009,
49
+ eUidGetCartesianReferenceFrame = 0x10000a,
50
+ eUidGetControlMode = 0x10000d,
51
+ eUidSetJointSpeedSoftLimits = 0x10000e,
52
+ eUidSetTwistLinearSoftLimit = 0x10000f,
53
+ eUidSetTwistAngularSoftLimit = 0x100010,
54
+ eUidSetJointAccelerationSoftLimits = 0x100011,
55
+ eUidGetKinematicHardLimits = 0x100012,
56
+ eUidGetKinematicSoftLimits = 0x100013,
57
+ eUidGetAllKinematicSoftLimits = 0x100014,
58
+ eUidSetDesiredLinearTwist = 0x100015,
59
+ eUidSetDesiredAngularTwist = 0x100016,
60
+ eUidSetDesiredJointSpeeds = 0x100017,
61
+ eUidGetDesiredSpeeds = 0x100018,
62
+ eUidResetGravityVector = 0x100019,
63
+ eUidResetPayloadInformation = 0x10001a,
64
+ eUidResetToolConfiguration = 0x10001b,
65
+ eUidResetJointSpeedSoftLimits = 0x10001c,
66
+ eUidResetTwistLinearSoftLimit = 0x10001d,
67
+ eUidResetTwistAngularSoftLimit = 0x10001e,
68
+ eUidResetJointAccelerationSoftLimits = 0x10001f,
69
+ eUidControlModeTopic = 0x100020,
70
+ };
71
+
72
+ class ControlConfigClient
73
+ {
74
+ static const uint32_t m_serviceVersion = 1;
75
+ static const uint32_t m_serviceId = eIdControlConfig;
76
+ NotificationHandler m_notificationHandler;
77
+
78
+ protected:
79
+ IRouterClient* const m_clientRouter;
80
+
81
+ public:
82
+ ControlConfigClient(IRouterClient* clientRouter);
83
+ static uint32_t getUniqueFctId(uint16_t fctId);
84
+
85
+ void SetGravityVector(const GravityVector& gravityvector, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
86
+ void SetGravityVector_callback(const GravityVector& gravityvector, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
87
+ std::future<void> SetGravityVector_async(const GravityVector& gravityvector, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
88
+
89
+ GravityVector GetGravityVector(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
90
+ void GetGravityVector_callback(std::function< void (const Error&, const GravityVector&) > callback, uint32_t deviceId = 0);
91
+ std::future<GravityVector> GetGravityVector_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
92
+
93
+ void SetPayloadInformation(const PayloadInformation& payloadinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
94
+ void SetPayloadInformation_callback(const PayloadInformation& payloadinformation, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
95
+ std::future<void> SetPayloadInformation_async(const PayloadInformation& payloadinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
96
+
97
+ PayloadInformation GetPayloadInformation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
98
+ void GetPayloadInformation_callback(std::function< void (const Error&, const PayloadInformation&) > callback, uint32_t deviceId = 0);
99
+ std::future<PayloadInformation> GetPayloadInformation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
100
+
101
+ void SetToolConfiguration(const ToolConfiguration& toolconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
102
+ void SetToolConfiguration_callback(const ToolConfiguration& toolconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
103
+ std::future<void> SetToolConfiguration_async(const ToolConfiguration& toolconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
104
+
105
+ ToolConfiguration GetToolConfiguration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
106
+ void GetToolConfiguration_callback(std::function< void (const Error&, const ToolConfiguration&) > callback, uint32_t deviceId = 0);
107
+ std::future<ToolConfiguration> GetToolConfiguration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
108
+
109
+ Kinova::Api::Common::NotificationHandle OnNotificationControlConfigurationTopic(std::function< void (ControlConfigurationNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
110
+
111
+ void Unsubscribe(const Kinova::Api::Common::NotificationHandle& notificationhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
112
+
113
+ void SetCartesianReferenceFrame(const CartesianReferenceFrameInfo& cartesianreferenceframeinfo, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
114
+ void SetCartesianReferenceFrame_callback(const CartesianReferenceFrameInfo& cartesianreferenceframeinfo, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
115
+ std::future<void> SetCartesianReferenceFrame_async(const CartesianReferenceFrameInfo& cartesianreferenceframeinfo, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
116
+
117
+ CartesianReferenceFrameInfo GetCartesianReferenceFrame(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
118
+ void GetCartesianReferenceFrame_callback(std::function< void (const Error&, const CartesianReferenceFrameInfo&) > callback, uint32_t deviceId = 0);
119
+ std::future<CartesianReferenceFrameInfo> GetCartesianReferenceFrame_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
120
+
121
+ ControlModeInformation GetControlMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
122
+ void GetControlMode_callback(std::function< void (const Error&, const ControlModeInformation&) > callback, uint32_t deviceId = 0);
123
+ std::future<ControlModeInformation> GetControlMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
124
+
125
+ void SetJointSpeedSoftLimits(const JointSpeedSoftLimits& jointspeedsoftlimits, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
126
+ void SetJointSpeedSoftLimits_callback(const JointSpeedSoftLimits& jointspeedsoftlimits, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
127
+ std::future<void> SetJointSpeedSoftLimits_async(const JointSpeedSoftLimits& jointspeedsoftlimits, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
128
+
129
+ void SetTwistLinearSoftLimit(const TwistLinearSoftLimit& twistlinearsoftlimit, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
130
+ void SetTwistLinearSoftLimit_callback(const TwistLinearSoftLimit& twistlinearsoftlimit, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
131
+ std::future<void> SetTwistLinearSoftLimit_async(const TwistLinearSoftLimit& twistlinearsoftlimit, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
132
+
133
+ void SetTwistAngularSoftLimit(const TwistAngularSoftLimit& twistangularsoftlimit, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
134
+ void SetTwistAngularSoftLimit_callback(const TwistAngularSoftLimit& twistangularsoftlimit, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
135
+ std::future<void> SetTwistAngularSoftLimit_async(const TwistAngularSoftLimit& twistangularsoftlimit, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
136
+
137
+ void SetJointAccelerationSoftLimits(const JointAccelerationSoftLimits& jointaccelerationsoftlimits, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
138
+ void SetJointAccelerationSoftLimits_callback(const JointAccelerationSoftLimits& jointaccelerationsoftlimits, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
139
+ std::future<void> SetJointAccelerationSoftLimits_async(const JointAccelerationSoftLimits& jointaccelerationsoftlimits, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
140
+
141
+ KinematicLimits GetKinematicHardLimits(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
142
+ void GetKinematicHardLimits_callback(std::function< void (const Error&, const KinematicLimits&) > callback, uint32_t deviceId = 0);
143
+ std::future<KinematicLimits> GetKinematicHardLimits_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
144
+
145
+ KinematicLimits GetKinematicSoftLimits(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
146
+ void GetKinematicSoftLimits_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&, const KinematicLimits&) > callback, uint32_t deviceId = 0);
147
+ std::future<KinematicLimits> GetKinematicSoftLimits_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
148
+
149
+ KinematicLimitsList GetAllKinematicSoftLimits(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
150
+ void GetAllKinematicSoftLimits_callback(std::function< void (const Error&, const KinematicLimitsList&) > callback, uint32_t deviceId = 0);
151
+ std::future<KinematicLimitsList> GetAllKinematicSoftLimits_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
152
+
153
+ void SetDesiredLinearTwist(const LinearTwist& lineartwist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
154
+ void SetDesiredLinearTwist_callback(const LinearTwist& lineartwist, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
155
+ std::future<void> SetDesiredLinearTwist_async(const LinearTwist& lineartwist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
156
+
157
+ void SetDesiredAngularTwist(const AngularTwist& angulartwist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
158
+ void SetDesiredAngularTwist_callback(const AngularTwist& angulartwist, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
159
+ std::future<void> SetDesiredAngularTwist_async(const AngularTwist& angulartwist, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
160
+
161
+ void SetDesiredJointSpeeds(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
162
+ void SetDesiredJointSpeeds_callback(const JointSpeeds& jointspeeds, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
163
+ std::future<void> SetDesiredJointSpeeds_async(const JointSpeeds& jointspeeds, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
164
+
165
+ DesiredSpeeds GetDesiredSpeeds(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
166
+ void GetDesiredSpeeds_callback(std::function< void (const Error&, const DesiredSpeeds&) > callback, uint32_t deviceId = 0);
167
+ std::future<DesiredSpeeds> GetDesiredSpeeds_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
168
+
169
+ GravityVector ResetGravityVector(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
170
+ void ResetGravityVector_callback(std::function< void (const Error&, const GravityVector&) > callback, uint32_t deviceId = 0);
171
+ std::future<GravityVector> ResetGravityVector_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
172
+
173
+ PayloadInformation ResetPayloadInformation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
174
+ void ResetPayloadInformation_callback(std::function< void (const Error&, const PayloadInformation&) > callback, uint32_t deviceId = 0);
175
+ std::future<PayloadInformation> ResetPayloadInformation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
176
+
177
+ ToolConfiguration ResetToolConfiguration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
178
+ void ResetToolConfiguration_callback(std::function< void (const Error&, const ToolConfiguration&) > callback, uint32_t deviceId = 0);
179
+ std::future<ToolConfiguration> ResetToolConfiguration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
180
+
181
+ JointSpeedSoftLimits ResetJointSpeedSoftLimits(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
182
+ void ResetJointSpeedSoftLimits_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&, const JointSpeedSoftLimits&) > callback, uint32_t deviceId = 0);
183
+ std::future<JointSpeedSoftLimits> ResetJointSpeedSoftLimits_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
184
+
185
+ TwistLinearSoftLimit ResetTwistLinearSoftLimit(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
186
+ void ResetTwistLinearSoftLimit_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&, const TwistLinearSoftLimit&) > callback, uint32_t deviceId = 0);
187
+ std::future<TwistLinearSoftLimit> ResetTwistLinearSoftLimit_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
188
+
189
+ TwistAngularSoftLimit ResetTwistAngularSoftLimit(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
190
+ void ResetTwistAngularSoftLimit_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&, const TwistAngularSoftLimit&) > callback, uint32_t deviceId = 0);
191
+ std::future<TwistAngularSoftLimit> ResetTwistAngularSoftLimit_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
192
+
193
+ JointAccelerationSoftLimits ResetJointAccelerationSoftLimits(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
194
+ void ResetJointAccelerationSoftLimits_callback(const ControlModeInformation& controlmodeinformation, std::function< void (const Error&, const JointAccelerationSoftLimits&) > callback, uint32_t deviceId = 0);
195
+ std::future<JointAccelerationSoftLimits> ResetJointAccelerationSoftLimits_async(const ControlModeInformation& controlmodeinformation, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
196
+
197
+ Kinova::Api::Common::NotificationHandle OnNotificationControlModeTopic(std::function< void (ControlModeNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
198
+
199
+
200
+ private:
201
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
202
+ };
203
+ }
204
+ }
205
+ }
206
+
207
+ #endif
kortex_api/include/client_stubs/DeviceConfigClientRpc.h ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __DEVICECONFIGCLIENT_H__
2
+ #define __DEVICECONFIGCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+ #include "messages/Frame.pb.h"
9
+ #include "messages/DeviceConfig.pb.h"
10
+
11
+ #include "common/Frame.h"
12
+ #include "client/IRouterClient.h"
13
+ #include "client/NotificationHandler.h"
14
+
15
+ #if __cplusplus >= 201402L
16
+ #define DEPRECATED [[ deprecated ]]
17
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
18
+ #elif defined(__GNUC__)
19
+ #define DEPRECATED __attribute__ ((deprecated))
20
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
21
+ #elif defined(_MSC_VER)
22
+ #define DEPRECATED __declspec(deprecated)
23
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
24
+ #else
25
+ #define DEPRECATED
26
+ #define DEPRECATED_MSG
27
+ #endif
28
+ namespace Kinova
29
+ {
30
+ namespace Api
31
+ {
32
+ namespace DeviceConfig
33
+ {
34
+ // todogr move somewhere else
35
+ const std::string none = "";
36
+
37
+ enum FunctionUids
38
+ {
39
+ eUidGetRunMode = 0x90001,
40
+ eUidSetRunMode = 0x90002,
41
+ eUidGetDeviceType = 0x90003,
42
+ eUidGetFirmwareVersion = 0x90004,
43
+ eUidGetBootloaderVersion = 0x90005,
44
+ eUidGetModelNumber = 0x90006,
45
+ eUidGetPartNumber = 0x90007,
46
+ eUidGetSerialNumber = 0x90008,
47
+ eUidGetMACAddress = 0x90009,
48
+ eUidGetIPv4Settings = 0x9000a,
49
+ eUidSetIPv4Settings = 0x9000b,
50
+ eUidGetPartNumberRevision = 0x9000c,
51
+ eUidRebootRequest = 0x9000e,
52
+ eUidSetSafetyEnable = 0x9000f,
53
+ eUidSetSafetyErrorThreshold = 0x90010,
54
+ eUidSetSafetyWarningThreshold = 0x90011,
55
+ eUidSetSafetyConfiguration = 0x90012,
56
+ eUidGetSafetyConfiguration = 0x90013,
57
+ eUidGetSafetyInformation = 0x90014,
58
+ eUidGetSafetyEnable = 0x90015,
59
+ eUidGetSafetyStatus = 0x90016,
60
+ eUidClearAllSafetyStatus = 0x90017,
61
+ eUidClearSafetyStatus = 0x90018,
62
+ eUidGetAllSafetyConfiguration = 0x90019,
63
+ eUidGetAllSafetyInformation = 0x9001a,
64
+ eUidResetSafetyDefaults = 0x9001b,
65
+ eUidSafetyTopic = 0x9001c,
66
+ eUidExecuteCalibration = 0x90022,
67
+ eUidGetCalibrationResult = 0x90023,
68
+ eUidStopCalibration = 0x90024,
69
+ eUidSetCapSenseConfig = 0x90025,
70
+ eUidGetCapSenseConfig = 0x90026,
71
+ eUidReadCapSenseRegister = 0x90027,
72
+ eUidWriteCapSenseRegister = 0x90028,
73
+ };
74
+
75
+ class DeviceConfigClient
76
+ {
77
+ static const uint32_t m_serviceVersion = 1;
78
+ static const uint32_t m_serviceId = eIdDeviceConfig;
79
+ NotificationHandler m_notificationHandler;
80
+
81
+ protected:
82
+ IRouterClient* const m_clientRouter;
83
+
84
+ public:
85
+ DeviceConfigClient(IRouterClient* clientRouter);
86
+ static uint32_t getUniqueFctId(uint16_t fctId);
87
+
88
+ RunMode GetRunMode(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
89
+ void GetRunMode_callback(std::function< void (const Error&, const RunMode&) > callback, uint32_t deviceId = 0);
90
+ std::future<RunMode> GetRunMode_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
91
+
92
+ void SetRunMode(const RunMode& runmode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
93
+ void SetRunMode_callback(const RunMode& runmode, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
94
+ std::future<void> SetRunMode_async(const RunMode& runmode, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
95
+
96
+ DeviceType GetDeviceType(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
97
+ void GetDeviceType_callback(std::function< void (const Error&, const DeviceType&) > callback, uint32_t deviceId = 0);
98
+ std::future<DeviceType> GetDeviceType_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
99
+
100
+ FirmwareVersion GetFirmwareVersion(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
101
+ void GetFirmwareVersion_callback(std::function< void (const Error&, const FirmwareVersion&) > callback, uint32_t deviceId = 0);
102
+ std::future<FirmwareVersion> GetFirmwareVersion_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
103
+
104
+ BootloaderVersion GetBootloaderVersion(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
105
+ void GetBootloaderVersion_callback(std::function< void (const Error&, const BootloaderVersion&) > callback, uint32_t deviceId = 0);
106
+ std::future<BootloaderVersion> GetBootloaderVersion_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
107
+
108
+ ModelNumber GetModelNumber(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
109
+ void GetModelNumber_callback(std::function< void (const Error&, const ModelNumber&) > callback, uint32_t deviceId = 0);
110
+ std::future<ModelNumber> GetModelNumber_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
111
+
112
+ PartNumber GetPartNumber(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
113
+ void GetPartNumber_callback(std::function< void (const Error&, const PartNumber&) > callback, uint32_t deviceId = 0);
114
+ std::future<PartNumber> GetPartNumber_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
115
+
116
+ SerialNumber GetSerialNumber(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
117
+ void GetSerialNumber_callback(std::function< void (const Error&, const SerialNumber&) > callback, uint32_t deviceId = 0);
118
+ std::future<SerialNumber> GetSerialNumber_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
119
+
120
+ MACAddress GetMACAddress(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
121
+ void GetMACAddress_callback(std::function< void (const Error&, const MACAddress&) > callback, uint32_t deviceId = 0);
122
+ std::future<MACAddress> GetMACAddress_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
123
+
124
+ IPv4Settings GetIPv4Settings(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
125
+ void GetIPv4Settings_callback(std::function< void (const Error&, const IPv4Settings&) > callback, uint32_t deviceId = 0);
126
+ std::future<IPv4Settings> GetIPv4Settings_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
127
+
128
+ void SetIPv4Settings(const IPv4Settings& ipv4settings, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
129
+ void SetIPv4Settings_callback(const IPv4Settings& ipv4settings, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
130
+ std::future<void> SetIPv4Settings_async(const IPv4Settings& ipv4settings, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
131
+
132
+ PartNumberRevision GetPartNumberRevision(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
133
+ void GetPartNumberRevision_callback(std::function< void (const Error&, const PartNumberRevision&) > callback, uint32_t deviceId = 0);
134
+ std::future<PartNumberRevision> GetPartNumberRevision_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
135
+
136
+ void RebootRequest(const RebootRqst& rebootrqst, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
137
+ void RebootRequest_callback(const RebootRqst& rebootrqst, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
138
+ std::future<void> RebootRequest_async(const RebootRqst& rebootrqst, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
139
+
140
+ void SetSafetyEnable(const SafetyEnable& safetyenable, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
141
+ void SetSafetyEnable_callback(const SafetyEnable& safetyenable, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
142
+ std::future<void> SetSafetyEnable_async(const SafetyEnable& safetyenable, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
143
+
144
+ void SetSafetyErrorThreshold(const SafetyThreshold& safetythreshold, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
145
+ void SetSafetyErrorThreshold_callback(const SafetyThreshold& safetythreshold, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
146
+ std::future<void> SetSafetyErrorThreshold_async(const SafetyThreshold& safetythreshold, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
147
+
148
+ void SetSafetyWarningThreshold(const SafetyThreshold& safetythreshold, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
149
+ void SetSafetyWarningThreshold_callback(const SafetyThreshold& safetythreshold, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
150
+ std::future<void> SetSafetyWarningThreshold_async(const SafetyThreshold& safetythreshold, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
151
+
152
+ void SetSafetyConfiguration(const SafetyConfiguration& safetyconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
153
+ void SetSafetyConfiguration_callback(const SafetyConfiguration& safetyconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
154
+ std::future<void> SetSafetyConfiguration_async(const SafetyConfiguration& safetyconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
155
+
156
+ SafetyConfiguration GetSafetyConfiguration(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
157
+ void GetSafetyConfiguration_callback(const Kinova::Api::Common::SafetyHandle& safetyhandle, std::function< void (const Error&, const SafetyConfiguration&) > callback, uint32_t deviceId = 0);
158
+ std::future<SafetyConfiguration> GetSafetyConfiguration_async(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
159
+
160
+ SafetyInformation GetSafetyInformation(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
161
+ void GetSafetyInformation_callback(const Kinova::Api::Common::SafetyHandle& safetyhandle, std::function< void (const Error&, const SafetyInformation&) > callback, uint32_t deviceId = 0);
162
+ std::future<SafetyInformation> GetSafetyInformation_async(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
163
+
164
+ SafetyEnable GetSafetyEnable(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
165
+ void GetSafetyEnable_callback(const Kinova::Api::Common::SafetyHandle& safetyhandle, std::function< void (const Error&, const SafetyEnable&) > callback, uint32_t deviceId = 0);
166
+ std::future<SafetyEnable> GetSafetyEnable_async(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
167
+
168
+ SafetyStatus GetSafetyStatus(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
169
+ void GetSafetyStatus_callback(const Kinova::Api::Common::SafetyHandle& safetyhandle, std::function< void (const Error&, const SafetyStatus&) > callback, uint32_t deviceId = 0);
170
+ std::future<SafetyStatus> GetSafetyStatus_async(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
171
+
172
+ void ClearAllSafetyStatus(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
173
+ void ClearAllSafetyStatus_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
174
+ std::future<void> ClearAllSafetyStatus_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
175
+
176
+ void ClearSafetyStatus(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
177
+ void ClearSafetyStatus_callback(const Kinova::Api::Common::SafetyHandle& safetyhandle, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
178
+ std::future<void> ClearSafetyStatus_async(const Kinova::Api::Common::SafetyHandle& safetyhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
179
+
180
+ SafetyConfigurationList GetAllSafetyConfiguration(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
181
+ void GetAllSafetyConfiguration_callback(std::function< void (const Error&, const SafetyConfigurationList&) > callback, uint32_t deviceId = 0);
182
+ std::future<SafetyConfigurationList> GetAllSafetyConfiguration_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
183
+
184
+ SafetyInformationList GetAllSafetyInformation(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
185
+ void GetAllSafetyInformation_callback(std::function< void (const Error&, const SafetyInformationList&) > callback, uint32_t deviceId = 0);
186
+ std::future<SafetyInformationList> GetAllSafetyInformation_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
187
+
188
+ void ResetSafetyDefaults(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
189
+ void ResetSafetyDefaults_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
190
+ std::future<void> ResetSafetyDefaults_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
191
+
192
+ Kinova::Api::Common::NotificationHandle OnNotificationSafetyTopic(std::function< void (Kinova::Api::Common::SafetyNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
193
+
194
+ void ExecuteCalibration(const Calibration& calibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
195
+ void ExecuteCalibration_callback(const Calibration& calibration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
196
+ std::future<void> ExecuteCalibration_async(const Calibration& calibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
197
+
198
+ CalibrationResult GetCalibrationResult(const CalibrationElement& calibrationelement, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
199
+ void GetCalibrationResult_callback(const CalibrationElement& calibrationelement, std::function< void (const Error&, const CalibrationResult&) > callback, uint32_t deviceId = 0);
200
+ std::future<CalibrationResult> GetCalibrationResult_async(const CalibrationElement& calibrationelement, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
201
+
202
+ CalibrationResult StopCalibration(const Calibration& calibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
203
+ void StopCalibration_callback(const Calibration& calibration, std::function< void (const Error&, const CalibrationResult&) > callback, uint32_t deviceId = 0);
204
+ std::future<CalibrationResult> StopCalibration_async(const Calibration& calibration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
205
+
206
+ void SetCapSenseConfig(const CapSenseConfig& capsenseconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
207
+ void SetCapSenseConfig_callback(const CapSenseConfig& capsenseconfig, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
208
+ std::future<void> SetCapSenseConfig_async(const CapSenseConfig& capsenseconfig, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
209
+
210
+ CapSenseConfig GetCapSenseConfig(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
211
+ void GetCapSenseConfig_callback(std::function< void (const Error&, const CapSenseConfig&) > callback, uint32_t deviceId = 0);
212
+ std::future<CapSenseConfig> GetCapSenseConfig_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
213
+
214
+ CapSenseRegister ReadCapSenseRegister(const CapSenseRegister& capsenseregister, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
215
+ void ReadCapSenseRegister_callback(const CapSenseRegister& capsenseregister, std::function< void (const Error&, const CapSenseRegister&) > callback, uint32_t deviceId = 0);
216
+ std::future<CapSenseRegister> ReadCapSenseRegister_async(const CapSenseRegister& capsenseregister, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
217
+
218
+ void WriteCapSenseRegister(const CapSenseRegister& capsenseregister, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
219
+ void WriteCapSenseRegister_callback(const CapSenseRegister& capsenseregister, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
220
+ std::future<void> WriteCapSenseRegister_async(const CapSenseRegister& capsenseregister, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
221
+
222
+
223
+ private:
224
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
225
+ };
226
+ }
227
+ }
228
+ }
229
+
230
+ #endif
kortex_api/include/client_stubs/DeviceManagerClientRpc.h ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __DEVICEMANAGERCLIENT_H__
2
+ #define __DEVICEMANAGERCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/DeviceManager.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace DeviceManager
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidReadAllDevices = 0x170001,
41
+ };
42
+
43
+ class DeviceManagerClient
44
+ {
45
+ static const uint32_t m_serviceVersion = 1;
46
+ static const uint32_t m_serviceId = eIdDeviceManager;
47
+ NotificationHandler m_notificationHandler;
48
+
49
+ protected:
50
+ IRouterClient* const m_clientRouter;
51
+
52
+ public:
53
+ DeviceManagerClient(IRouterClient* clientRouter);
54
+ static uint32_t getUniqueFctId(uint16_t fctId);
55
+
56
+ DeviceHandles ReadAllDevices(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
57
+ void ReadAllDevices_callback(std::function< void (const Error&, const DeviceHandles&) > callback, uint32_t deviceId = 0);
58
+ std::future<DeviceHandles> ReadAllDevices_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
59
+
60
+
61
+ private:
62
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
63
+ };
64
+ }
65
+ }
66
+ }
67
+
68
+ #endif
kortex_api/include/client_stubs/GripperCyclicClientRpc.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __GRIPPERCYCLICCLIENT_H__
2
+ #define __GRIPPERCYCLICCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/GripperCyclic.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace GripperCyclic
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidRefresh = 0x110001,
41
+ eUidRefreshCommand = 0x110002,
42
+ eUidRefreshFeedback = 0x110003,
43
+ eUidRefreshCustomData = 0x110004,
44
+ };
45
+
46
+ class GripperCyclicClient
47
+ {
48
+ static const uint32_t m_serviceVersion = 1;
49
+ static const uint32_t m_serviceId = eIdGripperCyclic;
50
+ NotificationHandler m_notificationHandler;
51
+
52
+ protected:
53
+ IRouterClient* const m_clientRouter;
54
+
55
+ public:
56
+ GripperCyclicClient(IRouterClient* clientRouter);
57
+ static uint32_t getUniqueFctId(uint16_t fctId);
58
+
59
+ Feedback Refresh(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
60
+ void Refresh_callback(const Command& command, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
61
+ std::future<Feedback> Refresh_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
62
+
63
+ void RefreshCommand(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
64
+ void RefreshCommand_callback(const Command& command, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
65
+ std::future<void> RefreshCommand_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
66
+
67
+ Feedback RefreshFeedback(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void RefreshFeedback_callback(const MessageId& messageid, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
69
+ std::future<Feedback> RefreshFeedback_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ CustomData RefreshCustomData(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void RefreshCustomData_callback(const MessageId& messageid, std::function< void (const Error&, const CustomData&) > callback, uint32_t deviceId = 0);
73
+ std::future<CustomData> RefreshCustomData_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+
76
+ private:
77
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
78
+ };
79
+ }
80
+ }
81
+ }
82
+
83
+ #endif
kortex_api/include/client_stubs/InterconnectConfigClientRpc.h ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __INTERCONNECTCONFIGCLIENT_H__
2
+ #define __INTERCONNECTCONFIGCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/InterconnectConfig.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace InterconnectConfig
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidGetUARTConfiguration = 0xe0001,
41
+ eUidSetUARTConfiguration = 0xe0002,
42
+ eUidGetEthernetConfiguration = 0xe0003,
43
+ eUidSetEthernetConfiguration = 0xe0004,
44
+ eUidGetGPIOConfiguration = 0xe0005,
45
+ eUidSetGPIOConfiguration = 0xe0006,
46
+ eUidGetGPIOState = 0xe0007,
47
+ eUidSetGPIOState = 0xe0008,
48
+ eUidGetI2CConfiguration = 0xe0009,
49
+ eUidSetI2CConfiguration = 0xe000a,
50
+ eUidI2CRead = 0xe000b,
51
+ eUidI2CReadRegister = 0xe000c,
52
+ eUidI2CWrite = 0xe000d,
53
+ eUidI2CWriteRegister = 0xe000e,
54
+ };
55
+
56
+ class InterconnectConfigClient
57
+ {
58
+ static const uint32_t m_serviceVersion = 1;
59
+ static const uint32_t m_serviceId = eIdInterconnectConfig;
60
+ NotificationHandler m_notificationHandler;
61
+
62
+ protected:
63
+ IRouterClient* const m_clientRouter;
64
+
65
+ public:
66
+ InterconnectConfigClient(IRouterClient* clientRouter);
67
+ static uint32_t getUniqueFctId(uint16_t fctId);
68
+
69
+ Kinova::Api::Common::UARTConfiguration GetUARTConfiguration(const Kinova::Api::Common::UARTDeviceIdentification& uartdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+ void GetUARTConfiguration_callback(const Kinova::Api::Common::UARTDeviceIdentification& uartdeviceidentification, std::function< void (const Error&, const Kinova::Api::Common::UARTConfiguration&) > callback, uint32_t deviceId = 0);
71
+ std::future<Kinova::Api::Common::UARTConfiguration> GetUARTConfiguration_async(const Kinova::Api::Common::UARTDeviceIdentification& uartdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+
73
+ void SetUARTConfiguration(const Kinova::Api::Common::UARTConfiguration& uartconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+ void SetUARTConfiguration_callback(const Kinova::Api::Common::UARTConfiguration& uartconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
75
+ std::future<void> SetUARTConfiguration_async(const Kinova::Api::Common::UARTConfiguration& uartconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
76
+
77
+ EthernetConfiguration GetEthernetConfiguration(const EthernetDeviceIdentification& ethernetdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
78
+ void GetEthernetConfiguration_callback(const EthernetDeviceIdentification& ethernetdeviceidentification, std::function< void (const Error&, const EthernetConfiguration&) > callback, uint32_t deviceId = 0);
79
+ std::future<EthernetConfiguration> GetEthernetConfiguration_async(const EthernetDeviceIdentification& ethernetdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
80
+
81
+ void SetEthernetConfiguration(const EthernetConfiguration& ethernetconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
82
+ void SetEthernetConfiguration_callback(const EthernetConfiguration& ethernetconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
83
+ std::future<void> SetEthernetConfiguration_async(const EthernetConfiguration& ethernetconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
84
+
85
+ GPIOConfiguration GetGPIOConfiguration(const GPIOIdentification& gpioidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
86
+ void GetGPIOConfiguration_callback(const GPIOIdentification& gpioidentification, std::function< void (const Error&, const GPIOConfiguration&) > callback, uint32_t deviceId = 0);
87
+ std::future<GPIOConfiguration> GetGPIOConfiguration_async(const GPIOIdentification& gpioidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
88
+
89
+ void SetGPIOConfiguration(const GPIOConfiguration& gpioconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
90
+ void SetGPIOConfiguration_callback(const GPIOConfiguration& gpioconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
91
+ std::future<void> SetGPIOConfiguration_async(const GPIOConfiguration& gpioconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
92
+
93
+ GPIOState GetGPIOState(const GPIOIdentification& gpioidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
94
+ void GetGPIOState_callback(const GPIOIdentification& gpioidentification, std::function< void (const Error&, const GPIOState&) > callback, uint32_t deviceId = 0);
95
+ std::future<GPIOState> GetGPIOState_async(const GPIOIdentification& gpioidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
96
+
97
+ void SetGPIOState(const GPIOState& gpiostate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
98
+ void SetGPIOState_callback(const GPIOState& gpiostate, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
99
+ std::future<void> SetGPIOState_async(const GPIOState& gpiostate, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
100
+
101
+ I2CConfiguration GetI2CConfiguration(const I2CDeviceIdentification& i2cdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
102
+ void GetI2CConfiguration_callback(const I2CDeviceIdentification& i2cdeviceidentification, std::function< void (const Error&, const I2CConfiguration&) > callback, uint32_t deviceId = 0);
103
+ std::future<I2CConfiguration> GetI2CConfiguration_async(const I2CDeviceIdentification& i2cdeviceidentification, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
104
+
105
+ void SetI2CConfiguration(const I2CConfiguration& i2cconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
106
+ void SetI2CConfiguration_callback(const I2CConfiguration& i2cconfiguration, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
107
+ std::future<void> SetI2CConfiguration_async(const I2CConfiguration& i2cconfiguration, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
108
+
109
+ I2CData I2CRead(const I2CReadParameter& i2creadparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
110
+ void I2CRead_callback(const I2CReadParameter& i2creadparameter, std::function< void (const Error&, const I2CData&) > callback, uint32_t deviceId = 0);
111
+ std::future<I2CData> I2CRead_async(const I2CReadParameter& i2creadparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
112
+
113
+ I2CData I2CReadRegister(const I2CReadRegisterParameter& i2creadregisterparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
114
+ void I2CReadRegister_callback(const I2CReadRegisterParameter& i2creadregisterparameter, std::function< void (const Error&, const I2CData&) > callback, uint32_t deviceId = 0);
115
+ std::future<I2CData> I2CReadRegister_async(const I2CReadRegisterParameter& i2creadregisterparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
116
+
117
+ void I2CWrite(const I2CWriteParameter& i2cwriteparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
118
+ void I2CWrite_callback(const I2CWriteParameter& i2cwriteparameter, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
119
+ std::future<void> I2CWrite_async(const I2CWriteParameter& i2cwriteparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
120
+
121
+ void I2CWriteRegister(const I2CWriteRegisterParameter& i2cwriteregisterparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
122
+ void I2CWriteRegister_callback(const I2CWriteRegisterParameter& i2cwriteregisterparameter, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
123
+ std::future<void> I2CWriteRegister_async(const I2CWriteRegisterParameter& i2cwriteregisterparameter, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
124
+
125
+
126
+ private:
127
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
128
+ };
129
+ }
130
+ }
131
+ }
132
+
133
+ #endif
kortex_api/include/client_stubs/InterconnectCyclicClientRpc.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __INTERCONNECTCYCLICCLIENT_H__
2
+ #define __INTERCONNECTCYCLICCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/InterconnectCyclic.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace InterconnectCyclic
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidRefresh = 0xf0001,
41
+ eUidRefreshCommand = 0xf0002,
42
+ eUidRefreshFeedback = 0xf0003,
43
+ eUidRefreshCustomData = 0xf0004,
44
+ };
45
+
46
+ class InterconnectCyclicClient
47
+ {
48
+ static const uint32_t m_serviceVersion = 1;
49
+ static const uint32_t m_serviceId = eIdInterconnectCyclic;
50
+ NotificationHandler m_notificationHandler;
51
+
52
+ protected:
53
+ IRouterClient* const m_clientRouter;
54
+
55
+ public:
56
+ InterconnectCyclicClient(IRouterClient* clientRouter);
57
+ static uint32_t getUniqueFctId(uint16_t fctId);
58
+
59
+ Feedback Refresh(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
60
+ void Refresh_callback(const Command& command, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
61
+ std::future<Feedback> Refresh_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
62
+
63
+ void RefreshCommand(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
64
+ void RefreshCommand_callback(const Command& command, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
65
+ std::future<void> RefreshCommand_async(const Command& command, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
66
+
67
+ Feedback RefreshFeedback(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void RefreshFeedback_callback(const MessageId& messageid, std::function< void (const Error&, const Feedback&) > callback, uint32_t deviceId = 0);
69
+ std::future<Feedback> RefreshFeedback_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ CustomData RefreshCustomData(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void RefreshCustomData_callback(const MessageId& messageid, std::function< void (const Error&, const CustomData&) > callback, uint32_t deviceId = 0);
73
+ std::future<CustomData> RefreshCustomData_async(const MessageId& messageid, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+
76
+ private:
77
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
78
+ };
79
+ }
80
+ }
81
+ }
82
+
83
+ #endif
kortex_api/include/client_stubs/SessionClientRpc.h ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __SESSIONCLIENT_H__
2
+ #define __SESSIONCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/Session.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace Session
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidCreateSession = 0x10001,
41
+ eUidCloseSession = 0x10002,
42
+ eUidKeepAlive = 0x10003,
43
+ eUidGetConnections = 0x10004,
44
+ };
45
+
46
+ class SessionClient
47
+ {
48
+ static const uint32_t m_serviceVersion = 1;
49
+ static const uint32_t m_serviceId = eIdSession;
50
+ NotificationHandler m_notificationHandler;
51
+
52
+ protected:
53
+ IRouterClient* const m_clientRouter;
54
+
55
+ public:
56
+ SessionClient(IRouterClient* clientRouter);
57
+ static uint32_t getUniqueFctId(uint16_t fctId);
58
+
59
+ void CreateSession(const CreateSessionInfo& createsessioninfo, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
60
+ void CreateSession_callback(const CreateSessionInfo& createsessioninfo, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
61
+ std::future<void> CreateSession_async(const CreateSessionInfo& createsessioninfo, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
62
+
63
+ void CloseSession(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
64
+ void CloseSession_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
65
+ std::future<void> CloseSession_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
66
+
67
+ void KeepAlive(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void KeepAlive_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
69
+ std::future<void> KeepAlive_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ ConnectionList GetConnections(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void GetConnections_callback(std::function< void (const Error&, const ConnectionList&) > callback, uint32_t deviceId = 0);
73
+ std::future<ConnectionList> GetConnections_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+
76
+ private:
77
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
78
+ };
79
+ }
80
+ }
81
+ }
82
+
83
+ #endif
kortex_api/include/client_stubs/TestClientRpc.h ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __TESTCLIENT_H__
2
+ #define __TESTCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/Test.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace Test
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidSetMockValidationStruct = 0xff00001,
41
+ eUidTestParamAndReturn = 0xff00002,
42
+ eUidTestParamOnly = 0xff00003,
43
+ eUidTestReturnOnly = 0xff00004,
44
+ eUidTestTimeout = 0xff00005,
45
+ eUidTestNotif = 0xff00006,
46
+ eUidTestNotifUnsubscribe = 0xff00007,
47
+ eUidTestAsync = 0xff00008,
48
+ eUidTestConcurrence = 0xff00009,
49
+ eUidTestTriggerNotif = 0xff0000a,
50
+ eUidTestNotImplemented = 0xff0000b,
51
+ eUidServerError = 0xff0000c,
52
+ eUidUnsubscribe = 0xff0001e,
53
+ eUidSomethingChangeTopic = 0xff0001f,
54
+ eUidTriggerSomethingChangeTopic = 0xff00020,
55
+ eUidWait = 0xff00021,
56
+ eUidThrow = 0xff00022,
57
+ eUidDisconnect = 0xff00023,
58
+ eUidForget = 0xff00024,
59
+ eUidNotImplemented = 0xff00025,
60
+ eUidDeprecated = 0xff00027,
61
+ eUidDeprecatedWithMessage = 0xff00028,
62
+ };
63
+
64
+ class TestClient
65
+ {
66
+ static const uint32_t m_serviceVersion = 1;
67
+ static const uint32_t m_serviceId = eIdTest;
68
+ NotificationHandler m_notificationHandler;
69
+
70
+ protected:
71
+ IRouterClient* const m_clientRouter;
72
+
73
+ public:
74
+ TestClient(IRouterClient* clientRouter);
75
+ static uint32_t getUniqueFctId(uint16_t fctId);
76
+
77
+ void SetMockValidationStruct(const validateStruct& validatestruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
78
+ void SetMockValidationStruct_callback(const validateStruct& validatestruct, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
79
+ std::future<void> SetMockValidationStruct_async(const validateStruct& validatestruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
80
+
81
+ RcvStruct TestParamAndReturn(const SendStruct& sendstruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
82
+ void TestParamAndReturn_callback(const SendStruct& sendstruct, std::function< void (const Error&, const RcvStruct&) > callback, uint32_t deviceId = 0);
83
+ std::future<RcvStruct> TestParamAndReturn_async(const SendStruct& sendstruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
84
+
85
+ void TestParamOnly(const SendStruct& sendstruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
86
+ void TestParamOnly_callback(const SendStruct& sendstruct, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
87
+ std::future<void> TestParamOnly_async(const SendStruct& sendstruct, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
88
+
89
+ RcvStruct TestReturnOnly(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
90
+ void TestReturnOnly_callback(std::function< void (const Error&, const RcvStruct&) > callback, uint32_t deviceId = 0);
91
+ std::future<RcvStruct> TestReturnOnly_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
92
+
93
+ void TestTimeout(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
94
+ void TestTimeout_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
95
+ std::future<void> TestTimeout_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
96
+
97
+ Kinova::Api::Common::NotificationHandle OnNotificationTestNotif(std::function< void (TestNotification) > callback, const NotifOption& notifoption, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
98
+
99
+ void TestNotifUnsubscribe(const Kinova::Api::Common::NotificationHandle& notificationhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
100
+
101
+ void TestAsync(const timeToResponse& timetoresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
102
+ void TestAsync_callback(const timeToResponse& timetoresponse, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
103
+ std::future<void> TestAsync_async(const timeToResponse& timetoresponse, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
104
+
105
+ void TestConcurrence(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
106
+ void TestConcurrence_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
107
+ std::future<void> TestConcurrence_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
108
+
109
+ void TestTriggerNotif(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
110
+ void TestTriggerNotif_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
111
+ std::future<void> TestTriggerNotif_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
112
+
113
+ void TestNotImplemented(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
114
+ void TestNotImplemented_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
115
+ std::future<void> TestNotImplemented_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
116
+
117
+ TestError ServerError(const TestError& testerror, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
118
+ void ServerError_callback(const TestError& testerror, std::function< void (const Error&, const TestError&) > callback, uint32_t deviceId = 0);
119
+ std::future<TestError> ServerError_async(const TestError& testerror, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
120
+
121
+ void Unsubscribe(const Kinova::Api::Common::NotificationHandle& notificationhandle, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
122
+
123
+ Kinova::Api::Common::NotificationHandle OnNotificationSomethingChangeTopic(std::function< void (SomethingChanged) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
124
+
125
+ void TriggerSomethingChangeTopic(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
126
+ void TriggerSomethingChangeTopic_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
127
+ std::future<void> TriggerSomethingChangeTopic_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
128
+
129
+ void Wait(const Delay& delay, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
130
+ void Wait_callback(const Delay& delay, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
131
+ std::future<void> Wait_async(const Delay& delay, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
132
+
133
+ void Throw(const Kinova::Api::Error& error, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
134
+ void Throw_callback(const Kinova::Api::Error& error, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
135
+ std::future<void> Throw_async(const Kinova::Api::Error& error, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
136
+
137
+ void Disconnect(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
138
+ void Disconnect_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
139
+ std::future<void> Disconnect_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
140
+
141
+ void Forget(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
142
+ void Forget_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
143
+ std::future<void> Forget_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
144
+
145
+ void NotImplemented(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
146
+ void NotImplemented_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
147
+ std::future<void> NotImplemented_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
148
+
149
+ DEPRECATED void Deprecated(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
150
+ DEPRECATED void Deprecated_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
151
+ DEPRECATED std::future<void> Deprecated_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
152
+
153
+ DEPRECATED_MSG("Purposely deprecated for test") void DeprecatedWithMessage(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
154
+ DEPRECATED_MSG("Purposely deprecated for test") void DeprecatedWithMessage_callback(std::function< void (const Error&) > callback, uint32_t deviceId = 0);
155
+ DEPRECATED_MSG("Purposely deprecated for test") std::future<void> DeprecatedWithMessage_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
156
+
157
+
158
+ private:
159
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
160
+ };
161
+ }
162
+ }
163
+ }
164
+
165
+ #endif
kortex_api/include/client_stubs/VisionConfigClientRpc.h ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __VISIONCONFIGCLIENT_H__
2
+ #define __VISIONCONFIGCLIENT_H__
3
+
4
+ #include <string>
5
+ #include <future>
6
+ #include <functional>
7
+ #include <exception>
8
+
9
+ #include "messages/Frame.pb.h"
10
+ #include "messages/VisionConfig.pb.h"
11
+
12
+ #include "common/Frame.h"
13
+ #include "client/IRouterClient.h"
14
+ #include "client/NotificationHandler.h"
15
+
16
+ #if __cplusplus >= 201402L
17
+ #define DEPRECATED [[ deprecated ]]
18
+ #define DEPRECATED_MSG(msg) [[ deprecated(msg) ]]
19
+ #elif defined(__GNUC__)
20
+ #define DEPRECATED __attribute__ ((deprecated))
21
+ #define DEPRECATED_MSG(msg) __attribute__ ((deprecated(msg)))
22
+ #elif defined(_MSC_VER)
23
+ #define DEPRECATED __declspec(deprecated)
24
+ #define DEPRECATED_MSG(msg) __declspec(deprecated(msg))
25
+ #else
26
+ #define DEPRECATED
27
+ #define DEPRECATED_MSG
28
+ #endif
29
+ namespace Kinova
30
+ {
31
+ namespace Api
32
+ {
33
+ namespace VisionConfig
34
+ {
35
+ // todogr move somewhere else
36
+ const std::string none = "";
37
+
38
+ enum FunctionUids
39
+ {
40
+ eUidSetSensorSettings = 0x50001,
41
+ eUidGetSensorSettings = 0x50002,
42
+ eUidGetOptionValue = 0x50003,
43
+ eUidSetOptionValue = 0x50004,
44
+ eUidGetOptionInformation = 0x50005,
45
+ eUidVisionTopic = 0x50006,
46
+ eUidDoSensorFocusAction = 0x50007,
47
+ eUidGetIntrinsicParameters = 0x50008,
48
+ eUidGetIntrinsicParametersProfile = 0x50009,
49
+ eUidSetIntrinsicParameters = 0x5000a,
50
+ eUidGetExtrinsicParameters = 0x5000b,
51
+ eUidSetExtrinsicParameters = 0x5000c,
52
+ };
53
+
54
+ class VisionConfigClient
55
+ {
56
+ static const uint32_t m_serviceVersion = 1;
57
+ static const uint32_t m_serviceId = eIdVisionConfig;
58
+ NotificationHandler m_notificationHandler;
59
+
60
+ protected:
61
+ IRouterClient* const m_clientRouter;
62
+
63
+ public:
64
+ VisionConfigClient(IRouterClient* clientRouter);
65
+ static uint32_t getUniqueFctId(uint16_t fctId);
66
+
67
+ void SetSensorSettings(const SensorSettings& sensorsettings, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
68
+ void SetSensorSettings_callback(const SensorSettings& sensorsettings, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
69
+ std::future<void> SetSensorSettings_async(const SensorSettings& sensorsettings, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
70
+
71
+ SensorSettings GetSensorSettings(const SensorIdentifier& sensoridentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
72
+ void GetSensorSettings_callback(const SensorIdentifier& sensoridentifier, std::function< void (const Error&, const SensorSettings&) > callback, uint32_t deviceId = 0);
73
+ std::future<SensorSettings> GetSensorSettings_async(const SensorIdentifier& sensoridentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
74
+
75
+ OptionValue GetOptionValue(const OptionIdentifier& optionidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
76
+ void GetOptionValue_callback(const OptionIdentifier& optionidentifier, std::function< void (const Error&, const OptionValue&) > callback, uint32_t deviceId = 0);
77
+ std::future<OptionValue> GetOptionValue_async(const OptionIdentifier& optionidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
78
+
79
+ void SetOptionValue(const OptionValue& optionvalue, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
80
+ void SetOptionValue_callback(const OptionValue& optionvalue, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
81
+ std::future<void> SetOptionValue_async(const OptionValue& optionvalue, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
82
+
83
+ OptionInformation GetOptionInformation(const OptionIdentifier& optionidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
84
+ void GetOptionInformation_callback(const OptionIdentifier& optionidentifier, std::function< void (const Error&, const OptionInformation&) > callback, uint32_t deviceId = 0);
85
+ std::future<OptionInformation> GetOptionInformation_async(const OptionIdentifier& optionidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
86
+
87
+ Kinova::Api::Common::NotificationHandle OnNotificationVisionTopic(std::function< void (VisionNotification) > callback, const Kinova::Api::Common::NotificationOptions& notificationoptions, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
88
+
89
+ void DoSensorFocusAction(const SensorFocusAction& sensorfocusaction, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
90
+ void DoSensorFocusAction_callback(const SensorFocusAction& sensorfocusaction, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
91
+ std::future<void> DoSensorFocusAction_async(const SensorFocusAction& sensorfocusaction, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
92
+
93
+ IntrinsicParameters GetIntrinsicParameters(const SensorIdentifier& sensoridentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
94
+ void GetIntrinsicParameters_callback(const SensorIdentifier& sensoridentifier, std::function< void (const Error&, const IntrinsicParameters&) > callback, uint32_t deviceId = 0);
95
+ std::future<IntrinsicParameters> GetIntrinsicParameters_async(const SensorIdentifier& sensoridentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
96
+
97
+ IntrinsicParameters GetIntrinsicParametersProfile(const IntrinsicProfileIdentifier& intrinsicprofileidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
98
+ void GetIntrinsicParametersProfile_callback(const IntrinsicProfileIdentifier& intrinsicprofileidentifier, std::function< void (const Error&, const IntrinsicParameters&) > callback, uint32_t deviceId = 0);
99
+ std::future<IntrinsicParameters> GetIntrinsicParametersProfile_async(const IntrinsicProfileIdentifier& intrinsicprofileidentifier, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
100
+
101
+ void SetIntrinsicParameters(const IntrinsicParameters& intrinsicparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
102
+ void SetIntrinsicParameters_callback(const IntrinsicParameters& intrinsicparameters, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
103
+ std::future<void> SetIntrinsicParameters_async(const IntrinsicParameters& intrinsicparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
104
+
105
+ ExtrinsicParameters GetExtrinsicParameters(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
106
+ void GetExtrinsicParameters_callback(std::function< void (const Error&, const ExtrinsicParameters&) > callback, uint32_t deviceId = 0);
107
+ std::future<ExtrinsicParameters> GetExtrinsicParameters_async(uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
108
+
109
+ void SetExtrinsicParameters(const ExtrinsicParameters& extrinsicparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
110
+ void SetExtrinsicParameters_callback(const ExtrinsicParameters& extrinsicparameters, std::function< void (const Error&) > callback, uint32_t deviceId = 0);
111
+ std::future<void> SetExtrinsicParameters_async(const ExtrinsicParameters& extrinsicparameters, uint32_t deviceId = 0, const RouterClientSendOptions& options = {false, 0, 3000});
112
+
113
+
114
+ private:
115
+ void messageHeaderValidation(const Frame& msgFrame){ /* todogr ... */ }
116
+ };
117
+ }
118
+ }
119
+ }
120
+
121
+ #endif
kortex_api/include/common/Frame.h ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef __FRAME_H__
2
+ #define __FRAME_H__
3
+
4
+ #include "messages/Frame.pb.h"
5
+
6
+ #define ACTUATORCONFIG_CLIENT_PROTO_AVAILABLE
7
+ #define ACTUATORCYCLIC_CLIENT_PROTO_AVAILABLE
8
+ #define BASE_CLIENT_PROTO_AVAILABLE
9
+ #define BASECYCLIC_CLIENT_PROTO_AVAILABLE
10
+ #define COMMON_CLIENT_PROTO_AVAILABLE
11
+ #define CONTROLCONFIG_CLIENT_PROTO_AVAILABLE
12
+ #define DEVICECONFIG_CLIENT_PROTO_AVAILABLE
13
+ #define DEVICEMANAGER_CLIENT_PROTO_AVAILABLE
14
+ #define ERRORS_CLIENT_PROTO_AVAILABLE
15
+ #define FRAME_CLIENT_PROTO_AVAILABLE
16
+ #define GRIPPERCONFIG_CLIENT_PROTO_AVAILABLE
17
+ #define GRIPPERCYCLIC_CLIENT_PROTO_AVAILABLE
18
+ #define GRIPPERCYCLICMESSAGE_CLIENT_PROTO_AVAILABLE
19
+ #define INTERCONNECTCONFIG_CLIENT_PROTO_AVAILABLE
20
+ #define INTERCONNECTCYCLIC_CLIENT_PROTO_AVAILABLE
21
+ #define INTERCONNECTCYCLICMESSAGE_CLIENT_PROTO_AVAILABLE
22
+ #define PRODUCTCONFIGURATION_CLIENT_PROTO_AVAILABLE
23
+ #define SESSION_CLIENT_PROTO_AVAILABLE
24
+ #define TEST_CLIENT_PROTO_AVAILABLE
25
+ #define VISIONCONFIG_CLIENT_PROTO_AVAILABLE
26
+
27
+ #define ACTUATORCONFIG_SERVER_PROTO_AVAILABLE
28
+ #define ACTUATORCYCLIC_SERVER_PROTO_AVAILABLE
29
+ #define BASE_SERVER_PROTO_AVAILABLE
30
+ #define BASECYCLIC_SERVER_PROTO_AVAILABLE
31
+ #define COMMON_SERVER_PROTO_AVAILABLE
32
+ #define CONTROLCONFIG_SERVER_PROTO_AVAILABLE
33
+ #define DEVICECONFIG_SERVER_PROTO_AVAILABLE
34
+ #define DEVICEMANAGER_SERVER_PROTO_AVAILABLE
35
+ #define ERRORS_SERVER_PROTO_AVAILABLE
36
+ #define FRAME_SERVER_PROTO_AVAILABLE
37
+ #define GRIPPERCONFIG_SERVER_PROTO_AVAILABLE
38
+ #define GRIPPERCYCLIC_SERVER_PROTO_AVAILABLE
39
+ #define GRIPPERCYCLICMESSAGE_SERVER_PROTO_AVAILABLE
40
+ #define INTERCONNECTCONFIG_SERVER_PROTO_AVAILABLE
41
+ #define INTERCONNECTCYCLIC_SERVER_PROTO_AVAILABLE
42
+ #define INTERCONNECTCYCLICMESSAGE_SERVER_PROTO_AVAILABLE
43
+ #define PRODUCTCONFIGURATION_SERVER_PROTO_AVAILABLE
44
+ #define SESSION_SERVER_PROTO_AVAILABLE
45
+ #define TEST_SERVER_PROTO_AVAILABLE
46
+ #define VISIONCONFIG_SERVER_PROTO_AVAILABLE
47
+
48
+ namespace Kinova
49
+ {
50
+ namespace Api
51
+ {
52
+ enum ServiceIds
53
+ {
54
+ eIdActuatorConfig = 10,
55
+ eIdActuatorCyclic = 11,
56
+ eIdBase = 2,
57
+ eIdBaseCyclic = 3,
58
+ eIdControlConfig = 16,
59
+ eIdDeviceConfig = 9,
60
+ eIdDeviceManager = 23,
61
+ eIdGripperCyclic = 17,
62
+ eIdInterconnectConfig = 14,
63
+ eIdInterconnectCyclic = 15,
64
+ eIdSession = 1,
65
+ eIdTest = 4080,
66
+ eIdVisionConfig = 5,
67
+ };
68
+ }
69
+ }
70
+
71
+ #endif
kortex_api/include/common/HeaderInfo.h ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef KINOVAUTILAPI_H
2
+ #define KINOVAUTILAPI_H
3
+
4
+ #include "messages/Frame.pb.h"
5
+
6
+ namespace Kinova
7
+ {
8
+ namespace Api
9
+ {
10
+
11
+ typedef union
12
+ {
13
+ uint32_t frame_info;
14
+ struct
15
+ {
16
+ uint32_t errorSubCode: 12;
17
+ uint32_t errorCode: 4;
18
+ uint32_t deviceId: 8;
19
+
20
+ uint32_t frameType: 4;
21
+ uint32_t headerVersion : 4;
22
+ };
23
+ } FrameInfo;
24
+
25
+ typedef union
26
+ {
27
+ uint32_t message_info;
28
+ struct
29
+ {
30
+ uint32_t messageId: 16;
31
+ uint32_t sessionId: 16;
32
+ };
33
+ } MessageInfo;
34
+
35
+ typedef union
36
+ {
37
+ uint32_t service_info;
38
+ struct
39
+ {
40
+ uint32_t functionId: 16;
41
+ uint32_t serviceId: 12;
42
+ uint32_t serviceVersion: 4;
43
+ };
44
+
45
+ struct
46
+ {
47
+ uint32_t functionUid: 28;
48
+ };
49
+ } ServiceInfo;
50
+
51
+ typedef union
52
+ {
53
+ uint32_t payload_info;
54
+ struct
55
+ {
56
+ uint32_t payloadLength: 24;
57
+ uint32_t reserved: 8;
58
+ };
59
+ } PayloadInfo;
60
+
61
+ class HeaderInfo
62
+ {
63
+ public:
64
+ HeaderInfo();
65
+ HeaderInfo(const Header& headerProto);
66
+
67
+ Header createHeader();
68
+
69
+ void fillHeader(Header* pHeader);
70
+
71
+ FrameInfo m_frameInfo;
72
+ MessageInfo m_messageInfo;
73
+ ServiceInfo m_serviceInfo;
74
+ PayloadInfo m_payloadInfo;
75
+ };
76
+
77
+
78
+ } // namespace Api
79
+ } // namespace Kinova
80
+
81
+ #endif
kortex_api/include/common/KBasicException.h ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef KINOVAEXCEPTION_H
2
+ #define KINOVAEXCEPTION_H
3
+
4
+ #include <string>
5
+ #include <sstream>
6
+ #include <exception>
7
+
8
+ namespace Kinova
9
+ {
10
+ namespace Api
11
+ {
12
+
13
+ class KBasicException : public std::runtime_error
14
+ {
15
+ public:
16
+ KBasicException(const std::string& msgStr);
17
+ KBasicException(const KBasicException &other);
18
+
19
+ virtual const char* what() const throw() override;
20
+ virtual std::string toString();
21
+ };
22
+
23
+ // todogr add a new kinova exception: KProgException
24
+ typedef KBasicException KProgException;
25
+
26
+ } // namespace Api
27
+ } // namespace Kinova
28
+
29
+ #endif
kortex_api/include/common/KDetailedException.h ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef KINOVASERVEREXCEPTION_H
2
+ #define KINOVASERVEREXCEPTION_H
3
+
4
+ #include <string>
5
+ #include <sstream>
6
+
7
+ #include "KBasicException.h"
8
+
9
+ #include <messages/Frame.pb.h>
10
+ #include "KError.h"
11
+
12
+ #include "HeaderInfo.h"
13
+
14
+ namespace Kinova
15
+ {
16
+ namespace Api
17
+ {
18
+ class KDetailedException : public KBasicException
19
+ {
20
+ public:
21
+ KDetailedException(const KError& error);
22
+ KDetailedException(const KDetailedException &other);
23
+
24
+ virtual const char* what() const throw() override;
25
+ virtual std::string toString() override;
26
+
27
+ KError& getErrorInfo() { return m_error; }
28
+
29
+ private:
30
+ void init(const HeaderInfo& header, const Error& error);
31
+
32
+ KError m_error;
33
+ std::string m_errorStr;
34
+ };
35
+
36
+ } // namespace Api
37
+ } // namespace Kinova
38
+
39
+ #endif
kortex_api/include/common/KError.h ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef KINOVAERROR_H
2
+ #define KINOVAERROR_H
3
+
4
+ #include <string>
5
+ #include <sstream>
6
+
7
+ #include "messages/Frame.pb.h"
8
+
9
+ #include "HeaderInfo.h"
10
+
11
+ namespace Kinova
12
+ {
13
+ namespace Api
14
+ {
15
+ class KError
16
+ {
17
+ public:
18
+ KError(Kinova::Api::ErrorCodes errorCode, Kinova::Api::SubErrorCodes errorSubCode, std::string errorDescription);
19
+ KError(const HeaderInfo& header, Kinova::Api::ErrorCodes errorCode, Kinova::Api::SubErrorCodes errorSubCode, std::string errorDescription);
20
+ KError(const Error& error);
21
+ KError(const HeaderInfo& header, const Error& error);
22
+
23
+ static Error fillError(Kinova::Api::ErrorCodes errorCode, Kinova::Api::SubErrorCodes errorSubCode, std::string errorDescription);
24
+
25
+ std::string toString() const;
26
+
27
+ bool isThereHeaderInfo();
28
+ HeaderInfo getHeader();
29
+ Error getError();
30
+
31
+ KError& operator =(const KError& other) = default;
32
+
33
+ private:
34
+ bool m_isThereHeaderInfo;
35
+ HeaderInfo m_header;
36
+ Error m_error;
37
+ };
38
+
39
+ } // namespace Api
40
+ } // namespace Kinova
41
+
42
+ #endif
kortex_api/include/common/KinovaTcpUtilities.h ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef CPPAPI_KINOVATCPUTILITIES_H
2
+ #define CPPAPI_KINOVATCPUTILITIES_H
3
+
4
+ #include <string>
5
+
6
+ class KinovaTcpUtilities {
7
+
8
+ public:
9
+ KinovaTcpUtilities();
10
+ ~KinovaTcpUtilities();
11
+
12
+ uint32_t ParseBufferHeader(uint8_t* buff);
13
+ void PrependHeader(uint8_t *in_buf, uint32_t payload_length);
14
+ void PrintBuffer(uint8_t* in_buf, uint32_t len);
15
+ char* ResizeBuffer(char *buf, size_t data_size_to_copy, size_t new_size, uint32_t& buffer_size);
16
+ uint8_t* ResizeBuffer(uint8_t *buf, size_t data_size_to_copy, size_t new_size, uint32_t& buffer_size);
17
+
18
+ const std::string KINOVA_MAGIC_STRING = { "\07xEtRoK\07" };
19
+ const size_t KINOVA_HEADER_SIZE { (KINOVA_MAGIC_STRING.length() + sizeof(uint32_t) )};
20
+ };
21
+
22
+
23
+ #endif //CPPAPI_KINOVATCPUTILITIES_H
kortex_api/include/common/TransportBridgeDummy.h ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* ***************************************************************************
2
+ * Kinova inc.
3
+ * Project :
4
+ *
5
+ * Copyright (c) 2006-2018 Kinova Incorporated. All rights reserved.
6
+ ****************************************************************************/
7
+
8
+ #ifndef _TRANSPORT_BRIDGE_DUMMY_H_
9
+ #define _TRANSPORT_BRIDGE_DUMMY_H_
10
+
11
+ #include <string>
12
+ #include <functional>
13
+
14
+ #include "client/ITransportClient.h"
15
+ #include "ITransportServer.h"
16
+
17
+ namespace Kinova
18
+ {
19
+ using namespace Api;
20
+
21
+ namespace Helper
22
+ {
23
+ class TransportBridgeDummy
24
+ {
25
+ class TransportBridgeClientDummy : public ITransportClient
26
+ {
27
+ TransportBridgeDummy *m_transportBridgeDummy;
28
+
29
+ public:
30
+ TransportBridgeClientDummy(TransportBridgeDummy *transportBridgeDummy)
31
+ {
32
+ m_transportBridgeDummy = transportBridgeDummy;
33
+ }
34
+
35
+ virtual ~TransportBridgeClientDummy();
36
+
37
+ virtual bool connect(std::string host = "127.0.0.1", uint32_t port = kApiPort) override { return true; }
38
+
39
+ virtual void disconnect() override {}
40
+
41
+ virtual void send(const char *txBuffer, uint32_t txSize) override
42
+ {
43
+ m_transportBridgeDummy->m_onMessageCallbackServer(m_transportBridgeDummy->m_connectionHandle, (uint8_t *) txBuffer, (int) txSize);
44
+ }
45
+
46
+ virtual void onMessage(std::function<void(const char *, uint32_t)> callbackClient) override
47
+ {
48
+ m_transportBridgeDummy->m_onMessageCallbackClient = callbackClient;
49
+ }
50
+
51
+ virtual char *getTxBuffer() override { return m_transportBridgeDummy->m_bufferClientToServer; }
52
+
53
+ virtual size_t getMaxTxBufferSize() override { return m_transportBridgeDummy->m_maxBufferSizeClientToServer; }
54
+ };
55
+
56
+ class TransportBridgeServerDummy : public ITransportServer
57
+ {
58
+ TransportBridgeDummy *m_transportBridgeDummy;
59
+
60
+ public:
61
+ TransportBridgeServerDummy(TransportBridgeDummy *transportBridgeDummy)
62
+ {
63
+ m_transportBridgeDummy = transportBridgeDummy;
64
+ }
65
+
66
+ virtual ~TransportBridgeServerDummy() override {}
67
+
68
+ virtual void Process() override {}
69
+
70
+
71
+ virtual bool Send(const ClientConnectionHandle &connectionHandle, char *TXBuffer, int txLen) override
72
+ {
73
+ m_transportBridgeDummy->m_onMessageCallbackClient((const char *) TXBuffer, (uint32_t) txLen);
74
+ }
75
+
76
+ virtual void OnMessage(std::function<void(const ClientConnectionHandle &, uint8_t *, int)> callbackServer) override
77
+ {
78
+ m_transportBridgeDummy->m_onMessageCallbackServer = callbackServer;
79
+ }
80
+
81
+ virtual char *GetTxBuffer(size_t *pTxLen) override
82
+ {
83
+ *pTxLen = m_transportBridgeDummy->m_maxBufferSizeServerToClient;
84
+
85
+ return m_transportBridgeDummy->m_bufferServerToClient;
86
+ }
87
+ };
88
+
89
+ ITransportServer *m_server;
90
+ ITransportClient *m_client;
91
+
92
+ public:
93
+ static constexpr uint32_t kMaxBufferSizeServerToClient = 65507;
94
+ static constexpr uint32_t kMaxBufferSizeClientToServer = 65507;
95
+
96
+ const uint32_t m_maxBufferSizeServerToClient = kMaxBufferSizeServerToClient;
97
+ const uint32_t m_maxBufferSizeClientToServer = kMaxBufferSizeClientToServer;
98
+
99
+ char m_bufferServerToClient[kMaxBufferSizeServerToClient];
100
+ char m_bufferClientToServer[kMaxBufferSizeClientToServer];
101
+
102
+ std::function<void(const char *, uint32_t)> m_onMessageCallbackClient;
103
+ std::function<void(const ClientConnectionHandle &, uint8_t *, int)> m_onMessageCallbackServer;
104
+
105
+ struct ClientConnectionHandle m_connectionHandle;
106
+
107
+ TransportBridgeDummy()
108
+ {
109
+ m_connectionHandle.clientId = 1;
110
+ auto m_server = new TransportBridgeServerDummy(this);
111
+ auto m_client = new TransportBridgeClientDummy(this);
112
+ }
113
+
114
+ virtual ~TransportBridgeDummy()
115
+ {
116
+ delete m_server;
117
+ delete m_client;
118
+ }
119
+
120
+ ITransportServer *getServerTransport() { return m_server; }
121
+
122
+ ITransportClient *getClientTransport() { return m_client; }
123
+ };
124
+
125
+ }
126
+ }
127
+ #endif
kortex_api/include/common/WindowsNetworking.h ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef WINDOWS_NETWORKING_H
2
+ #define WINDOWS_NETWORKING_H
3
+
4
+ #ifdef _WIN32
5
+ #define _OS_WINDOWS
6
+
7
+ // Include Windows networking headers before standard C++ headers
8
+ #include <winsock2.h>
9
+ #include <ws2tcpip.h>
10
+ #include <windows.h>
11
+
12
+ // Define missing types that are used in TransportClientTcp.h
13
+ typedef int socklen_t;
14
+
15
+ // Ensure proper Windows networking initialization
16
+ #pragma comment(lib, "ws2_32.lib")
17
+ #pragma comment(lib, "iphlpapi.lib")
18
+
19
+ #endif // _WIN32
20
+
21
+ #endif // WINDOWS_NETWORKING_H
kortex_api/include/common/version.h ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifndef VERSION_H
2
+ #define VERSION_H
3
+
4
+ #define PROJECT_NAME "KortexApiCpp"
5
+ #define PROJECT_VER "2.7.0"
6
+ #define PROJECT_VER_MAJOR "2"
7
+ #define PROJECT_VER_MINOR "7"
8
+ #define PTOJECT_VER_PATCH "0"
9
+
10
+ #endif //VERSION_H
kortex_api/include/google/protobuf/any.h ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_ANY_H__
32
+ #define GOOGLE_PROTOBUF_ANY_H__
33
+
34
+ #include <string>
35
+
36
+ #include <google/protobuf/stubs/common.h>
37
+ #include <google/protobuf/descriptor.h>
38
+ #include <google/protobuf/message.h>
39
+ #include <google/protobuf/arenastring.h>
40
+
41
+ namespace google {
42
+ namespace protobuf {
43
+ namespace internal {
44
+
45
+ // Helper class used to implement google::protobuf::Any.
46
+ class LIBPROTOBUF_EXPORT AnyMetadata {
47
+ typedef ArenaStringPtr UrlType;
48
+ typedef ArenaStringPtr ValueType;
49
+ public:
50
+ // AnyMetadata does not take ownership of "type_url" and "value".
51
+ AnyMetadata(UrlType* type_url, ValueType* value);
52
+
53
+ // Packs a message using the default type URL prefix: "type.googleapis.com".
54
+ // The resulted type URL will be "type.googleapis.com/<message_full_name>".
55
+ void PackFrom(const Message& message);
56
+ // Packs a message using the given type URL prefix. The type URL will be
57
+ // constructed by concatenating the message type's full name to the prefix
58
+ // with an optional "/" separator if the prefix doesn't already end up "/".
59
+ // For example, both PackFrom(message, "type.googleapis.com") and
60
+ // PackFrom(message, "type.googleapis.com/") yield the same result type
61
+ // URL: "type.googleapis.com/<message_full_name>".
62
+ void PackFrom(const Message& message, const string& type_url_prefix);
63
+
64
+ // Unpacks the payload into the given message. Returns false if the message's
65
+ // type doesn't match the type specified in the type URL (i.e., the full
66
+ // name after the last "/" of the type URL doesn't match the message's actual
67
+ // full name) or parsing the payload has failed.
68
+ bool UnpackTo(Message* message) const;
69
+
70
+ // Checks whether the type specified in the type URL matches the given type.
71
+ // A type is consdiered matching if its full name matches the full name after
72
+ // the last "/" in the type URL.
73
+ template<typename T>
74
+ bool Is() const {
75
+ return InternalIs(T::default_instance().GetDescriptor());
76
+ }
77
+
78
+ private:
79
+ bool InternalIs(const Descriptor* message) const;
80
+
81
+ UrlType* type_url_;
82
+ ValueType* value_;
83
+
84
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(AnyMetadata);
85
+ };
86
+
87
+ extern const char kAnyFullTypeName[]; // "google.protobuf.Any".
88
+ extern const char kTypeGoogleApisComPrefix[]; // "type.googleapis.com/".
89
+ extern const char kTypeGoogleProdComPrefix[]; // "type.googleprod.com/".
90
+
91
+ // Get the proto type name from Any::type_url value. For example, passing
92
+ // "type.googleapis.com/rpc.QueryOrigin" will return "rpc.QueryOrigin" in
93
+ // *full_type_name. Returns false if the type_url does not have a "/"
94
+ // in the type url separating the full type name.
95
+ bool ParseAnyTypeUrl(const string& type_url, string* full_type_name);
96
+
97
+ // See if message is of type google.protobuf.Any, if so, return the descriptors
98
+ // for "type_url" and "value" fields.
99
+ bool GetAnyFieldDescriptors(const Message& message,
100
+ const FieldDescriptor** type_url_field,
101
+ const FieldDescriptor** value_field);
102
+
103
+ } // namespace internal
104
+ } // namespace protobuf
105
+
106
+ } // namespace google
107
+ #endif // GOOGLE_PROTOBUF_ANY_H__
kortex_api/include/google/protobuf/any.pb.h ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ // source: google/protobuf/any.proto
3
+
4
+ #ifndef PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
5
+ #define PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
6
+
7
+ #include <string>
8
+
9
+ #include <google/protobuf/stubs/common.h>
10
+
11
+ #if GOOGLE_PROTOBUF_VERSION < 3005000
12
+ #error This file was generated by a newer version of protoc which is
13
+ #error incompatible with your Protocol Buffer headers. Please update
14
+ #error your headers.
15
+ #endif
16
+ #if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
17
+ #error This file was generated by an older version of protoc which is
18
+ #error incompatible with your Protocol Buffer headers. Please
19
+ #error regenerate this file with a newer version of protoc.
20
+ #endif
21
+
22
+ #include <google/protobuf/io/coded_stream.h>
23
+ #include <google/protobuf/arena.h>
24
+ #include <google/protobuf/arenastring.h>
25
+ #include <google/protobuf/generated_message_table_driven.h>
26
+ #include <google/protobuf/generated_message_util.h>
27
+ #include <google/protobuf/metadata.h>
28
+ #include <google/protobuf/message.h>
29
+ #include <google/protobuf/repeated_field.h> // IWYU pragma: export
30
+ #include <google/protobuf/extension_set.h> // IWYU pragma: export
31
+ #include <google/protobuf/unknown_field_set.h>
32
+ #include <google/protobuf/any.h>
33
+ // @@protoc_insertion_point(includes)
34
+
35
+ namespace protobuf_google_2fprotobuf_2fany_2eproto {
36
+ // Internal implementation detail -- do not use these members.
37
+ struct LIBPROTOBUF_EXPORT TableStruct {
38
+ static const ::google::protobuf::internal::ParseTableField entries[];
39
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
40
+ static const ::google::protobuf::internal::ParseTable schema[1];
41
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
42
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
43
+ static const ::google::protobuf::uint32 offsets[];
44
+ };
45
+ void LIBPROTOBUF_EXPORT AddDescriptors();
46
+ void LIBPROTOBUF_EXPORT InitDefaultsAnyImpl();
47
+ void LIBPROTOBUF_EXPORT InitDefaultsAny();
48
+ inline void LIBPROTOBUF_EXPORT InitDefaults() {
49
+ InitDefaultsAny();
50
+ }
51
+ } // namespace protobuf_google_2fprotobuf_2fany_2eproto
52
+ namespace google {
53
+ namespace protobuf {
54
+ class Any;
55
+ class AnyDefaultTypeInternal;
56
+ LIBPROTOBUF_EXPORT extern AnyDefaultTypeInternal _Any_default_instance_;
57
+ } // namespace protobuf
58
+ } // namespace google
59
+ namespace google {
60
+ namespace protobuf {
61
+
62
+ // ===================================================================
63
+
64
+ class LIBPROTOBUF_EXPORT Any : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Any) */ {
65
+ public:
66
+ Any();
67
+ virtual ~Any();
68
+
69
+ Any(const Any& from);
70
+
71
+ inline Any& operator=(const Any& from) {
72
+ CopyFrom(from);
73
+ return *this;
74
+ }
75
+ #if LANG_CXX11
76
+ Any(Any&& from) noexcept
77
+ : Any() {
78
+ *this = ::std::move(from);
79
+ }
80
+
81
+ inline Any& operator=(Any&& from) noexcept {
82
+ if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
83
+ if (this != &from) InternalSwap(&from);
84
+ } else {
85
+ CopyFrom(from);
86
+ }
87
+ return *this;
88
+ }
89
+ #endif
90
+ static const ::google::protobuf::Descriptor* descriptor();
91
+ static const Any& default_instance();
92
+
93
+ static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
94
+ static inline const Any* internal_default_instance() {
95
+ return reinterpret_cast<const Any*>(
96
+ &_Any_default_instance_);
97
+ }
98
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
99
+ 0;
100
+
101
+ // implements Any -----------------------------------------------
102
+
103
+ void PackFrom(const ::google::protobuf::Message& message);
104
+ void PackFrom(const ::google::protobuf::Message& message,
105
+ const ::std::string& type_url_prefix);
106
+ bool UnpackTo(::google::protobuf::Message* message) const;
107
+ template<typename T> bool Is() const {
108
+ return _any_metadata_.Is<T>();
109
+ }
110
+
111
+ void Swap(Any* other);
112
+ friend void swap(Any& a, Any& b) {
113
+ a.Swap(&b);
114
+ }
115
+
116
+ // implements Message ----------------------------------------------
117
+
118
+ inline Any* New() const PROTOBUF_FINAL { return New(NULL); }
119
+
120
+ Any* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
121
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
122
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
123
+ void CopyFrom(const Any& from);
124
+ void MergeFrom(const Any& from);
125
+ void Clear() PROTOBUF_FINAL;
126
+ bool IsInitialized() const PROTOBUF_FINAL;
127
+
128
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
129
+ bool MergePartialFromCodedStream(
130
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
131
+ void SerializeWithCachedSizes(
132
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
133
+ ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
134
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
135
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
136
+ private:
137
+ void SharedCtor();
138
+ void SharedDtor();
139
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
140
+ void InternalSwap(Any* other);
141
+ private:
142
+ inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
143
+ return NULL;
144
+ }
145
+ inline void* MaybeArenaPtr() const {
146
+ return NULL;
147
+ }
148
+ public:
149
+
150
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
151
+
152
+ // nested types ----------------------------------------------------
153
+
154
+ // accessors -------------------------------------------------------
155
+
156
+ // string type_url = 1;
157
+ void clear_type_url();
158
+ static const int kTypeUrlFieldNumber = 1;
159
+ const ::std::string& type_url() const;
160
+ void set_type_url(const ::std::string& value);
161
+ #if LANG_CXX11
162
+ void set_type_url(::std::string&& value);
163
+ #endif
164
+ void set_type_url(const char* value);
165
+ void set_type_url(const char* value, size_t size);
166
+ ::std::string* mutable_type_url();
167
+ ::std::string* release_type_url();
168
+ void set_allocated_type_url(::std::string* type_url);
169
+
170
+ // bytes value = 2;
171
+ void clear_value();
172
+ static const int kValueFieldNumber = 2;
173
+ const ::std::string& value() const;
174
+ void set_value(const ::std::string& value);
175
+ #if LANG_CXX11
176
+ void set_value(::std::string&& value);
177
+ #endif
178
+ void set_value(const char* value);
179
+ void set_value(const void* value, size_t size);
180
+ ::std::string* mutable_value();
181
+ ::std::string* release_value();
182
+ void set_allocated_value(::std::string* value);
183
+
184
+ // @@protoc_insertion_point(class_scope:google.protobuf.Any)
185
+ private:
186
+
187
+ ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
188
+ ::google::protobuf::internal::ArenaStringPtr type_url_;
189
+ ::google::protobuf::internal::ArenaStringPtr value_;
190
+ mutable int _cached_size_;
191
+ ::google::protobuf::internal::AnyMetadata _any_metadata_;
192
+ friend struct ::protobuf_google_2fprotobuf_2fany_2eproto::TableStruct;
193
+ friend void ::protobuf_google_2fprotobuf_2fany_2eproto::InitDefaultsAnyImpl();
194
+ };
195
+ // ===================================================================
196
+
197
+
198
+ // ===================================================================
199
+
200
+ #ifdef __GNUC__
201
+ #pragma GCC diagnostic push
202
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
203
+ #endif // __GNUC__
204
+ // Any
205
+
206
+ // string type_url = 1;
207
+ inline void Any::clear_type_url() {
208
+ type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
209
+ }
210
+ inline const ::std::string& Any::type_url() const {
211
+ // @@protoc_insertion_point(field_get:google.protobuf.Any.type_url)
212
+ return type_url_.GetNoArena();
213
+ }
214
+ inline void Any::set_type_url(const ::std::string& value) {
215
+
216
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
217
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.type_url)
218
+ }
219
+ #if LANG_CXX11
220
+ inline void Any::set_type_url(::std::string&& value) {
221
+
222
+ type_url_.SetNoArena(
223
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
224
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.type_url)
225
+ }
226
+ #endif
227
+ inline void Any::set_type_url(const char* value) {
228
+ GOOGLE_DCHECK(value != NULL);
229
+
230
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
231
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Any.type_url)
232
+ }
233
+ inline void Any::set_type_url(const char* value, size_t size) {
234
+
235
+ type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
236
+ ::std::string(reinterpret_cast<const char*>(value), size));
237
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.type_url)
238
+ }
239
+ inline ::std::string* Any::mutable_type_url() {
240
+
241
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.type_url)
242
+ return type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
243
+ }
244
+ inline ::std::string* Any::release_type_url() {
245
+ // @@protoc_insertion_point(field_release:google.protobuf.Any.type_url)
246
+
247
+ return type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
248
+ }
249
+ inline void Any::set_allocated_type_url(::std::string* type_url) {
250
+ if (type_url != NULL) {
251
+
252
+ } else {
253
+
254
+ }
255
+ type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), type_url);
256
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
257
+ }
258
+
259
+ // bytes value = 2;
260
+ inline void Any::clear_value() {
261
+ value_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
262
+ }
263
+ inline const ::std::string& Any::value() const {
264
+ // @@protoc_insertion_point(field_get:google.protobuf.Any.value)
265
+ return value_.GetNoArena();
266
+ }
267
+ inline void Any::set_value(const ::std::string& value) {
268
+
269
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
270
+ // @@protoc_insertion_point(field_set:google.protobuf.Any.value)
271
+ }
272
+ #if LANG_CXX11
273
+ inline void Any::set_value(::std::string&& value) {
274
+
275
+ value_.SetNoArena(
276
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
277
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Any.value)
278
+ }
279
+ #endif
280
+ inline void Any::set_value(const char* value) {
281
+ GOOGLE_DCHECK(value != NULL);
282
+
283
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
284
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Any.value)
285
+ }
286
+ inline void Any::set_value(const void* value, size_t size) {
287
+
288
+ value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
289
+ ::std::string(reinterpret_cast<const char*>(value), size));
290
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Any.value)
291
+ }
292
+ inline ::std::string* Any::mutable_value() {
293
+
294
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Any.value)
295
+ return value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
296
+ }
297
+ inline ::std::string* Any::release_value() {
298
+ // @@protoc_insertion_point(field_release:google.protobuf.Any.value)
299
+
300
+ return value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
301
+ }
302
+ inline void Any::set_allocated_value(::std::string* value) {
303
+ if (value != NULL) {
304
+
305
+ } else {
306
+
307
+ }
308
+ value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
309
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
310
+ }
311
+
312
+ #ifdef __GNUC__
313
+ #pragma GCC diagnostic pop
314
+ #endif // __GNUC__
315
+
316
+ // @@protoc_insertion_point(namespace_scope)
317
+
318
+ } // namespace protobuf
319
+ } // namespace google
320
+
321
+ // @@protoc_insertion_point(global_scope)
322
+
323
+ #endif // PROTOBUF_google_2fprotobuf_2fany_2eproto__INCLUDED
kortex_api/include/google/protobuf/api.pb.h ADDED
@@ -0,0 +1,1165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ // source: google/protobuf/api.proto
3
+
4
+ #ifndef PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
5
+ #define PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
6
+
7
+ #include <string>
8
+
9
+ #include <google/protobuf/stubs/common.h>
10
+
11
+ #if GOOGLE_PROTOBUF_VERSION < 3005000
12
+ #error This file was generated by a newer version of protoc which is
13
+ #error incompatible with your Protocol Buffer headers. Please update
14
+ #error your headers.
15
+ #endif
16
+ #if 3005001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
17
+ #error This file was generated by an older version of protoc which is
18
+ #error incompatible with your Protocol Buffer headers. Please
19
+ #error regenerate this file with a newer version of protoc.
20
+ #endif
21
+
22
+ #include <google/protobuf/io/coded_stream.h>
23
+ #include <google/protobuf/arena.h>
24
+ #include <google/protobuf/arenastring.h>
25
+ #include <google/protobuf/generated_message_table_driven.h>
26
+ #include <google/protobuf/generated_message_util.h>
27
+ #include <google/protobuf/metadata.h>
28
+ #include <google/protobuf/message.h>
29
+ #include <google/protobuf/repeated_field.h> // IWYU pragma: export
30
+ #include <google/protobuf/extension_set.h> // IWYU pragma: export
31
+ #include <google/protobuf/unknown_field_set.h>
32
+ #include <google/protobuf/source_context.pb.h>
33
+ #include <google/protobuf/type.pb.h>
34
+ // @@protoc_insertion_point(includes)
35
+
36
+ namespace protobuf_google_2fprotobuf_2fapi_2eproto {
37
+ // Internal implementation detail -- do not use these members.
38
+ struct LIBPROTOBUF_EXPORT TableStruct {
39
+ static const ::google::protobuf::internal::ParseTableField entries[];
40
+ static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
41
+ static const ::google::protobuf::internal::ParseTable schema[3];
42
+ static const ::google::protobuf::internal::FieldMetadata field_metadata[];
43
+ static const ::google::protobuf::internal::SerializationTable serialization_table[];
44
+ static const ::google::protobuf::uint32 offsets[];
45
+ };
46
+ void LIBPROTOBUF_EXPORT AddDescriptors();
47
+ void LIBPROTOBUF_EXPORT InitDefaultsApiImpl();
48
+ void LIBPROTOBUF_EXPORT InitDefaultsApi();
49
+ void LIBPROTOBUF_EXPORT InitDefaultsMethodImpl();
50
+ void LIBPROTOBUF_EXPORT InitDefaultsMethod();
51
+ void LIBPROTOBUF_EXPORT InitDefaultsMixinImpl();
52
+ void LIBPROTOBUF_EXPORT InitDefaultsMixin();
53
+ inline void LIBPROTOBUF_EXPORT InitDefaults() {
54
+ InitDefaultsApi();
55
+ InitDefaultsMethod();
56
+ InitDefaultsMixin();
57
+ }
58
+ } // namespace protobuf_google_2fprotobuf_2fapi_2eproto
59
+ namespace google {
60
+ namespace protobuf {
61
+ class Api;
62
+ class ApiDefaultTypeInternal;
63
+ LIBPROTOBUF_EXPORT extern ApiDefaultTypeInternal _Api_default_instance_;
64
+ class Method;
65
+ class MethodDefaultTypeInternal;
66
+ LIBPROTOBUF_EXPORT extern MethodDefaultTypeInternal _Method_default_instance_;
67
+ class Mixin;
68
+ class MixinDefaultTypeInternal;
69
+ LIBPROTOBUF_EXPORT extern MixinDefaultTypeInternal _Mixin_default_instance_;
70
+ } // namespace protobuf
71
+ } // namespace google
72
+ namespace google {
73
+ namespace protobuf {
74
+
75
+ // ===================================================================
76
+
77
+ class LIBPROTOBUF_EXPORT Api : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Api) */ {
78
+ public:
79
+ Api();
80
+ virtual ~Api();
81
+
82
+ Api(const Api& from);
83
+
84
+ inline Api& operator=(const Api& from) {
85
+ CopyFrom(from);
86
+ return *this;
87
+ }
88
+ #if LANG_CXX11
89
+ Api(Api&& from) noexcept
90
+ : Api() {
91
+ *this = ::std::move(from);
92
+ }
93
+
94
+ inline Api& operator=(Api&& from) noexcept {
95
+ if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
96
+ if (this != &from) InternalSwap(&from);
97
+ } else {
98
+ CopyFrom(from);
99
+ }
100
+ return *this;
101
+ }
102
+ #endif
103
+ static const ::google::protobuf::Descriptor* descriptor();
104
+ static const Api& default_instance();
105
+
106
+ static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
107
+ static inline const Api* internal_default_instance() {
108
+ return reinterpret_cast<const Api*>(
109
+ &_Api_default_instance_);
110
+ }
111
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
112
+ 0;
113
+
114
+ void Swap(Api* other);
115
+ friend void swap(Api& a, Api& b) {
116
+ a.Swap(&b);
117
+ }
118
+
119
+ // implements Message ----------------------------------------------
120
+
121
+ inline Api* New() const PROTOBUF_FINAL { return New(NULL); }
122
+
123
+ Api* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
124
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
125
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
126
+ void CopyFrom(const Api& from);
127
+ void MergeFrom(const Api& from);
128
+ void Clear() PROTOBUF_FINAL;
129
+ bool IsInitialized() const PROTOBUF_FINAL;
130
+
131
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
132
+ bool MergePartialFromCodedStream(
133
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
134
+ void SerializeWithCachedSizes(
135
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
136
+ ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
137
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
138
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
139
+ private:
140
+ void SharedCtor();
141
+ void SharedDtor();
142
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
143
+ void InternalSwap(Api* other);
144
+ private:
145
+ inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
146
+ return NULL;
147
+ }
148
+ inline void* MaybeArenaPtr() const {
149
+ return NULL;
150
+ }
151
+ public:
152
+
153
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
154
+
155
+ // nested types ----------------------------------------------------
156
+
157
+ // accessors -------------------------------------------------------
158
+
159
+ // repeated .google.protobuf.Method methods = 2;
160
+ int methods_size() const;
161
+ void clear_methods();
162
+ static const int kMethodsFieldNumber = 2;
163
+ const ::google::protobuf::Method& methods(int index) const;
164
+ ::google::protobuf::Method* mutable_methods(int index);
165
+ ::google::protobuf::Method* add_methods();
166
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >*
167
+ mutable_methods();
168
+ const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >&
169
+ methods() const;
170
+
171
+ // repeated .google.protobuf.Option options = 3;
172
+ int options_size() const;
173
+ void clear_options();
174
+ static const int kOptionsFieldNumber = 3;
175
+ const ::google::protobuf::Option& options(int index) const;
176
+ ::google::protobuf::Option* mutable_options(int index);
177
+ ::google::protobuf::Option* add_options();
178
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
179
+ mutable_options();
180
+ const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
181
+ options() const;
182
+
183
+ // repeated .google.protobuf.Mixin mixins = 6;
184
+ int mixins_size() const;
185
+ void clear_mixins();
186
+ static const int kMixinsFieldNumber = 6;
187
+ const ::google::protobuf::Mixin& mixins(int index) const;
188
+ ::google::protobuf::Mixin* mutable_mixins(int index);
189
+ ::google::protobuf::Mixin* add_mixins();
190
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >*
191
+ mutable_mixins();
192
+ const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >&
193
+ mixins() const;
194
+
195
+ // string name = 1;
196
+ void clear_name();
197
+ static const int kNameFieldNumber = 1;
198
+ const ::std::string& name() const;
199
+ void set_name(const ::std::string& value);
200
+ #if LANG_CXX11
201
+ void set_name(::std::string&& value);
202
+ #endif
203
+ void set_name(const char* value);
204
+ void set_name(const char* value, size_t size);
205
+ ::std::string* mutable_name();
206
+ ::std::string* release_name();
207
+ void set_allocated_name(::std::string* name);
208
+
209
+ // string version = 4;
210
+ void clear_version();
211
+ static const int kVersionFieldNumber = 4;
212
+ const ::std::string& version() const;
213
+ void set_version(const ::std::string& value);
214
+ #if LANG_CXX11
215
+ void set_version(::std::string&& value);
216
+ #endif
217
+ void set_version(const char* value);
218
+ void set_version(const char* value, size_t size);
219
+ ::std::string* mutable_version();
220
+ ::std::string* release_version();
221
+ void set_allocated_version(::std::string* version);
222
+
223
+ // .google.protobuf.SourceContext source_context = 5;
224
+ bool has_source_context() const;
225
+ void clear_source_context();
226
+ static const int kSourceContextFieldNumber = 5;
227
+ const ::google::protobuf::SourceContext& source_context() const;
228
+ ::google::protobuf::SourceContext* release_source_context();
229
+ ::google::protobuf::SourceContext* mutable_source_context();
230
+ void set_allocated_source_context(::google::protobuf::SourceContext* source_context);
231
+
232
+ // .google.protobuf.Syntax syntax = 7;
233
+ void clear_syntax();
234
+ static const int kSyntaxFieldNumber = 7;
235
+ ::google::protobuf::Syntax syntax() const;
236
+ void set_syntax(::google::protobuf::Syntax value);
237
+
238
+ // @@protoc_insertion_point(class_scope:google.protobuf.Api)
239
+ private:
240
+
241
+ ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
242
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method > methods_;
243
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_;
244
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin > mixins_;
245
+ ::google::protobuf::internal::ArenaStringPtr name_;
246
+ ::google::protobuf::internal::ArenaStringPtr version_;
247
+ ::google::protobuf::SourceContext* source_context_;
248
+ int syntax_;
249
+ mutable int _cached_size_;
250
+ friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
251
+ friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsApiImpl();
252
+ };
253
+ // -------------------------------------------------------------------
254
+
255
+ class LIBPROTOBUF_EXPORT Method : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Method) */ {
256
+ public:
257
+ Method();
258
+ virtual ~Method();
259
+
260
+ Method(const Method& from);
261
+
262
+ inline Method& operator=(const Method& from) {
263
+ CopyFrom(from);
264
+ return *this;
265
+ }
266
+ #if LANG_CXX11
267
+ Method(Method&& from) noexcept
268
+ : Method() {
269
+ *this = ::std::move(from);
270
+ }
271
+
272
+ inline Method& operator=(Method&& from) noexcept {
273
+ if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
274
+ if (this != &from) InternalSwap(&from);
275
+ } else {
276
+ CopyFrom(from);
277
+ }
278
+ return *this;
279
+ }
280
+ #endif
281
+ static const ::google::protobuf::Descriptor* descriptor();
282
+ static const Method& default_instance();
283
+
284
+ static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
285
+ static inline const Method* internal_default_instance() {
286
+ return reinterpret_cast<const Method*>(
287
+ &_Method_default_instance_);
288
+ }
289
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
290
+ 1;
291
+
292
+ void Swap(Method* other);
293
+ friend void swap(Method& a, Method& b) {
294
+ a.Swap(&b);
295
+ }
296
+
297
+ // implements Message ----------------------------------------------
298
+
299
+ inline Method* New() const PROTOBUF_FINAL { return New(NULL); }
300
+
301
+ Method* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
302
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
303
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
304
+ void CopyFrom(const Method& from);
305
+ void MergeFrom(const Method& from);
306
+ void Clear() PROTOBUF_FINAL;
307
+ bool IsInitialized() const PROTOBUF_FINAL;
308
+
309
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
310
+ bool MergePartialFromCodedStream(
311
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
312
+ void SerializeWithCachedSizes(
313
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
314
+ ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
315
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
316
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
317
+ private:
318
+ void SharedCtor();
319
+ void SharedDtor();
320
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
321
+ void InternalSwap(Method* other);
322
+ private:
323
+ inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
324
+ return NULL;
325
+ }
326
+ inline void* MaybeArenaPtr() const {
327
+ return NULL;
328
+ }
329
+ public:
330
+
331
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
332
+
333
+ // nested types ----------------------------------------------------
334
+
335
+ // accessors -------------------------------------------------------
336
+
337
+ // repeated .google.protobuf.Option options = 6;
338
+ int options_size() const;
339
+ void clear_options();
340
+ static const int kOptionsFieldNumber = 6;
341
+ const ::google::protobuf::Option& options(int index) const;
342
+ ::google::protobuf::Option* mutable_options(int index);
343
+ ::google::protobuf::Option* add_options();
344
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
345
+ mutable_options();
346
+ const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
347
+ options() const;
348
+
349
+ // string name = 1;
350
+ void clear_name();
351
+ static const int kNameFieldNumber = 1;
352
+ const ::std::string& name() const;
353
+ void set_name(const ::std::string& value);
354
+ #if LANG_CXX11
355
+ void set_name(::std::string&& value);
356
+ #endif
357
+ void set_name(const char* value);
358
+ void set_name(const char* value, size_t size);
359
+ ::std::string* mutable_name();
360
+ ::std::string* release_name();
361
+ void set_allocated_name(::std::string* name);
362
+
363
+ // string request_type_url = 2;
364
+ void clear_request_type_url();
365
+ static const int kRequestTypeUrlFieldNumber = 2;
366
+ const ::std::string& request_type_url() const;
367
+ void set_request_type_url(const ::std::string& value);
368
+ #if LANG_CXX11
369
+ void set_request_type_url(::std::string&& value);
370
+ #endif
371
+ void set_request_type_url(const char* value);
372
+ void set_request_type_url(const char* value, size_t size);
373
+ ::std::string* mutable_request_type_url();
374
+ ::std::string* release_request_type_url();
375
+ void set_allocated_request_type_url(::std::string* request_type_url);
376
+
377
+ // string response_type_url = 4;
378
+ void clear_response_type_url();
379
+ static const int kResponseTypeUrlFieldNumber = 4;
380
+ const ::std::string& response_type_url() const;
381
+ void set_response_type_url(const ::std::string& value);
382
+ #if LANG_CXX11
383
+ void set_response_type_url(::std::string&& value);
384
+ #endif
385
+ void set_response_type_url(const char* value);
386
+ void set_response_type_url(const char* value, size_t size);
387
+ ::std::string* mutable_response_type_url();
388
+ ::std::string* release_response_type_url();
389
+ void set_allocated_response_type_url(::std::string* response_type_url);
390
+
391
+ // bool request_streaming = 3;
392
+ void clear_request_streaming();
393
+ static const int kRequestStreamingFieldNumber = 3;
394
+ bool request_streaming() const;
395
+ void set_request_streaming(bool value);
396
+
397
+ // bool response_streaming = 5;
398
+ void clear_response_streaming();
399
+ static const int kResponseStreamingFieldNumber = 5;
400
+ bool response_streaming() const;
401
+ void set_response_streaming(bool value);
402
+
403
+ // .google.protobuf.Syntax syntax = 7;
404
+ void clear_syntax();
405
+ static const int kSyntaxFieldNumber = 7;
406
+ ::google::protobuf::Syntax syntax() const;
407
+ void set_syntax(::google::protobuf::Syntax value);
408
+
409
+ // @@protoc_insertion_point(class_scope:google.protobuf.Method)
410
+ private:
411
+
412
+ ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
413
+ ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option > options_;
414
+ ::google::protobuf::internal::ArenaStringPtr name_;
415
+ ::google::protobuf::internal::ArenaStringPtr request_type_url_;
416
+ ::google::protobuf::internal::ArenaStringPtr response_type_url_;
417
+ bool request_streaming_;
418
+ bool response_streaming_;
419
+ int syntax_;
420
+ mutable int _cached_size_;
421
+ friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
422
+ friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMethodImpl();
423
+ };
424
+ // -------------------------------------------------------------------
425
+
426
+ class LIBPROTOBUF_EXPORT Mixin : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Mixin) */ {
427
+ public:
428
+ Mixin();
429
+ virtual ~Mixin();
430
+
431
+ Mixin(const Mixin& from);
432
+
433
+ inline Mixin& operator=(const Mixin& from) {
434
+ CopyFrom(from);
435
+ return *this;
436
+ }
437
+ #if LANG_CXX11
438
+ Mixin(Mixin&& from) noexcept
439
+ : Mixin() {
440
+ *this = ::std::move(from);
441
+ }
442
+
443
+ inline Mixin& operator=(Mixin&& from) noexcept {
444
+ if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
445
+ if (this != &from) InternalSwap(&from);
446
+ } else {
447
+ CopyFrom(from);
448
+ }
449
+ return *this;
450
+ }
451
+ #endif
452
+ static const ::google::protobuf::Descriptor* descriptor();
453
+ static const Mixin& default_instance();
454
+
455
+ static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
456
+ static inline const Mixin* internal_default_instance() {
457
+ return reinterpret_cast<const Mixin*>(
458
+ &_Mixin_default_instance_);
459
+ }
460
+ static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =
461
+ 2;
462
+
463
+ void Swap(Mixin* other);
464
+ friend void swap(Mixin& a, Mixin& b) {
465
+ a.Swap(&b);
466
+ }
467
+
468
+ // implements Message ----------------------------------------------
469
+
470
+ inline Mixin* New() const PROTOBUF_FINAL { return New(NULL); }
471
+
472
+ Mixin* New(::google::protobuf::Arena* arena) const PROTOBUF_FINAL;
473
+ void CopyFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
474
+ void MergeFrom(const ::google::protobuf::Message& from) PROTOBUF_FINAL;
475
+ void CopyFrom(const Mixin& from);
476
+ void MergeFrom(const Mixin& from);
477
+ void Clear() PROTOBUF_FINAL;
478
+ bool IsInitialized() const PROTOBUF_FINAL;
479
+
480
+ size_t ByteSizeLong() const PROTOBUF_FINAL;
481
+ bool MergePartialFromCodedStream(
482
+ ::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;
483
+ void SerializeWithCachedSizes(
484
+ ::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;
485
+ ::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
486
+ bool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;
487
+ int GetCachedSize() const PROTOBUF_FINAL { return _cached_size_; }
488
+ private:
489
+ void SharedCtor();
490
+ void SharedDtor();
491
+ void SetCachedSize(int size) const PROTOBUF_FINAL;
492
+ void InternalSwap(Mixin* other);
493
+ private:
494
+ inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
495
+ return NULL;
496
+ }
497
+ inline void* MaybeArenaPtr() const {
498
+ return NULL;
499
+ }
500
+ public:
501
+
502
+ ::google::protobuf::Metadata GetMetadata() const PROTOBUF_FINAL;
503
+
504
+ // nested types ----------------------------------------------------
505
+
506
+ // accessors -------------------------------------------------------
507
+
508
+ // string name = 1;
509
+ void clear_name();
510
+ static const int kNameFieldNumber = 1;
511
+ const ::std::string& name() const;
512
+ void set_name(const ::std::string& value);
513
+ #if LANG_CXX11
514
+ void set_name(::std::string&& value);
515
+ #endif
516
+ void set_name(const char* value);
517
+ void set_name(const char* value, size_t size);
518
+ ::std::string* mutable_name();
519
+ ::std::string* release_name();
520
+ void set_allocated_name(::std::string* name);
521
+
522
+ // string root = 2;
523
+ void clear_root();
524
+ static const int kRootFieldNumber = 2;
525
+ const ::std::string& root() const;
526
+ void set_root(const ::std::string& value);
527
+ #if LANG_CXX11
528
+ void set_root(::std::string&& value);
529
+ #endif
530
+ void set_root(const char* value);
531
+ void set_root(const char* value, size_t size);
532
+ ::std::string* mutable_root();
533
+ ::std::string* release_root();
534
+ void set_allocated_root(::std::string* root);
535
+
536
+ // @@protoc_insertion_point(class_scope:google.protobuf.Mixin)
537
+ private:
538
+
539
+ ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
540
+ ::google::protobuf::internal::ArenaStringPtr name_;
541
+ ::google::protobuf::internal::ArenaStringPtr root_;
542
+ mutable int _cached_size_;
543
+ friend struct ::protobuf_google_2fprotobuf_2fapi_2eproto::TableStruct;
544
+ friend void ::protobuf_google_2fprotobuf_2fapi_2eproto::InitDefaultsMixinImpl();
545
+ };
546
+ // ===================================================================
547
+
548
+
549
+ // ===================================================================
550
+
551
+ #ifdef __GNUC__
552
+ #pragma GCC diagnostic push
553
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
554
+ #endif // __GNUC__
555
+ // Api
556
+
557
+ // string name = 1;
558
+ inline void Api::clear_name() {
559
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
560
+ }
561
+ inline const ::std::string& Api::name() const {
562
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.name)
563
+ return name_.GetNoArena();
564
+ }
565
+ inline void Api::set_name(const ::std::string& value) {
566
+
567
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
568
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.name)
569
+ }
570
+ #if LANG_CXX11
571
+ inline void Api::set_name(::std::string&& value) {
572
+
573
+ name_.SetNoArena(
574
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
575
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.name)
576
+ }
577
+ #endif
578
+ inline void Api::set_name(const char* value) {
579
+ GOOGLE_DCHECK(value != NULL);
580
+
581
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
582
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Api.name)
583
+ }
584
+ inline void Api::set_name(const char* value, size_t size) {
585
+
586
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
587
+ ::std::string(reinterpret_cast<const char*>(value), size));
588
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.name)
589
+ }
590
+ inline ::std::string* Api::mutable_name() {
591
+
592
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.name)
593
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
594
+ }
595
+ inline ::std::string* Api::release_name() {
596
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.name)
597
+
598
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
599
+ }
600
+ inline void Api::set_allocated_name(::std::string* name) {
601
+ if (name != NULL) {
602
+
603
+ } else {
604
+
605
+ }
606
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
607
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
608
+ }
609
+
610
+ // repeated .google.protobuf.Method methods = 2;
611
+ inline int Api::methods_size() const {
612
+ return methods_.size();
613
+ }
614
+ inline void Api::clear_methods() {
615
+ methods_.Clear();
616
+ }
617
+ inline const ::google::protobuf::Method& Api::methods(int index) const {
618
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.methods)
619
+ return methods_.Get(index);
620
+ }
621
+ inline ::google::protobuf::Method* Api::mutable_methods(int index) {
622
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.methods)
623
+ return methods_.Mutable(index);
624
+ }
625
+ inline ::google::protobuf::Method* Api::add_methods() {
626
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.methods)
627
+ return methods_.Add();
628
+ }
629
+ inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >*
630
+ Api::mutable_methods() {
631
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.methods)
632
+ return &methods_;
633
+ }
634
+ inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Method >&
635
+ Api::methods() const {
636
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.methods)
637
+ return methods_;
638
+ }
639
+
640
+ // repeated .google.protobuf.Option options = 3;
641
+ inline int Api::options_size() const {
642
+ return options_.size();
643
+ }
644
+ inline const ::google::protobuf::Option& Api::options(int index) const {
645
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.options)
646
+ return options_.Get(index);
647
+ }
648
+ inline ::google::protobuf::Option* Api::mutable_options(int index) {
649
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.options)
650
+ return options_.Mutable(index);
651
+ }
652
+ inline ::google::protobuf::Option* Api::add_options() {
653
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.options)
654
+ return options_.Add();
655
+ }
656
+ inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
657
+ Api::mutable_options() {
658
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.options)
659
+ return &options_;
660
+ }
661
+ inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
662
+ Api::options() const {
663
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.options)
664
+ return options_;
665
+ }
666
+
667
+ // string version = 4;
668
+ inline void Api::clear_version() {
669
+ version_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
670
+ }
671
+ inline const ::std::string& Api::version() const {
672
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.version)
673
+ return version_.GetNoArena();
674
+ }
675
+ inline void Api::set_version(const ::std::string& value) {
676
+
677
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
678
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.version)
679
+ }
680
+ #if LANG_CXX11
681
+ inline void Api::set_version(::std::string&& value) {
682
+
683
+ version_.SetNoArena(
684
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
685
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Api.version)
686
+ }
687
+ #endif
688
+ inline void Api::set_version(const char* value) {
689
+ GOOGLE_DCHECK(value != NULL);
690
+
691
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
692
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Api.version)
693
+ }
694
+ inline void Api::set_version(const char* value, size_t size) {
695
+
696
+ version_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
697
+ ::std::string(reinterpret_cast<const char*>(value), size));
698
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Api.version)
699
+ }
700
+ inline ::std::string* Api::mutable_version() {
701
+
702
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.version)
703
+ return version_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
704
+ }
705
+ inline ::std::string* Api::release_version() {
706
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.version)
707
+
708
+ return version_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
709
+ }
710
+ inline void Api::set_allocated_version(::std::string* version) {
711
+ if (version != NULL) {
712
+
713
+ } else {
714
+
715
+ }
716
+ version_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), version);
717
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
718
+ }
719
+
720
+ // .google.protobuf.SourceContext source_context = 5;
721
+ inline bool Api::has_source_context() const {
722
+ return this != internal_default_instance() && source_context_ != NULL;
723
+ }
724
+ inline const ::google::protobuf::SourceContext& Api::source_context() const {
725
+ const ::google::protobuf::SourceContext* p = source_context_;
726
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.source_context)
727
+ return p != NULL ? *p : *reinterpret_cast<const ::google::protobuf::SourceContext*>(
728
+ &::google::protobuf::_SourceContext_default_instance_);
729
+ }
730
+ inline ::google::protobuf::SourceContext* Api::release_source_context() {
731
+ // @@protoc_insertion_point(field_release:google.protobuf.Api.source_context)
732
+
733
+ ::google::protobuf::SourceContext* temp = source_context_;
734
+ source_context_ = NULL;
735
+ return temp;
736
+ }
737
+ inline ::google::protobuf::SourceContext* Api::mutable_source_context() {
738
+
739
+ if (source_context_ == NULL) {
740
+ source_context_ = new ::google::protobuf::SourceContext;
741
+ }
742
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.source_context)
743
+ return source_context_;
744
+ }
745
+ inline void Api::set_allocated_source_context(::google::protobuf::SourceContext* source_context) {
746
+ ::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
747
+ if (message_arena == NULL) {
748
+ delete reinterpret_cast< ::google::protobuf::MessageLite*>(source_context_);
749
+ }
750
+ if (source_context) {
751
+ ::google::protobuf::Arena* submessage_arena = NULL;
752
+ if (message_arena != submessage_arena) {
753
+ source_context = ::google::protobuf::internal::GetOwnedMessage(
754
+ message_arena, source_context, submessage_arena);
755
+ }
756
+
757
+ } else {
758
+
759
+ }
760
+ source_context_ = source_context;
761
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.source_context)
762
+ }
763
+
764
+ // repeated .google.protobuf.Mixin mixins = 6;
765
+ inline int Api::mixins_size() const {
766
+ return mixins_.size();
767
+ }
768
+ inline void Api::clear_mixins() {
769
+ mixins_.Clear();
770
+ }
771
+ inline const ::google::protobuf::Mixin& Api::mixins(int index) const {
772
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.mixins)
773
+ return mixins_.Get(index);
774
+ }
775
+ inline ::google::protobuf::Mixin* Api::mutable_mixins(int index) {
776
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Api.mixins)
777
+ return mixins_.Mutable(index);
778
+ }
779
+ inline ::google::protobuf::Mixin* Api::add_mixins() {
780
+ // @@protoc_insertion_point(field_add:google.protobuf.Api.mixins)
781
+ return mixins_.Add();
782
+ }
783
+ inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >*
784
+ Api::mutable_mixins() {
785
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Api.mixins)
786
+ return &mixins_;
787
+ }
788
+ inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Mixin >&
789
+ Api::mixins() const {
790
+ // @@protoc_insertion_point(field_list:google.protobuf.Api.mixins)
791
+ return mixins_;
792
+ }
793
+
794
+ // .google.protobuf.Syntax syntax = 7;
795
+ inline void Api::clear_syntax() {
796
+ syntax_ = 0;
797
+ }
798
+ inline ::google::protobuf::Syntax Api::syntax() const {
799
+ // @@protoc_insertion_point(field_get:google.protobuf.Api.syntax)
800
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
801
+ }
802
+ inline void Api::set_syntax(::google::protobuf::Syntax value) {
803
+
804
+ syntax_ = value;
805
+ // @@protoc_insertion_point(field_set:google.protobuf.Api.syntax)
806
+ }
807
+
808
+ // -------------------------------------------------------------------
809
+
810
+ // Method
811
+
812
+ // string name = 1;
813
+ inline void Method::clear_name() {
814
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
815
+ }
816
+ inline const ::std::string& Method::name() const {
817
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.name)
818
+ return name_.GetNoArena();
819
+ }
820
+ inline void Method::set_name(const ::std::string& value) {
821
+
822
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
823
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.name)
824
+ }
825
+ #if LANG_CXX11
826
+ inline void Method::set_name(::std::string&& value) {
827
+
828
+ name_.SetNoArena(
829
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
830
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.name)
831
+ }
832
+ #endif
833
+ inline void Method::set_name(const char* value) {
834
+ GOOGLE_DCHECK(value != NULL);
835
+
836
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
837
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.name)
838
+ }
839
+ inline void Method::set_name(const char* value, size_t size) {
840
+
841
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
842
+ ::std::string(reinterpret_cast<const char*>(value), size));
843
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.name)
844
+ }
845
+ inline ::std::string* Method::mutable_name() {
846
+
847
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.name)
848
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
849
+ }
850
+ inline ::std::string* Method::release_name() {
851
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.name)
852
+
853
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
854
+ }
855
+ inline void Method::set_allocated_name(::std::string* name) {
856
+ if (name != NULL) {
857
+
858
+ } else {
859
+
860
+ }
861
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
862
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
863
+ }
864
+
865
+ // string request_type_url = 2;
866
+ inline void Method::clear_request_type_url() {
867
+ request_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
868
+ }
869
+ inline const ::std::string& Method::request_type_url() const {
870
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.request_type_url)
871
+ return request_type_url_.GetNoArena();
872
+ }
873
+ inline void Method::set_request_type_url(const ::std::string& value) {
874
+
875
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
876
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.request_type_url)
877
+ }
878
+ #if LANG_CXX11
879
+ inline void Method::set_request_type_url(::std::string&& value) {
880
+
881
+ request_type_url_.SetNoArena(
882
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
883
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.request_type_url)
884
+ }
885
+ #endif
886
+ inline void Method::set_request_type_url(const char* value) {
887
+ GOOGLE_DCHECK(value != NULL);
888
+
889
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
890
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.request_type_url)
891
+ }
892
+ inline void Method::set_request_type_url(const char* value, size_t size) {
893
+
894
+ request_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
895
+ ::std::string(reinterpret_cast<const char*>(value), size));
896
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.request_type_url)
897
+ }
898
+ inline ::std::string* Method::mutable_request_type_url() {
899
+
900
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.request_type_url)
901
+ return request_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
902
+ }
903
+ inline ::std::string* Method::release_request_type_url() {
904
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.request_type_url)
905
+
906
+ return request_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
907
+ }
908
+ inline void Method::set_allocated_request_type_url(::std::string* request_type_url) {
909
+ if (request_type_url != NULL) {
910
+
911
+ } else {
912
+
913
+ }
914
+ request_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), request_type_url);
915
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
916
+ }
917
+
918
+ // bool request_streaming = 3;
919
+ inline void Method::clear_request_streaming() {
920
+ request_streaming_ = false;
921
+ }
922
+ inline bool Method::request_streaming() const {
923
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.request_streaming)
924
+ return request_streaming_;
925
+ }
926
+ inline void Method::set_request_streaming(bool value) {
927
+
928
+ request_streaming_ = value;
929
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.request_streaming)
930
+ }
931
+
932
+ // string response_type_url = 4;
933
+ inline void Method::clear_response_type_url() {
934
+ response_type_url_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
935
+ }
936
+ inline const ::std::string& Method::response_type_url() const {
937
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.response_type_url)
938
+ return response_type_url_.GetNoArena();
939
+ }
940
+ inline void Method::set_response_type_url(const ::std::string& value) {
941
+
942
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
943
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.response_type_url)
944
+ }
945
+ #if LANG_CXX11
946
+ inline void Method::set_response_type_url(::std::string&& value) {
947
+
948
+ response_type_url_.SetNoArena(
949
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
950
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Method.response_type_url)
951
+ }
952
+ #endif
953
+ inline void Method::set_response_type_url(const char* value) {
954
+ GOOGLE_DCHECK(value != NULL);
955
+
956
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
957
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Method.response_type_url)
958
+ }
959
+ inline void Method::set_response_type_url(const char* value, size_t size) {
960
+
961
+ response_type_url_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
962
+ ::std::string(reinterpret_cast<const char*>(value), size));
963
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Method.response_type_url)
964
+ }
965
+ inline ::std::string* Method::mutable_response_type_url() {
966
+
967
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.response_type_url)
968
+ return response_type_url_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
969
+ }
970
+ inline ::std::string* Method::release_response_type_url() {
971
+ // @@protoc_insertion_point(field_release:google.protobuf.Method.response_type_url)
972
+
973
+ return response_type_url_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
974
+ }
975
+ inline void Method::set_allocated_response_type_url(::std::string* response_type_url) {
976
+ if (response_type_url != NULL) {
977
+
978
+ } else {
979
+
980
+ }
981
+ response_type_url_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), response_type_url);
982
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
983
+ }
984
+
985
+ // bool response_streaming = 5;
986
+ inline void Method::clear_response_streaming() {
987
+ response_streaming_ = false;
988
+ }
989
+ inline bool Method::response_streaming() const {
990
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.response_streaming)
991
+ return response_streaming_;
992
+ }
993
+ inline void Method::set_response_streaming(bool value) {
994
+
995
+ response_streaming_ = value;
996
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.response_streaming)
997
+ }
998
+
999
+ // repeated .google.protobuf.Option options = 6;
1000
+ inline int Method::options_size() const {
1001
+ return options_.size();
1002
+ }
1003
+ inline const ::google::protobuf::Option& Method::options(int index) const {
1004
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.options)
1005
+ return options_.Get(index);
1006
+ }
1007
+ inline ::google::protobuf::Option* Method::mutable_options(int index) {
1008
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Method.options)
1009
+ return options_.Mutable(index);
1010
+ }
1011
+ inline ::google::protobuf::Option* Method::add_options() {
1012
+ // @@protoc_insertion_point(field_add:google.protobuf.Method.options)
1013
+ return options_.Add();
1014
+ }
1015
+ inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >*
1016
+ Method::mutable_options() {
1017
+ // @@protoc_insertion_point(field_mutable_list:google.protobuf.Method.options)
1018
+ return &options_;
1019
+ }
1020
+ inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Option >&
1021
+ Method::options() const {
1022
+ // @@protoc_insertion_point(field_list:google.protobuf.Method.options)
1023
+ return options_;
1024
+ }
1025
+
1026
+ // .google.protobuf.Syntax syntax = 7;
1027
+ inline void Method::clear_syntax() {
1028
+ syntax_ = 0;
1029
+ }
1030
+ inline ::google::protobuf::Syntax Method::syntax() const {
1031
+ // @@protoc_insertion_point(field_get:google.protobuf.Method.syntax)
1032
+ return static_cast< ::google::protobuf::Syntax >(syntax_);
1033
+ }
1034
+ inline void Method::set_syntax(::google::protobuf::Syntax value) {
1035
+
1036
+ syntax_ = value;
1037
+ // @@protoc_insertion_point(field_set:google.protobuf.Method.syntax)
1038
+ }
1039
+
1040
+ // -------------------------------------------------------------------
1041
+
1042
+ // Mixin
1043
+
1044
+ // string name = 1;
1045
+ inline void Mixin::clear_name() {
1046
+ name_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1047
+ }
1048
+ inline const ::std::string& Mixin::name() const {
1049
+ // @@protoc_insertion_point(field_get:google.protobuf.Mixin.name)
1050
+ return name_.GetNoArena();
1051
+ }
1052
+ inline void Mixin::set_name(const ::std::string& value) {
1053
+
1054
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
1055
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.name)
1056
+ }
1057
+ #if LANG_CXX11
1058
+ inline void Mixin::set_name(::std::string&& value) {
1059
+
1060
+ name_.SetNoArena(
1061
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
1062
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.name)
1063
+ }
1064
+ #endif
1065
+ inline void Mixin::set_name(const char* value) {
1066
+ GOOGLE_DCHECK(value != NULL);
1067
+
1068
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
1069
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.name)
1070
+ }
1071
+ inline void Mixin::set_name(const char* value, size_t size) {
1072
+
1073
+ name_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
1074
+ ::std::string(reinterpret_cast<const char*>(value), size));
1075
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.name)
1076
+ }
1077
+ inline ::std::string* Mixin::mutable_name() {
1078
+
1079
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.name)
1080
+ return name_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1081
+ }
1082
+ inline ::std::string* Mixin::release_name() {
1083
+ // @@protoc_insertion_point(field_release:google.protobuf.Mixin.name)
1084
+
1085
+ return name_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1086
+ }
1087
+ inline void Mixin::set_allocated_name(::std::string* name) {
1088
+ if (name != NULL) {
1089
+
1090
+ } else {
1091
+
1092
+ }
1093
+ name_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name);
1094
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
1095
+ }
1096
+
1097
+ // string root = 2;
1098
+ inline void Mixin::clear_root() {
1099
+ root_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1100
+ }
1101
+ inline const ::std::string& Mixin::root() const {
1102
+ // @@protoc_insertion_point(field_get:google.protobuf.Mixin.root)
1103
+ return root_.GetNoArena();
1104
+ }
1105
+ inline void Mixin::set_root(const ::std::string& value) {
1106
+
1107
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
1108
+ // @@protoc_insertion_point(field_set:google.protobuf.Mixin.root)
1109
+ }
1110
+ #if LANG_CXX11
1111
+ inline void Mixin::set_root(::std::string&& value) {
1112
+
1113
+ root_.SetNoArena(
1114
+ &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
1115
+ // @@protoc_insertion_point(field_set_rvalue:google.protobuf.Mixin.root)
1116
+ }
1117
+ #endif
1118
+ inline void Mixin::set_root(const char* value) {
1119
+ GOOGLE_DCHECK(value != NULL);
1120
+
1121
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
1122
+ // @@protoc_insertion_point(field_set_char:google.protobuf.Mixin.root)
1123
+ }
1124
+ inline void Mixin::set_root(const char* value, size_t size) {
1125
+
1126
+ root_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
1127
+ ::std::string(reinterpret_cast<const char*>(value), size));
1128
+ // @@protoc_insertion_point(field_set_pointer:google.protobuf.Mixin.root)
1129
+ }
1130
+ inline ::std::string* Mixin::mutable_root() {
1131
+
1132
+ // @@protoc_insertion_point(field_mutable:google.protobuf.Mixin.root)
1133
+ return root_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1134
+ }
1135
+ inline ::std::string* Mixin::release_root() {
1136
+ // @@protoc_insertion_point(field_release:google.protobuf.Mixin.root)
1137
+
1138
+ return root_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
1139
+ }
1140
+ inline void Mixin::set_allocated_root(::std::string* root) {
1141
+ if (root != NULL) {
1142
+
1143
+ } else {
1144
+
1145
+ }
1146
+ root_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), root);
1147
+ // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
1148
+ }
1149
+
1150
+ #ifdef __GNUC__
1151
+ #pragma GCC diagnostic pop
1152
+ #endif // __GNUC__
1153
+ // -------------------------------------------------------------------
1154
+
1155
+ // -------------------------------------------------------------------
1156
+
1157
+
1158
+ // @@protoc_insertion_point(namespace_scope)
1159
+
1160
+ } // namespace protobuf
1161
+ } // namespace google
1162
+
1163
+ // @@protoc_insertion_point(global_scope)
1164
+
1165
+ #endif // PROTOBUF_google_2fprotobuf_2fapi_2eproto__INCLUDED
kortex_api/include/google/protobuf/arena.h ADDED
@@ -0,0 +1,934 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // This file defines an Arena allocator for better allocation performance.
32
+
33
+ #ifndef GOOGLE_PROTOBUF_ARENA_H__
34
+ #define GOOGLE_PROTOBUF_ARENA_H__
35
+
36
+ #include <limits>
37
+ #ifdef max
38
+ #undef max // Visual Studio defines this macro
39
+ #endif
40
+ #if LANG_CXX11
41
+ #include <google/protobuf/stubs/type_traits.h>
42
+ #endif
43
+ #if defined(_MSC_VER) && !_HAS_EXCEPTIONS
44
+ // Work around bugs in MSVC <typeinfo> header when _HAS_EXCEPTIONS=0.
45
+ #include <exception>
46
+ #include <typeinfo>
47
+ namespace std {
48
+ using type_info = ::type_info;
49
+ }
50
+ #else
51
+ #include <typeinfo>
52
+ #endif
53
+
54
+ #include <google/protobuf/arena_impl.h>
55
+ #include <google/protobuf/stubs/port.h>
56
+
57
+ namespace google {
58
+ namespace protobuf {
59
+
60
+ class Arena; // defined below
61
+ class Message; // message.h
62
+
63
+ namespace internal {
64
+ struct ArenaStringPtr; // arenastring.h
65
+ class LazyField; // lazy_field.h
66
+
67
+ template<typename Type>
68
+ class GenericTypeHandler; // repeated_field.h
69
+
70
+ // Templated cleanup methods.
71
+ template<typename T> void arena_destruct_object(void* object) {
72
+ reinterpret_cast<T*>(object)->~T();
73
+ }
74
+ template<typename T> void arena_delete_object(void* object) {
75
+ delete reinterpret_cast<T*>(object);
76
+ }
77
+ inline void arena_free(void* object, size_t size) {
78
+ #if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
79
+ ::operator delete(object, size);
80
+ #else
81
+ (void)size;
82
+ ::operator delete(object);
83
+ #endif
84
+ }
85
+
86
+ } // namespace internal
87
+
88
+ // ArenaOptions provides optional additional parameters to arena construction
89
+ // that control its block-allocation behavior.
90
+ struct ArenaOptions {
91
+ // This defines the size of the first block requested from the system malloc.
92
+ // Subsequent block sizes will increase in a geometric series up to a maximum.
93
+ size_t start_block_size;
94
+
95
+ // This defines the maximum block size requested from system malloc (unless an
96
+ // individual arena allocation request occurs with a size larger than this
97
+ // maximum). Requested block sizes increase up to this value, then remain
98
+ // here.
99
+ size_t max_block_size;
100
+
101
+ // An initial block of memory for the arena to use, or NULL for none. If
102
+ // provided, the block must live at least as long as the arena itself. The
103
+ // creator of the Arena retains ownership of the block after the Arena is
104
+ // destroyed.
105
+ char* initial_block;
106
+
107
+ // The size of the initial block, if provided.
108
+ size_t initial_block_size;
109
+
110
+ // A function pointer to an alloc method that returns memory blocks of size
111
+ // requested. By default, it contains a ptr to the malloc function.
112
+ //
113
+ // NOTE: block_alloc and dealloc functions are expected to behave like
114
+ // malloc and free, including Asan poisoning.
115
+ void* (*block_alloc)(size_t);
116
+ // A function pointer to a dealloc method that takes ownership of the blocks
117
+ // from the arena. By default, it contains a ptr to a wrapper function that
118
+ // calls free.
119
+ void (*block_dealloc)(void*, size_t);
120
+ // Hooks for adding external functionality such as user-specific metrics
121
+ // collection, specific debugging abilities, etc.
122
+ // Init hook may return a pointer to a cookie to be stored in the arena.
123
+ // reset and destruction hooks will then be called with the same cookie
124
+ // pointer. This allows us to save an external object per arena instance and
125
+ // use it on the other hooks (Note: It is just as legal for init to return
126
+ // NULL and not use the cookie feature).
127
+ // on_arena_reset and on_arena_destruction also receive the space used in
128
+ // the arena just before the reset.
129
+ void* (*on_arena_init)(Arena* arena);
130
+ void (*on_arena_reset)(Arena* arena, void* cookie, uint64 space_used);
131
+ void (*on_arena_destruction)(Arena* arena, void* cookie, uint64 space_used);
132
+
133
+ // type_info is promised to be static - its lifetime extends to
134
+ // match program's lifetime (It is given by typeid operator).
135
+ // Note: typeid(void) will be passed as allocated_type every time we
136
+ // intentionally want to avoid monitoring an allocation. (i.e. internal
137
+ // allocations for managing the arena)
138
+ void (*on_arena_allocation)(const std::type_info* allocated_type,
139
+ uint64 alloc_size, void* cookie);
140
+
141
+ ArenaOptions()
142
+ : start_block_size(kDefaultStartBlockSize),
143
+ max_block_size(kDefaultMaxBlockSize),
144
+ initial_block(NULL),
145
+ initial_block_size(0),
146
+ block_alloc(&::operator new),
147
+ block_dealloc(&internal::arena_free),
148
+ on_arena_init(NULL),
149
+ on_arena_reset(NULL),
150
+ on_arena_destruction(NULL),
151
+ on_arena_allocation(NULL) {}
152
+
153
+ private:
154
+ // Constants define default starting block size and max block size for
155
+ // arena allocator behavior -- see descriptions above.
156
+ static const size_t kDefaultStartBlockSize = 256;
157
+ static const size_t kDefaultMaxBlockSize = 8192;
158
+ };
159
+
160
+ // Support for non-RTTI environments. (The metrics hooks API uses type
161
+ // information.)
162
+ #ifndef GOOGLE_PROTOBUF_NO_RTTI
163
+ #define RTTI_TYPE_ID(type) (&typeid(type))
164
+ #else
165
+ #define RTTI_TYPE_ID(type) (NULL)
166
+ #endif
167
+
168
+ // Arena allocator. Arena allocation replaces ordinary (heap-based) allocation
169
+ // with new/delete, and improves performance by aggregating allocations into
170
+ // larger blocks and freeing allocations all at once. Protocol messages are
171
+ // allocated on an arena by using Arena::CreateMessage<T>(Arena*), below, and
172
+ // are automatically freed when the arena is destroyed.
173
+ //
174
+ // This is a thread-safe implementation: multiple threads may allocate from the
175
+ // arena concurrently. Destruction is not thread-safe and the destructing
176
+ // thread must synchronize with users of the arena first.
177
+ //
178
+ // An arena provides two allocation interfaces: CreateMessage<T>, which works
179
+ // for arena-enabled proto2 message types as well as other types that satisfy
180
+ // the appropriate protocol (described below), and Create<T>, which works for
181
+ // any arbitrary type T. CreateMessage<T> is better when the type T supports it,
182
+ // because this interface (i) passes the arena pointer to the created object so
183
+ // that its sub-objects and internal allocations can use the arena too, and (ii)
184
+ // elides the object's destructor call when possible. Create<T> does not place
185
+ // any special requirements on the type T, and will invoke the object's
186
+ // destructor when the arena is destroyed.
187
+ //
188
+ // The arena message allocation protocol, required by CreateMessage<T>, is as
189
+ // follows:
190
+ //
191
+ // - The type T must have (at least) two constructors: a constructor with no
192
+ // arguments, called when a T is allocated on the heap; and a constructor with
193
+ // a google::protobuf::Arena* argument, called when a T is allocated on an arena. If the
194
+ // second constructor is called with a NULL arena pointer, it must be
195
+ // equivalent to invoking the first (no-argument) constructor.
196
+ //
197
+ // - The type T must have a particular type trait: a nested type
198
+ // |InternalArenaConstructable_|. This is usually a typedef to |void|. If no
199
+ // such type trait exists, then the instantiation CreateMessage<T> will fail
200
+ // to compile.
201
+ //
202
+ // - The type T *may* have the type trait |DestructorSkippable_|. If this type
203
+ // trait is present in the type, then its destructor will not be called if and
204
+ // only if it was passed a non-NULL arena pointer. If this type trait is not
205
+ // present on the type, then its destructor is always called when the
206
+ // containing arena is destroyed.
207
+ //
208
+ // - One- and two-user-argument forms of CreateMessage<T>() also exist that
209
+ // forward these constructor arguments to T's constructor: for example,
210
+ // CreateMessage<T>(Arena*, arg1, arg2) forwards to a constructor T(Arena*,
211
+ // arg1, arg2).
212
+ //
213
+ // This protocol is implemented by all arena-enabled proto2 message classes as
214
+ // well as RepeatedPtrField.
215
+ //
216
+ // Do NOT subclass Arena. This class will be marked as final when C++11 is
217
+ // enabled.
218
+ class LIBPROTOBUF_EXPORT Arena {
219
+ public:
220
+ // Arena constructor taking custom options. See ArenaOptions below for
221
+ // descriptions of the options available.
222
+ explicit Arena(const ArenaOptions& options) : impl_(options) {
223
+ Init(options);
224
+ }
225
+
226
+ // Block overhead. Use this as a guide for how much to over-allocate the
227
+ // initial block if you want an allocation of size N to fit inside it.
228
+ //
229
+ // WARNING: if you allocate multiple objects, it is difficult to guarantee
230
+ // that a series of allocations will fit in the initial block, especially if
231
+ // Arena changes its alignment guarantees in the future!
232
+ static const size_t kBlockOverhead = internal::ArenaImpl::kHeaderSize;
233
+
234
+ // Default constructor with sensible default options, tuned for average
235
+ // use-cases.
236
+ Arena() : impl_(ArenaOptions()) { Init(ArenaOptions()); }
237
+
238
+ ~Arena() {
239
+ if (on_arena_reset_ != NULL || on_arena_destruction_ != NULL) {
240
+ CallDestructorHooks();
241
+ }
242
+ }
243
+
244
+ void Init(const ArenaOptions& options) {
245
+ on_arena_allocation_ = options.on_arena_allocation;
246
+ on_arena_reset_ = options.on_arena_reset;
247
+ on_arena_destruction_ = options.on_arena_destruction;
248
+ // Call the initialization hook
249
+ if (options.on_arena_init != NULL) {
250
+ hooks_cookie_ = options.on_arena_init(this);
251
+ } else {
252
+ hooks_cookie_ = NULL;
253
+ }
254
+ }
255
+
256
+ // API to create proto2 message objects on the arena. If the arena passed in
257
+ // is NULL, then a heap allocated object is returned. Type T must be a message
258
+ // defined in a .proto file with cc_enable_arenas set to true, otherwise a
259
+ // compilation error will occur.
260
+ //
261
+ // RepeatedField and RepeatedPtrField may also be instantiated directly on an
262
+ // arena with this method.
263
+ //
264
+ // This function also accepts any type T that satisfies the arena message
265
+ // allocation protocol, documented above.
266
+ #if LANG_CXX11
267
+ template <typename T, typename... Args>
268
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateMessage(
269
+ ::google::protobuf::Arena* arena, Args&&... args) {
270
+ static_assert(
271
+ InternalHelper<T>::is_arena_constructable::value,
272
+ "CreateMessage can only construct types that are ArenaConstructable");
273
+ if (arena == NULL) {
274
+ return new T(NULL, std::forward<Args>(args)...);
275
+ } else {
276
+ return arena->CreateMessageInternal<T>(std::forward<Args>(args)...);
277
+ }
278
+ }
279
+ #endif
280
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
281
+ static T* CreateMessage(::google::protobuf::Arena* arena) {
282
+ #if LANG_CXX11
283
+ static_assert(
284
+ InternalHelper<T>::is_arena_constructable::value,
285
+ "CreateMessage can only construct types that are ArenaConstructable");
286
+ #endif
287
+ if (arena == NULL) {
288
+ return new T;
289
+ } else {
290
+ return arena->CreateMessageInternal<T>();
291
+ }
292
+ }
293
+
294
+ // One-argument form of CreateMessage. This is useful for constructing objects
295
+ // that implement the arena message construction protocol described above but
296
+ // take additional constructor arguments.
297
+ template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
298
+ static T* CreateMessage(::google::protobuf::Arena* arena, const Arg& arg) {
299
+ #if LANG_CXX11
300
+ static_assert(
301
+ InternalHelper<T>::is_arena_constructable::value,
302
+ "CreateMessage can only construct types that are ArenaConstructable");
303
+ #endif
304
+ if (arena == NULL) {
305
+ return new T(NULL, arg);
306
+ } else {
307
+ return arena->CreateMessageInternal<T>(arg);
308
+ }
309
+ }
310
+
311
+ // Two-argument form of CreateMessage. This is useful for constructing objects
312
+ // that implement the arena message construction protocol described above but
313
+ // take additional constructor arguments.
314
+ template <typename T, typename Arg1, typename Arg2>
315
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
316
+ static T* CreateMessage(::google::protobuf::Arena* arena,
317
+ const Arg1& arg1,
318
+ const Arg2& arg2) {
319
+ #if LANG_CXX11
320
+ static_assert(
321
+ InternalHelper<T>::is_arena_constructable::value,
322
+ "CreateMessage can only construct types that are ArenaConstructable");
323
+ #endif
324
+ if (arena == NULL) {
325
+ return new T(NULL, arg1, arg2);
326
+ } else {
327
+ return arena->CreateMessageInternal<T>(arg1, arg2);
328
+ }
329
+ }
330
+
331
+ // API to create any objects on the arena. Note that only the object will
332
+ // be created on the arena; the underlying ptrs (in case of a proto2 message)
333
+ // will be still heap allocated. Proto messages should usually be allocated
334
+ // with CreateMessage<T>() instead.
335
+ //
336
+ // Note that even if T satisfies the arena message construction protocol
337
+ // (InternalArenaConstructable_ trait and optional DestructorSkippable_
338
+ // trait), as described above, this function does not follow the protocol;
339
+ // instead, it treats T as a black-box type, just as if it did not have these
340
+ // traits. Specifically, T's constructor arguments will always be only those
341
+ // passed to Create<T>() -- no additional arena pointer is implicitly added.
342
+ // Furthermore, the destructor will always be called at arena destruction time
343
+ // (unless the destructor is trivial). Hence, from T's point of view, it is as
344
+ // if the object were allocated on the heap (except that the underlying memory
345
+ // is obtained from the arena).
346
+ #if LANG_CXX11
347
+ template <typename T, typename... Args>
348
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
349
+ static T* Create(::google::protobuf::Arena* arena, Args&&... args) {
350
+ if (arena == NULL) {
351
+ return new T(std::forward<Args>(args)...);
352
+ } else {
353
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
354
+ std::forward<Args>(args)...);
355
+ }
356
+ }
357
+ #endif
358
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
359
+ static T* Create(::google::protobuf::Arena* arena) {
360
+ if (arena == NULL) {
361
+ return new T();
362
+ } else {
363
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value);
364
+ }
365
+ }
366
+
367
+ // Version of the above with one constructor argument for the created object.
368
+ template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
369
+ static T* Create(::google::protobuf::Arena* arena, const Arg& arg) {
370
+ if (arena == NULL) {
371
+ return new T(arg);
372
+ } else {
373
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
374
+ arg);
375
+ }
376
+ }
377
+
378
+ // Version of the above with two constructor arguments for the created object.
379
+ template <typename T, typename Arg1, typename Arg2>
380
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
381
+ static T* Create(::google::protobuf::Arena* arena, const Arg1& arg1, const Arg2& arg2) {
382
+ if (arena == NULL) {
383
+ return new T(arg1, arg2);
384
+ } else {
385
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
386
+ arg1, arg2);
387
+ }
388
+ }
389
+
390
+ // Version of the above with three constructor arguments for the created
391
+ // object.
392
+ template <typename T, typename Arg1, typename Arg2, typename Arg3>
393
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
394
+ static T* Create(::google::protobuf::Arena* arena,
395
+ const Arg1& arg1,
396
+ const Arg2& arg2,
397
+ const Arg3& arg3) {
398
+ if (arena == NULL) {
399
+ return new T(arg1, arg2, arg3);
400
+ } else {
401
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
402
+ arg1, arg2, arg3);
403
+ }
404
+ }
405
+
406
+ // Version of the above with four constructor arguments for the created
407
+ // object.
408
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
409
+ typename Arg4>
410
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
411
+ static T* Create(::google::protobuf::Arena* arena,
412
+ const Arg1& arg1, const Arg2& arg2,
413
+ const Arg3& arg3, const Arg4& arg4) {
414
+ if (arena == NULL) {
415
+ return new T(arg1, arg2, arg3, arg4);
416
+ } else {
417
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
418
+ arg1, arg2, arg3, arg4);
419
+ }
420
+ }
421
+
422
+ // Version of the above with five constructor arguments for the created
423
+ // object.
424
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
425
+ typename Arg4, typename Arg5>
426
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
427
+ static T* Create(::google::protobuf::Arena* arena,
428
+ const Arg1& arg1, const Arg2& arg2,
429
+ const Arg3& arg3, const Arg4& arg4,
430
+ const Arg5& arg5) {
431
+ if (arena == NULL) {
432
+ return new T(arg1, arg2, arg3, arg4, arg5);
433
+ } else {
434
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
435
+ arg1, arg2, arg3, arg4, arg5);
436
+ }
437
+ }
438
+
439
+ // Version of the above with six constructor arguments for the created
440
+ // object.
441
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
442
+ typename Arg4, typename Arg5, typename Arg6>
443
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
444
+ static T* Create(::google::protobuf::Arena* arena,
445
+ const Arg1& arg1, const Arg2& arg2,
446
+ const Arg3& arg3, const Arg4& arg4,
447
+ const Arg5& arg5, const Arg6& arg6) {
448
+ if (arena == NULL) {
449
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6);
450
+ } else {
451
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
452
+ arg1, arg2, arg3, arg4, arg5, arg6);
453
+ }
454
+ }
455
+
456
+ // Version of the above with seven constructor arguments for the created
457
+ // object.
458
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
459
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7>
460
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
461
+ static T* Create(::google::protobuf::Arena* arena,
462
+ const Arg1& arg1, const Arg2& arg2,
463
+ const Arg3& arg3, const Arg4& arg4,
464
+ const Arg5& arg5, const Arg6& arg6,
465
+ const Arg7& arg7) {
466
+ if (arena == NULL) {
467
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
468
+ } else {
469
+ return arena->CreateInternal<T>(google::protobuf::internal::has_trivial_destructor<T>::value,
470
+ arg1, arg2, arg3, arg4, arg5, arg6, arg7);
471
+ }
472
+ }
473
+
474
+ // Version of the above with eight constructor arguments for the created
475
+ // object.
476
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
477
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7,
478
+ typename Arg8>
479
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
480
+ static T* Create(::google::protobuf::Arena* arena,
481
+ const Arg1& arg1, const Arg2& arg2,
482
+ const Arg3& arg3, const Arg4& arg4,
483
+ const Arg5& arg5, const Arg6& arg6,
484
+ const Arg7& arg7, const Arg8& arg8) {
485
+ if (arena == NULL) {
486
+ return new T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
487
+ } else {
488
+ return arena->CreateInternal<T>(
489
+ google::protobuf::internal::has_trivial_destructor<T>::value,
490
+ arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
491
+ }
492
+ }
493
+
494
+ // Create an array of object type T on the arena *without* invoking the
495
+ // constructor of T. If `arena` is null, then the return value should be freed
496
+ // with `delete[] x;` (or `::operator delete[](x);`).
497
+ // To ensure safe uses, this function checks at compile time
498
+ // (when compiled as C++11) that T is trivially default-constructible and
499
+ // trivially destructible.
500
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
501
+ static T* CreateArray(::google::protobuf::Arena* arena, size_t num_elements) {
502
+ GOOGLE_CHECK_LE(num_elements,
503
+ std::numeric_limits<size_t>::max() / sizeof(T))
504
+ << "Requested size is too large to fit into size_t.";
505
+ if (arena == NULL) {
506
+ return static_cast<T*>(::operator new[](num_elements * sizeof(T)));
507
+ } else {
508
+ return arena->CreateInternalRawArray<T>(num_elements);
509
+ }
510
+ }
511
+
512
+ // Returns the total space allocated by the arena, which is the sum of the
513
+ // sizes of the underlying blocks. This method is relatively fast; a counter
514
+ // is kept as blocks are allocated.
515
+ uint64 SpaceAllocated() const { return impl_.SpaceAllocated(); }
516
+ // Returns the total space used by the arena. Similar to SpaceAllocated but
517
+ // does not include free space and block overhead. The total space returned
518
+ // may not include space used by other threads executing concurrently with
519
+ // the call to this method.
520
+ uint64 SpaceUsed() const { return impl_.SpaceUsed(); }
521
+ // DEPRECATED. Please use SpaceAllocated() and SpaceUsed().
522
+ //
523
+ // Combines SpaceAllocated and SpaceUsed. Returns a pair of
524
+ // <space_allocated, space_used>.
525
+ std::pair<uint64, uint64> SpaceAllocatedAndUsed() const {
526
+ return std::make_pair(SpaceAllocated(), SpaceUsed());
527
+ }
528
+
529
+ // Frees all storage allocated by this arena after calling destructors
530
+ // registered with OwnDestructor() and freeing objects registered with Own().
531
+ // Any objects allocated on this arena are unusable after this call. It also
532
+ // returns the total space used by the arena which is the sums of the sizes
533
+ // of the allocated blocks. This method is not thread-safe.
534
+ GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE uint64 Reset() {
535
+ // Call the reset hook
536
+ if (on_arena_reset_ != NULL) {
537
+ on_arena_reset_(this, hooks_cookie_, impl_.SpaceAllocated());
538
+ }
539
+ return impl_.Reset();
540
+ }
541
+
542
+ // Adds |object| to a list of heap-allocated objects to be freed with |delete|
543
+ // when the arena is destroyed or reset.
544
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
545
+ void Own(T* object) {
546
+ OwnInternal(object, google::protobuf::internal::is_convertible<T*, ::google::protobuf::Message*>());
547
+ }
548
+
549
+ // Adds |object| to a list of objects whose destructors will be manually
550
+ // called when the arena is destroyed or reset. This differs from Own() in
551
+ // that it does not free the underlying memory with |delete|; hence, it is
552
+ // normally only used for objects that are placement-newed into
553
+ // arena-allocated memory.
554
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
555
+ void OwnDestructor(T* object) {
556
+ if (object != NULL) {
557
+ impl_.AddCleanup(object, &internal::arena_destruct_object<T>);
558
+ }
559
+ }
560
+
561
+ // Adds a custom member function on an object to the list of destructors that
562
+ // will be manually called when the arena is destroyed or reset. This differs
563
+ // from OwnDestructor() in that any member function may be specified, not only
564
+ // the class destructor.
565
+ GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE void OwnCustomDestructor(
566
+ void* object, void (*destruct)(void*)) {
567
+ impl_.AddCleanup(object, destruct);
568
+ }
569
+
570
+ // Retrieves the arena associated with |value| if |value| is an arena-capable
571
+ // message, or NULL otherwise. This differs from value->GetArena() in that the
572
+ // latter is a virtual call, while this method is a templated call that
573
+ // resolves at compile-time.
574
+ template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
575
+ static ::google::protobuf::Arena* GetArena(const T* value) {
576
+ return GetArenaInternal(value, is_arena_constructable<T>());
577
+ }
578
+
579
+ template <typename T>
580
+ class InternalHelper {
581
+ template <typename U>
582
+ static char DestructorSkippable(const typename U::DestructorSkippable_*);
583
+ template <typename U>
584
+ static double DestructorSkippable(...);
585
+
586
+ typedef google::protobuf::internal::integral_constant<
587
+ bool, sizeof(DestructorSkippable<T>(static_cast<const T*>(0))) ==
588
+ sizeof(char) ||
589
+ google::protobuf::internal::has_trivial_destructor<T>::value>
590
+ is_destructor_skippable;
591
+
592
+ template<typename U>
593
+ static char ArenaConstructable(
594
+ const typename U::InternalArenaConstructable_*);
595
+ template<typename U>
596
+ static double ArenaConstructable(...);
597
+
598
+ typedef google::protobuf::internal::integral_constant<bool, sizeof(ArenaConstructable<T>(
599
+ static_cast<const T*>(0))) ==
600
+ sizeof(char)>
601
+ is_arena_constructable;
602
+
603
+ #if LANG_CXX11
604
+ template <typename... Args>
605
+ static T* Construct(void* ptr, Args&&... args) {
606
+ return new (ptr) T(std::forward<Args>(args)...);
607
+ }
608
+ #else
609
+ template <typename Arg1>
610
+ static T* Construct(void* ptr, const Arg1& arg1) {
611
+ return new (ptr) T(arg1);
612
+ }
613
+ template <typename Arg1, typename Arg2>
614
+ static T* Construct(void* ptr, const Arg1& arg1, const Arg2& arg2) {
615
+ return new (ptr) T(arg1, arg2);
616
+ }
617
+ template <typename Arg1, typename Arg2, typename Arg3>
618
+ static T* Construct(void* ptr, const Arg1& arg1,
619
+ const Arg2& arg2, const Arg3& arg3) {
620
+ return new (ptr) T(arg1, arg2, arg3);
621
+ }
622
+ #endif // LANG_CXX11
623
+
624
+ static Arena* GetArena(const T* p) { return p->GetArenaNoVirtual(); }
625
+
626
+ friend class Arena;
627
+ };
628
+
629
+ // Helper typetrait that indicates support for arenas in a type T at compile
630
+ // time. This is public only to allow construction of higher-level templated
631
+ // utilities. is_arena_constructable<T>::value is true if the message type T
632
+ // has arena support enabled, and false otherwise.
633
+ //
634
+ // This is inside Arena because only Arena has the friend relationships
635
+ // necessary to see the underlying generated code traits.
636
+ template <typename T>
637
+ struct is_arena_constructable : InternalHelper<T>::is_arena_constructable {};
638
+
639
+ private:
640
+ void CallDestructorHooks();
641
+ void OnArenaAllocation(const std::type_info* allocated_type, size_t n) const;
642
+ inline void AllocHook(const std::type_info* allocated_type, size_t n) const {
643
+ if (GOOGLE_PREDICT_FALSE(hooks_cookie_ != NULL)) {
644
+ OnArenaAllocation(allocated_type, n);
645
+ }
646
+ }
647
+
648
+ // Allocate and also optionally call on_arena_allocation callback with the
649
+ // allocated type info when the hooks are in place in ArenaOptions and
650
+ // the cookie is not null.
651
+ template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
652
+ void* AllocateInternal(bool skip_explicit_ownership) {
653
+ const size_t n = internal::AlignUpTo8(sizeof(T));
654
+ AllocHook(RTTI_TYPE_ID(T), n);
655
+ // Monitor allocation if needed.
656
+ if (skip_explicit_ownership) {
657
+ return impl_.AllocateAligned(n);
658
+ } else {
659
+ return impl_.AllocateAlignedAndAddCleanup(
660
+ n, &internal::arena_destruct_object<T>);
661
+ }
662
+ }
663
+
664
+ // CreateMessage<T> requires that T supports arenas, but this private method
665
+ // works whether or not T supports arenas. These are not exposed to user code
666
+ // as it can cause confusing API usages, and end up having double free in
667
+ // user code. These are used only internally from LazyField and Repeated
668
+ // fields, since they are designed to work in all mode combinations.
669
+ template <typename Msg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
670
+ static Msg* CreateMaybeMessage(Arena* arena, google::protobuf::internal::true_type) {
671
+ return CreateMessage<Msg>(arena);
672
+ }
673
+
674
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
675
+ static T* CreateMaybeMessage(Arena* arena, google::protobuf::internal::false_type) {
676
+ return Create<T>(arena);
677
+ }
678
+
679
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
680
+ static T* CreateMaybeMessage(Arena* arena) {
681
+ return CreateMaybeMessage<T>(arena, is_arena_constructable<T>());
682
+ }
683
+
684
+ // Just allocate the required size for the given type assuming the
685
+ // type has a trivial constructor.
686
+ template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
687
+ T* CreateInternalRawArray(size_t num_elements) {
688
+ GOOGLE_CHECK_LE(num_elements,
689
+ std::numeric_limits<size_t>::max() / sizeof(T))
690
+ << "Requested size is too large to fit into size_t.";
691
+ const size_t n = internal::AlignUpTo8(sizeof(T) * num_elements);
692
+ // Monitor allocation if needed.
693
+ AllocHook(RTTI_TYPE_ID(T), n);
694
+ return static_cast<T*>(impl_.AllocateAligned(n));
695
+ }
696
+
697
+ #if LANG_CXX11
698
+ template <typename T, typename... Args>
699
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
700
+ T* CreateInternal(bool skip_explicit_ownership, Args&&... args) {
701
+ return new (AllocateInternal<T>(skip_explicit_ownership))
702
+ T(std::forward<Args>(args)...);
703
+ }
704
+ #else
705
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
706
+ T* CreateInternal(bool skip_explicit_ownership) {
707
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T();
708
+ }
709
+
710
+ template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
711
+ T* CreateInternal(bool skip_explicit_ownership, const Arg& arg) {
712
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg);
713
+ }
714
+
715
+ template <typename T, typename Arg1, typename Arg2>
716
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
717
+ T* CreateInternal(bool skip_explicit_ownership,
718
+ const Arg1& arg1,
719
+ const Arg2& arg2) {
720
+ return new (AllocateInternal<T>(skip_explicit_ownership)) T(arg1, arg2);
721
+ }
722
+
723
+ template <typename T, typename Arg1, typename Arg2, typename Arg3>
724
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
725
+ T* CreateInternal(bool skip_explicit_ownership,
726
+ const Arg1& arg1,
727
+ const Arg2& arg2,
728
+ const Arg3& arg3) {
729
+ return new (AllocateInternal<T>(skip_explicit_ownership))
730
+ T(arg1, arg2, arg3);
731
+ }
732
+
733
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
734
+ typename Arg4>
735
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
736
+ T* CreateInternal(bool skip_explicit_ownership,
737
+ const Arg1& arg1,
738
+ const Arg2& arg2,
739
+ const Arg3& arg3,
740
+ const Arg4& arg4) {
741
+ return new (AllocateInternal<T>(skip_explicit_ownership))
742
+ T(arg1, arg2, arg3, arg4);
743
+ }
744
+
745
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
746
+ typename Arg4, typename Arg5>
747
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
748
+ T* CreateInternal(bool skip_explicit_ownership,
749
+ const Arg1& arg1,
750
+ const Arg2& arg2,
751
+ const Arg3& arg3,
752
+ const Arg4& arg4,
753
+ const Arg5& arg5) {
754
+ return new (AllocateInternal<T>(skip_explicit_ownership))
755
+ T(arg1, arg2, arg3, arg4, arg5);
756
+ }
757
+
758
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
759
+ typename Arg4, typename Arg5, typename Arg6>
760
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
761
+ T* CreateInternal(bool skip_explicit_ownership,
762
+ const Arg1& arg1,
763
+ const Arg2& arg2,
764
+ const Arg3& arg3,
765
+ const Arg4& arg4,
766
+ const Arg5& arg5,
767
+ const Arg6& arg6) {
768
+ return new (AllocateInternal<T>(skip_explicit_ownership))
769
+ T(arg1, arg2, arg3, arg4, arg5, arg6);
770
+ }
771
+
772
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
773
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7>
774
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
775
+ T* CreateInternal(bool skip_explicit_ownership,
776
+ const Arg1& arg1,
777
+ const Arg2& arg2,
778
+ const Arg3& arg3,
779
+ const Arg4& arg4,
780
+ const Arg5& arg5,
781
+ const Arg6& arg6,
782
+ const Arg7& arg7) {
783
+ return new (AllocateInternal<T>(skip_explicit_ownership))
784
+ T(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
785
+ }
786
+
787
+ template <typename T, typename Arg1, typename Arg2, typename Arg3,
788
+ typename Arg4, typename Arg5, typename Arg6, typename Arg7,
789
+ typename Arg8>
790
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
791
+ T* CreateInternal(bool skip_explicit_ownership,
792
+ const Arg1& arg1,
793
+ const Arg2& arg2,
794
+ const Arg3& arg3,
795
+ const Arg4& arg4,
796
+ const Arg5& arg5,
797
+ const Arg6& arg6,
798
+ const Arg7& arg7,
799
+ const Arg8& arg8) {
800
+ return new (AllocateInternal<T>(skip_explicit_ownership))
801
+ T(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
802
+ }
803
+ #endif
804
+ #if LANG_CXX11
805
+ template <typename T, typename... Args>
806
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal(
807
+ Args&&... args) {
808
+ return InternalHelper<T>::Construct(
809
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
810
+ this, std::forward<Args>(args)...);
811
+ }
812
+ #endif
813
+ template <typename T>
814
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE T* CreateMessageInternal() {
815
+ return InternalHelper<T>::Construct(
816
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
817
+ this);
818
+ }
819
+
820
+ template <typename T, typename Arg> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
821
+ T* CreateMessageInternal(const Arg& arg) {
822
+ return InternalHelper<T>::Construct(
823
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
824
+ this, arg);
825
+ }
826
+
827
+ template <typename T, typename Arg1, typename Arg2>
828
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
829
+ T* CreateMessageInternal(const Arg1& arg1, const Arg2& arg2) {
830
+ return InternalHelper<T>::Construct(
831
+ AllocateInternal<T>(InternalHelper<T>::is_destructor_skippable::value),
832
+ this, arg1, arg2);
833
+ }
834
+
835
+ // CreateInArenaStorage is used to implement map field. Without it,
836
+ // google::protobuf::Map need to call generated message's protected arena constructor,
837
+ // which needs to declare google::protobuf::Map as friend of generated message.
838
+ template <typename T>
839
+ static void CreateInArenaStorage(T* ptr, Arena* arena) {
840
+ CreateInArenaStorageInternal(ptr, arena,
841
+ typename is_arena_constructable<T>::type());
842
+ RegisterDestructorInternal(
843
+ ptr, arena,
844
+ typename InternalHelper<T>::is_destructor_skippable::type());
845
+ }
846
+
847
+ template <typename T>
848
+ static void CreateInArenaStorageInternal(
849
+ T* ptr, Arena* arena, google::protobuf::internal::true_type) {
850
+ InternalHelper<T>::Construct(ptr, arena);
851
+ }
852
+ template <typename T>
853
+ static void CreateInArenaStorageInternal(
854
+ T* ptr, Arena* /* arena */, google::protobuf::internal::false_type) {
855
+ new (ptr) T();
856
+ }
857
+
858
+ template <typename T>
859
+ static void RegisterDestructorInternal(
860
+ T* /* ptr */, Arena* /* arena */, google::protobuf::internal::true_type) {}
861
+ template <typename T>
862
+ static void RegisterDestructorInternal(
863
+ T* ptr, Arena* arena, google::protobuf::internal::false_type) {
864
+ arena->OwnDestructor(ptr);
865
+ }
866
+
867
+ // These implement Own(), which registers an object for deletion (destructor
868
+ // call and operator delete()). The second parameter has type 'true_type' if T
869
+ // is a subtype of ::google::protobuf::Message and 'false_type' otherwise. Collapsing
870
+ // all template instantiations to one for generic Message reduces code size,
871
+ // using the virtual destructor instead.
872
+ template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
873
+ void OwnInternal(T* object, google::protobuf::internal::true_type) {
874
+ if (object != NULL) {
875
+ impl_.AddCleanup(object,
876
+ &internal::arena_delete_object< ::google::protobuf::Message>);
877
+ }
878
+ }
879
+ template<typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
880
+ void OwnInternal(T* object, google::protobuf::internal::false_type) {
881
+ if (object != NULL) {
882
+ impl_.AddCleanup(object, &internal::arena_delete_object<T>);
883
+ }
884
+ }
885
+
886
+ // Implementation for GetArena(). Only message objects with
887
+ // InternalArenaConstructable_ tags can be associated with an arena, and such
888
+ // objects must implement a GetArenaNoVirtual() method.
889
+ template <typename T> GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
890
+ static ::google::protobuf::Arena* GetArenaInternal(
891
+ const T* value, google::protobuf::internal::true_type) {
892
+ return InternalHelper<T>::GetArena(value);
893
+ }
894
+
895
+ template <typename T>
896
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
897
+ static ::google::protobuf::Arena* GetArenaInternal(
898
+ const T* /* value */, google::protobuf::internal::false_type) {
899
+ return NULL;
900
+ }
901
+
902
+ // For friends of arena.
903
+ void* AllocateAligned(size_t n) {
904
+ AllocHook(NULL, n);
905
+ return impl_.AllocateAligned(internal::AlignUpTo8(n));
906
+ }
907
+
908
+ internal::ArenaImpl impl_;
909
+
910
+ void* (*on_arena_init_)(Arena* arena);
911
+ void (*on_arena_allocation_)(const std::type_info* allocated_type,
912
+ uint64 alloc_size, void* cookie);
913
+ void (*on_arena_reset_)(Arena* arena, void* cookie, uint64 space_used);
914
+ void (*on_arena_destruction_)(Arena* arena, void* cookie, uint64 space_used);
915
+
916
+ // The arena may save a cookie it receives from the external on_init hook
917
+ // and then use it when calling the on_reset and on_destruction hooks.
918
+ void* hooks_cookie_;
919
+
920
+ template <typename Type>
921
+ friend class ::google::protobuf::internal::GenericTypeHandler;
922
+ friend struct internal::ArenaStringPtr; // For AllocateAligned.
923
+ friend class internal::LazyField; // For CreateMaybeMessage.
924
+ template <typename Key, typename T>
925
+ friend class Map;
926
+ };
927
+
928
+ // Defined above for supporting environments without RTTI.
929
+ #undef RTTI_TYPE_ID
930
+
931
+ } // namespace protobuf
932
+
933
+ } // namespace google
934
+ #endif // GOOGLE_PROTOBUF_ARENA_H__
kortex_api/include/google/protobuf/arena_impl.h ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // This file defines an Arena allocator for better allocation performance.
32
+
33
+ #ifndef GOOGLE_PROTOBUF_ARENA_IMPL_H__
34
+ #define GOOGLE_PROTOBUF_ARENA_IMPL_H__
35
+
36
+ #include <limits>
37
+
38
+ #include <google/protobuf/stubs/atomic_sequence_num.h>
39
+ #include <google/protobuf/stubs/atomicops.h>
40
+ #include <google/protobuf/stubs/common.h>
41
+ #include <google/protobuf/stubs/logging.h>
42
+ #include <google/protobuf/stubs/mutex.h>
43
+ #include <google/protobuf/stubs/type_traits.h>
44
+
45
+ #include <google/protobuf/stubs/port.h>
46
+
47
+ namespace google {
48
+
49
+ namespace protobuf {
50
+ namespace internal {
51
+
52
+ inline size_t AlignUpTo8(size_t n) {
53
+ // Align n to next multiple of 8 (from Hacker's Delight, Chapter 3.)
54
+ return (n + 7) & -8;
55
+ }
56
+
57
+ // This class provides the core Arena memory allocation library. Different
58
+ // implementations only need to implement the public interface below.
59
+ // Arena is not a template type as that would only be useful if all protos
60
+ // in turn would be templates, which will/cannot happen. However separating
61
+ // the memory allocation part from the cruft of the API users expect we can
62
+ // use #ifdef the select the best implementation based on hardware / OS.
63
+ class LIBPROTOBUF_EXPORT ArenaImpl {
64
+ public:
65
+ struct Options {
66
+ size_t start_block_size;
67
+ size_t max_block_size;
68
+ char* initial_block;
69
+ size_t initial_block_size;
70
+ void* (*block_alloc)(size_t);
71
+ void (*block_dealloc)(void*, size_t);
72
+
73
+ template <typename O>
74
+ explicit Options(const O& options)
75
+ : start_block_size(options.start_block_size),
76
+ max_block_size(options.max_block_size),
77
+ initial_block(options.initial_block),
78
+ initial_block_size(options.initial_block_size),
79
+ block_alloc(options.block_alloc),
80
+ block_dealloc(options.block_dealloc) {}
81
+ };
82
+
83
+ template <typename O>
84
+ explicit ArenaImpl(const O& options) : options_(options) {
85
+ if (options_.initial_block != NULL && options_.initial_block_size > 0) {
86
+ GOOGLE_CHECK_GE(options_.initial_block_size, sizeof(Block))
87
+ << ": Initial block size too small for header.";
88
+ initial_block_ = reinterpret_cast<Block*>(options_.initial_block);
89
+ } else {
90
+ initial_block_ = NULL;
91
+ }
92
+
93
+ Init();
94
+ }
95
+
96
+ // Destructor deletes all owned heap allocated objects, and destructs objects
97
+ // that have non-trivial destructors, except for proto2 message objects whose
98
+ // destructors can be skipped. Also, frees all blocks except the initial block
99
+ // if it was passed in.
100
+ ~ArenaImpl();
101
+
102
+ uint64 Reset();
103
+
104
+ uint64 SpaceAllocated() const;
105
+ uint64 SpaceUsed() const;
106
+
107
+ void* AllocateAligned(size_t n);
108
+
109
+ void* AllocateAlignedAndAddCleanup(size_t n, void (*cleanup)(void*));
110
+
111
+ // Add object pointer and cleanup function pointer to the list.
112
+ void AddCleanup(void* elem, void (*cleanup)(void*));
113
+
114
+ private:
115
+ // Node contains the ptr of the object to be cleaned up and the associated
116
+ // cleanup function ptr.
117
+ struct CleanupNode {
118
+ void* elem; // Pointer to the object to be cleaned up.
119
+ void (*cleanup)(void*); // Function pointer to the destructor or deleter.
120
+ };
121
+
122
+ // Cleanup uses a chunked linked list, to reduce pointer chasing.
123
+ struct CleanupChunk {
124
+ static size_t SizeOf(size_t i) {
125
+ return sizeof(CleanupChunk) + (sizeof(CleanupNode) * (i - 1));
126
+ }
127
+ size_t len; // Number of elements currently present.
128
+ size_t size; // Total elements in the list.
129
+ CleanupChunk* next; // Next node in the list.
130
+ CleanupNode nodes[1]; // True length is |size|.
131
+ };
132
+
133
+ struct Block;
134
+
135
+ // Tracks per-thread info. ThreadInfos are kept in a linked list.
136
+ struct ThreadInfo {
137
+ void *owner; // &ThreadCache of this thread;
138
+ Block* head; // Head of linked list of blocks.
139
+ CleanupChunk* cleanup; // Head of cleanup list.
140
+ ThreadInfo* next; // Next ThreadInfo in this linked list.
141
+ };
142
+
143
+ // Blocks are variable length malloc-ed objects. The following structure
144
+ // describes the common header for all blocks.
145
+ struct Block {
146
+ void* owner; // &ThreadCache of thread that owns this block.
147
+ ThreadInfo* thread_info; // ThreadInfo of thread that owns this block.
148
+ Block* next; // Next block in arena (may have different owner)
149
+ // ((char*) &block) + pos is next available byte. It is always
150
+ // aligned at a multiple of 8 bytes.
151
+ size_t pos;
152
+ size_t size; // total size of the block.
153
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE
154
+ size_t avail() const { return size - pos; }
155
+ // data follows
156
+ };
157
+
158
+ struct ThreadCache {
159
+ #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
160
+ // If we are using the ThreadLocalStorage class to store the ThreadCache,
161
+ // then the ThreadCache's default constructor has to be responsible for
162
+ // initializing it.
163
+ ThreadCache() : last_lifecycle_id_seen(-1), last_block_used_(NULL) {}
164
+ #endif
165
+
166
+ // The ThreadCache is considered valid as long as this matches the
167
+ // lifecycle_id of the arena being used.
168
+ int64 last_lifecycle_id_seen;
169
+ Block* last_block_used_;
170
+ };
171
+ static google::protobuf::internal::SequenceNumber lifecycle_id_generator_;
172
+ #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
173
+ // Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custom thread
174
+ // local storage class we implemented.
175
+ // iOS also does not support the GOOGLE_THREAD_LOCAL keyword.
176
+ static ThreadCache& thread_cache();
177
+ #elif defined(PROTOBUF_USE_DLLS)
178
+ // Thread local variables cannot be exposed through DLL interface but we can
179
+ // wrap them in static functions.
180
+ static ThreadCache& thread_cache();
181
+ #else
182
+ static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_;
183
+ static ThreadCache& thread_cache() { return thread_cache_; }
184
+ #endif
185
+
186
+ void Init();
187
+
188
+ // Free all blocks and return the total space used which is the sums of sizes
189
+ // of the all the allocated blocks.
190
+ uint64 FreeBlocks();
191
+
192
+ void AddCleanupInBlock(Block* b, void* elem, void (*func)(void*));
193
+ CleanupChunk* ExpandCleanupList(CleanupChunk* cleanup, Block* b);
194
+ // Delete or Destruct all objects owned by the arena.
195
+ void CleanupList();
196
+
197
+ inline void CacheBlock(Block* block) {
198
+ thread_cache().last_block_used_ = block;
199
+ thread_cache().last_lifecycle_id_seen = lifecycle_id_;
200
+ // TODO(haberman): evaluate whether we would gain efficiency by getting rid
201
+ // of hint_. It's the only write we do to ArenaImpl in the allocation path,
202
+ // which will dirty the cache line.
203
+ google::protobuf::internal::Release_Store(&hint_, reinterpret_cast<google::protobuf::internal::AtomicWord>(block));
204
+ }
205
+
206
+ google::protobuf::internal::AtomicWord threads_; // Pointer to a linked list of ThreadInfo.
207
+ google::protobuf::internal::AtomicWord hint_; // Fast thread-local block access
208
+ google::protobuf::internal::AtomicWord space_allocated_; // Sum of sizes of all allocated blocks.
209
+
210
+ Block *initial_block_; // If non-NULL, points to the block that came from
211
+ // user data.
212
+
213
+ // Returns a block owned by this thread.
214
+ Block* GetBlock(size_t n);
215
+ Block* GetBlockSlow(void* me, Block* my_full_block, size_t n);
216
+ Block* NewBlock(void* me, Block* my_last_block, size_t min_bytes);
217
+ void InitBlock(Block* b, void *me, size_t size);
218
+ static void* AllocFromBlock(Block* b, size_t n);
219
+ ThreadInfo* NewThreadInfo(Block* b);
220
+ ThreadInfo* FindThreadInfo(void* me);
221
+ ThreadInfo* GetThreadInfo(void* me, size_t n);
222
+
223
+ int64 lifecycle_id_; // Unique for each arena. Changes on Reset().
224
+
225
+ Options options_;
226
+
227
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ArenaImpl);
228
+
229
+ public:
230
+ // kHeaderSize is sizeof(Block), aligned up to the nearest multiple of 8 to
231
+ // protect the invariant that pos is always at a multiple of 8.
232
+ static const size_t kHeaderSize = (sizeof(Block) + 7) & -8;
233
+ #if LANG_CXX11
234
+ static_assert(kHeaderSize % 8 == 0, "kHeaderSize must be a multiple of 8.");
235
+ #endif
236
+ };
237
+
238
+ } // namespace internal
239
+ } // namespace protobuf
240
+
241
+ } // namespace google
242
+ #endif // GOOGLE_PROTOBUF_ARENA_IMPL_H__
kortex_api/include/google/protobuf/arenastring.h ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_ARENASTRING_H__
32
+ #define GOOGLE_PROTOBUF_ARENASTRING_H__
33
+
34
+ #include <string>
35
+
36
+ #include <google/protobuf/arena.h>
37
+ #include <google/protobuf/stubs/common.h>
38
+ #include <google/protobuf/stubs/fastmem.h>
39
+ #include <google/protobuf/stubs/logging.h>
40
+ #include <google/protobuf/stubs/port.h>
41
+
42
+ // This is the implementation of arena string fields written for the open-source
43
+ // release. The ArenaStringPtr struct below is an internal implementation class
44
+ // and *should not be used* by user code. It is used to collect string
45
+ // operations together into one place and abstract away the underlying
46
+ // string-field pointer representation, so that (for example) an alternate
47
+ // implementation that knew more about ::std::string's internals could integrate more
48
+ // closely with the arena allocator.
49
+
50
+ namespace google {
51
+ namespace protobuf {
52
+ namespace internal {
53
+
54
+ struct LIBPROTOBUF_EXPORT ArenaStringPtr {
55
+ inline void Set(const ::std::string* default_value,
56
+ const ::std::string& value, ::google::protobuf::Arena* arena) {
57
+ if (ptr_ == default_value) {
58
+ CreateInstance(arena, &value);
59
+ } else {
60
+ *ptr_ = value;
61
+ }
62
+ }
63
+
64
+ inline void SetLite(const ::std::string* default_value,
65
+ const ::std::string& value,
66
+ ::google::protobuf::Arena* arena) {
67
+ Set(default_value, value, arena);
68
+ }
69
+
70
+ // Basic accessors.
71
+ inline const ::std::string& Get() const { return *ptr_; }
72
+
73
+ inline ::std::string* Mutable(const ::std::string* default_value,
74
+ ::google::protobuf::Arena* arena) {
75
+ if (ptr_ == default_value) {
76
+ CreateInstance(arena, default_value);
77
+ }
78
+ return ptr_;
79
+ }
80
+
81
+ // Release returns a ::std::string* instance that is heap-allocated and is not
82
+ // Own()'d by any arena. If the field was not set, it returns NULL. The caller
83
+ // retains ownership. Clears this field back to NULL state. Used to implement
84
+ // release_<field>() methods on generated classes.
85
+ inline ::std::string* Release(const ::std::string* default_value,
86
+ ::google::protobuf::Arena* arena) {
87
+ if (ptr_ == default_value) {
88
+ return NULL;
89
+ }
90
+ ::std::string* released = NULL;
91
+ if (arena != NULL) {
92
+ // ptr_ is owned by the arena.
93
+ released = new ::std::string;
94
+ released->swap(*ptr_);
95
+ } else {
96
+ released = ptr_;
97
+ }
98
+ ptr_ = const_cast< ::std::string* >(default_value);
99
+ return released;
100
+ }
101
+
102
+ // UnsafeArenaRelease returns a ::std::string*, but it may be arena-owned (i.e.
103
+ // have its destructor already registered) if arena != NULL. If the field was
104
+ // not set, this returns NULL. This method clears this field back to NULL
105
+ // state. Used to implement unsafe_arena_release_<field>() methods on
106
+ // generated classes.
107
+ inline ::std::string* UnsafeArenaRelease(const ::std::string* default_value,
108
+ ::google::protobuf::Arena* /* arena */) {
109
+ if (ptr_ == default_value) {
110
+ return NULL;
111
+ }
112
+ ::std::string* released = ptr_;
113
+ ptr_ = const_cast< ::std::string* >(default_value);
114
+ return released;
115
+ }
116
+
117
+ // Takes a string that is heap-allocated, and takes ownership. The string's
118
+ // destructor is registered with the arena. Used to implement
119
+ // set_allocated_<field> in generated classes.
120
+ inline void SetAllocated(const ::std::string* default_value,
121
+ ::std::string* value, ::google::protobuf::Arena* arena) {
122
+ if (arena == NULL && ptr_ != default_value) {
123
+ Destroy(default_value, arena);
124
+ }
125
+ if (value != NULL) {
126
+ ptr_ = value;
127
+ if (arena != NULL) {
128
+ arena->Own(value);
129
+ }
130
+ } else {
131
+ ptr_ = const_cast< ::std::string* >(default_value);
132
+ }
133
+ }
134
+
135
+ // Takes a string that has lifetime equal to the arena's lifetime. The arena
136
+ // must be non-null. It is safe only to pass this method a value returned by
137
+ // UnsafeArenaRelease() on another field of a message in the same arena. Used
138
+ // to implement unsafe_arena_set_allocated_<field> in generated classes.
139
+ inline void UnsafeArenaSetAllocated(const ::std::string* default_value,
140
+ ::std::string* value,
141
+ ::google::protobuf::Arena* /* arena */) {
142
+ if (value != NULL) {
143
+ ptr_ = value;
144
+ } else {
145
+ ptr_ = const_cast< ::std::string* >(default_value);
146
+ }
147
+ }
148
+
149
+ // Swaps internal pointers. Arena-safety semantics: this is guarded by the
150
+ // logic in Swap()/UnsafeArenaSwap() at the message level, so this method is
151
+ // 'unsafe' if called directly.
152
+ GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE void Swap(ArenaStringPtr* other) {
153
+ std::swap(ptr_, other->ptr_);
154
+ }
155
+
156
+ // Frees storage (if not on an arena).
157
+ inline void Destroy(const ::std::string* default_value,
158
+ ::google::protobuf::Arena* arena) {
159
+ if (arena == NULL && ptr_ != default_value) {
160
+ delete ptr_;
161
+ }
162
+ }
163
+
164
+ // Clears content, but keeps allocated string if arena != NULL, to avoid the
165
+ // overhead of heap operations. After this returns, the content (as seen by
166
+ // the user) will always be the empty string. Assumes that |default_value|
167
+ // is an empty string.
168
+ inline void ClearToEmpty(const ::std::string* default_value,
169
+ ::google::protobuf::Arena* /* arena */) {
170
+ if (ptr_ == default_value) {
171
+ // Already set to default (which is empty) -- do nothing.
172
+ } else {
173
+ ptr_->clear();
174
+ }
175
+ }
176
+
177
+ // Clears content, but keeps allocated string if arena != NULL, to avoid the
178
+ // overhead of heap operations. After this returns, the content (as seen by
179
+ // the user) will always be equal to |default_value|.
180
+ inline void ClearToDefault(const ::std::string* default_value,
181
+ ::google::protobuf::Arena* /* arena */) {
182
+ if (ptr_ == default_value) {
183
+ // Already set to default -- do nothing.
184
+ } else {
185
+ // Have another allocated string -- rather than throwing this away and
186
+ // resetting ptr_ to the canonical default string instance, we just reuse
187
+ // this instance.
188
+ *ptr_ = *default_value;
189
+ }
190
+ }
191
+
192
+ // Called from generated code / reflection runtime only. Resets value to point
193
+ // to a default string pointer, with the semantics that this ArenaStringPtr
194
+ // does not own the pointed-to memory. Disregards initial value of ptr_ (so
195
+ // this is the *ONLY* safe method to call after construction or when
196
+ // reinitializing after becoming the active field in a oneof union).
197
+ inline void UnsafeSetDefault(const ::std::string* default_value) {
198
+ // Casting away 'const' is safe here: accessors ensure that ptr_ is only
199
+ // returned as a const if it is equal to default_value.
200
+ ptr_ = const_cast< ::std::string* >(default_value);
201
+ }
202
+
203
+ // The 'NoArena' variants of methods below assume arena == NULL and are
204
+ // optimized to provide very little overhead relative to a raw string pointer
205
+ // (while still being in-memory compatible with other code that assumes
206
+ // ArenaStringPtr). Note the invariant that a class instance that has only
207
+ // ever been mutated by NoArena methods must *only* be in the String state
208
+ // (i.e., tag bits are not used), *NEVER* ArenaString. This allows all
209
+ // tagged-pointer manipulations to be avoided.
210
+ inline void SetNoArena(const ::std::string* default_value,
211
+ const ::std::string& value) {
212
+ if (ptr_ == default_value) {
213
+ CreateInstanceNoArena(&value);
214
+ } else {
215
+ *ptr_ = value;
216
+ }
217
+ }
218
+
219
+ #if LANG_CXX11
220
+ void SetNoArena(const ::std::string* default_value, ::std::string&& value) {
221
+ if (IsDefault(default_value)) {
222
+ ptr_ = new ::std::string(std::move(value));
223
+ } else {
224
+ *ptr_ = std::move(value);
225
+ }
226
+ }
227
+ #endif
228
+
229
+ void AssignWithDefault(const ::std::string* default_value, ArenaStringPtr value);
230
+
231
+ inline const ::std::string& GetNoArena() const { return *ptr_; }
232
+
233
+ inline ::std::string* MutableNoArena(const ::std::string* default_value) {
234
+ if (ptr_ == default_value) {
235
+ CreateInstanceNoArena(default_value);
236
+ }
237
+ return ptr_;
238
+ }
239
+
240
+ inline ::std::string* ReleaseNoArena(const ::std::string* default_value) {
241
+ if (ptr_ == default_value) {
242
+ return NULL;
243
+ } else {
244
+ ::std::string* released = ptr_;
245
+ ptr_ = const_cast< ::std::string* >(default_value);
246
+ return released;
247
+ }
248
+ }
249
+
250
+ inline void SetAllocatedNoArena(const ::std::string* default_value,
251
+ ::std::string* value) {
252
+ if (ptr_ != default_value) {
253
+ delete ptr_;
254
+ }
255
+ if (value != NULL) {
256
+ ptr_ = value;
257
+ } else {
258
+ ptr_ = const_cast< ::std::string* >(default_value);
259
+ }
260
+ }
261
+
262
+ inline void DestroyNoArena(const ::std::string* default_value) {
263
+ if (ptr_ != default_value) {
264
+ delete ptr_;
265
+ }
266
+ }
267
+
268
+ inline void ClearToEmptyNoArena(const ::std::string* default_value) {
269
+ if (ptr_ == default_value) {
270
+ // Nothing: already equal to default (which is the empty string).
271
+ } else {
272
+ ptr_->clear();
273
+ }
274
+ }
275
+
276
+ inline void ClearToDefaultNoArena(const ::std::string* default_value) {
277
+ if (ptr_ == default_value) {
278
+ // Nothing: already set to default.
279
+ } else {
280
+ // Reuse existing allocated instance.
281
+ *ptr_ = *default_value;
282
+ }
283
+ }
284
+
285
+ // Internal accessor used only at parse time to provide direct access to the
286
+ // raw pointer from the shared parse routine (in the non-arenas case). The
287
+ // parse routine does the string allocation in order to save code size in the
288
+ // generated parsing code.
289
+ inline ::std::string** UnsafeRawStringPointer() {
290
+ return &ptr_;
291
+ }
292
+
293
+ inline bool IsDefault(const ::std::string* default_value) const {
294
+ return ptr_ == default_value;
295
+ }
296
+
297
+ private:
298
+ ::std::string* ptr_;
299
+
300
+ GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
301
+ void CreateInstance(::google::protobuf::Arena* arena,
302
+ const ::std::string* initial_value) {
303
+ GOOGLE_DCHECK(initial_value != NULL);
304
+ ptr_ = new ::std::string(*initial_value);
305
+ if (arena != NULL) {
306
+ arena->Own(ptr_);
307
+ }
308
+ }
309
+ GOOGLE_PROTOBUF_ATTRIBUTE_NOINLINE
310
+ void CreateInstanceNoArena(const ::std::string* initial_value) {
311
+ GOOGLE_DCHECK(initial_value != NULL);
312
+ ptr_ = new ::std::string(*initial_value);
313
+ }
314
+ };
315
+
316
+ } // namespace internal
317
+ } // namespace protobuf
318
+
319
+
320
+
321
+ namespace protobuf {
322
+ namespace internal {
323
+
324
+ inline void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
325
+ ArenaStringPtr value) {
326
+ const ::std::string* me = *UnsafeRawStringPointer();
327
+ const ::std::string* other = *value.UnsafeRawStringPointer();
328
+ // If the pointers are the same then do nothing.
329
+ if (me != other) {
330
+ SetNoArena(default_value, value.GetNoArena());
331
+ }
332
+ }
333
+
334
+ } // namespace internal
335
+ } // namespace protobuf
336
+
337
+ } // namespace google
338
+ #endif // GOOGLE_PROTOBUF_ARENASTRING_H__
kortex_api/include/google/protobuf/compiler/code_generator.h ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Defines the abstract interface implemented by each of the language-specific
36
+ // code generators.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__
39
+ #define GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__
40
+
41
+ #include <google/protobuf/stubs/common.h>
42
+ #include <string>
43
+ #include <vector>
44
+ #include <utility>
45
+
46
+ namespace google {
47
+ namespace protobuf {
48
+
49
+ namespace io { class ZeroCopyOutputStream; }
50
+ class FileDescriptor;
51
+
52
+ namespace compiler {
53
+ class AccessInfoMap;
54
+
55
+ class Version;
56
+
57
+ // Defined in this file.
58
+ class CodeGenerator;
59
+ class GeneratorContext;
60
+
61
+ // The abstract interface to a class which generates code implementing a
62
+ // particular proto file in a particular language. A number of these may
63
+ // be registered with CommandLineInterface to support various languages.
64
+ class LIBPROTOC_EXPORT CodeGenerator {
65
+ public:
66
+ inline CodeGenerator() {}
67
+ virtual ~CodeGenerator();
68
+
69
+ // Generates code for the given proto file, generating one or more files in
70
+ // the given output directory.
71
+ //
72
+ // A parameter to be passed to the generator can be specified on the command
73
+ // line. This is intended to be used to pass generator specific parameters.
74
+ // It is empty if no parameter was given. ParseGeneratorParameter (below),
75
+ // can be used to accept multiple parameters within the single parameter
76
+ // command line flag.
77
+ //
78
+ // Returns true if successful. Otherwise, sets *error to a description of
79
+ // the problem (e.g. "invalid parameter") and returns false.
80
+ virtual bool Generate(const FileDescriptor* file,
81
+ const string& parameter,
82
+ GeneratorContext* generator_context,
83
+ string* error) const = 0;
84
+
85
+ // Generates code for all given proto files.
86
+ //
87
+ // WARNING: The canonical code generator design produces one or two output
88
+ // files per input .proto file, and we do not wish to encourage alternate
89
+ // designs.
90
+ //
91
+ // A parameter is given as passed on the command line, as in |Generate()|
92
+ // above.
93
+ //
94
+ // Returns true if successful. Otherwise, sets *error to a description of
95
+ // the problem (e.g. "invalid parameter") and returns false.
96
+ virtual bool GenerateAll(const std::vector<const FileDescriptor*>& files,
97
+ const string& parameter,
98
+ GeneratorContext* generator_context,
99
+ string* error) const;
100
+
101
+ // This is no longer used, but this class is part of the opensource protobuf
102
+ // library, so it has to remain to keep vtables the same for the current
103
+ // version of the library. When protobufs does a api breaking change, the
104
+ // method can be removed.
105
+ virtual bool HasGenerateAll() const { return true; }
106
+
107
+ private:
108
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodeGenerator);
109
+ };
110
+
111
+ // CodeGenerators generate one or more files in a given directory. This
112
+ // abstract interface represents the directory to which the CodeGenerator is
113
+ // to write and other information about the context in which the Generator
114
+ // runs.
115
+ class LIBPROTOC_EXPORT GeneratorContext {
116
+ public:
117
+ inline GeneratorContext() {
118
+ }
119
+ virtual ~GeneratorContext();
120
+
121
+ // Opens the given file, truncating it if it exists, and returns a
122
+ // ZeroCopyOutputStream that writes to the file. The caller takes ownership
123
+ // of the returned object. This method never fails (a dummy stream will be
124
+ // returned instead).
125
+ //
126
+ // The filename given should be relative to the root of the source tree.
127
+ // E.g. the C++ generator, when generating code for "foo/bar.proto", will
128
+ // generate the files "foo/bar.pb.h" and "foo/bar.pb.cc"; note that
129
+ // "foo/" is included in these filenames. The filename is not allowed to
130
+ // contain "." or ".." components.
131
+ virtual io::ZeroCopyOutputStream* Open(const string& filename) = 0;
132
+
133
+ // Similar to Open() but the output will be appended to the file if exists
134
+ virtual io::ZeroCopyOutputStream* OpenForAppend(const string& filename);
135
+
136
+ // Creates a ZeroCopyOutputStream which will insert code into the given file
137
+ // at the given insertion point. See plugin.proto (plugin.pb.h) for more
138
+ // information on insertion points. The default implementation
139
+ // assert-fails -- it exists only for backwards-compatibility.
140
+ //
141
+ // WARNING: This feature is currently EXPERIMENTAL and is subject to change.
142
+ virtual io::ZeroCopyOutputStream* OpenForInsert(
143
+ const string& filename, const string& insertion_point);
144
+
145
+ // Returns a vector of FileDescriptors for all the files being compiled
146
+ // in this run. Useful for languages, such as Go, that treat files
147
+ // differently when compiled as a set rather than individually.
148
+ virtual void ListParsedFiles(std::vector<const FileDescriptor*>* output);
149
+
150
+ // Retrieves the version number of the protocol compiler associated with
151
+ // this GeneratorContext.
152
+ virtual void GetCompilerVersion(Version* version) const;
153
+
154
+
155
+ private:
156
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(GeneratorContext);
157
+ };
158
+
159
+ // The type GeneratorContext was once called OutputDirectory. This typedef
160
+ // provides backward compatibility.
161
+ typedef GeneratorContext OutputDirectory;
162
+
163
+ // Several code generators treat the parameter argument as holding a
164
+ // list of options separated by commas. This helper function parses
165
+ // a set of comma-delimited name/value pairs: e.g.,
166
+ // "foo=bar,baz,qux=corge"
167
+ // parses to the pairs:
168
+ // ("foo", "bar"), ("baz", ""), ("qux", "corge")
169
+ void ParseGeneratorParameter(
170
+ const string&, std::vector<std::pair<string, string> >*);
171
+
172
+ } // namespace compiler
173
+ } // namespace protobuf
174
+
175
+ } // namespace google
176
+ #endif // GOOGLE_PROTOBUF_COMPILER_CODE_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/command_line_interface.h ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Implements the Protocol Compiler front-end such that it may be reused by
36
+ // custom compilers written to support other languages.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__
39
+ #define GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__
40
+
41
+ #include <google/protobuf/stubs/common.h>
42
+ #include <google/protobuf/stubs/hash.h>
43
+ #include <string>
44
+ #include <vector>
45
+ #include <map>
46
+ #include <set>
47
+ #include <utility>
48
+
49
+ namespace google {
50
+ namespace protobuf {
51
+
52
+ class Descriptor; // descriptor.h
53
+ class DescriptorPool; // descriptor.h
54
+ class FileDescriptor; // descriptor.h
55
+ class FileDescriptorSet; // descriptor.h
56
+ class FileDescriptorProto; // descriptor.pb.h
57
+ template<typename T> class RepeatedPtrField; // repeated_field.h
58
+ class SimpleDescriptorDatabase; // descriptor_database.h
59
+
60
+ namespace compiler {
61
+
62
+ class CodeGenerator; // code_generator.h
63
+ class GeneratorContext; // code_generator.h
64
+ class DiskSourceTree; // importer.h
65
+
66
+ // This class implements the command-line interface to the protocol compiler.
67
+ // It is designed to make it very easy to create a custom protocol compiler
68
+ // supporting the languages of your choice. For example, if you wanted to
69
+ // create a custom protocol compiler binary which includes both the regular
70
+ // C++ support plus support for your own custom output "Foo", you would
71
+ // write a class "FooGenerator" which implements the CodeGenerator interface,
72
+ // then write a main() procedure like this:
73
+ //
74
+ // int main(int argc, char* argv[]) {
75
+ // google::protobuf::compiler::CommandLineInterface cli;
76
+ //
77
+ // // Support generation of C++ source and headers.
78
+ // google::protobuf::compiler::cpp::CppGenerator cpp_generator;
79
+ // cli.RegisterGenerator("--cpp_out", &cpp_generator,
80
+ // "Generate C++ source and header.");
81
+ //
82
+ // // Support generation of Foo code.
83
+ // FooGenerator foo_generator;
84
+ // cli.RegisterGenerator("--foo_out", &foo_generator,
85
+ // "Generate Foo file.");
86
+ //
87
+ // return cli.Run(argc, argv);
88
+ // }
89
+ //
90
+ // The compiler is invoked with syntax like:
91
+ // protoc --cpp_out=outdir --foo_out=outdir --proto_path=src src/foo.proto
92
+ //
93
+ // The .proto file to compile can be specified on the command line using either
94
+ // its physical file path, or a virtual path relative to a diretory specified
95
+ // in --proto_path. For example, for src/foo.proto, the following two protoc
96
+ // invocations work the same way:
97
+ // 1. protoc --proto_path=src src/foo.proto (physical file path)
98
+ // 2. protoc --proto_path=src foo.proto (virtual path relative to src)
99
+ //
100
+ // If a file path can be interpreted both as a physical file path and as a
101
+ // relative virtual path, the physical file path takes precendence.
102
+ //
103
+ // For a full description of the command-line syntax, invoke it with --help.
104
+ class LIBPROTOC_EXPORT CommandLineInterface {
105
+ public:
106
+ static const char* const kPathSeparator;
107
+
108
+ CommandLineInterface();
109
+ ~CommandLineInterface();
110
+
111
+ // Register a code generator for a language.
112
+ //
113
+ // Parameters:
114
+ // * flag_name: The command-line flag used to specify an output file of
115
+ // this type. The name must start with a '-'. If the name is longer
116
+ // than one letter, it must start with two '-'s.
117
+ // * generator: The CodeGenerator which will be called to generate files
118
+ // of this type.
119
+ // * help_text: Text describing this flag in the --help output.
120
+ //
121
+ // Some generators accept extra parameters. You can specify this parameter
122
+ // on the command-line by placing it before the output directory, separated
123
+ // by a colon:
124
+ // protoc --foo_out=enable_bar:outdir
125
+ // The text before the colon is passed to CodeGenerator::Generate() as the
126
+ // "parameter".
127
+ void RegisterGenerator(const string& flag_name,
128
+ CodeGenerator* generator,
129
+ const string& help_text);
130
+
131
+ // Register a code generator for a language.
132
+ // Besides flag_name you can specify another option_flag_name that could be
133
+ // used to pass extra parameters to the registered code generator.
134
+ // Suppose you have registered a generator by calling:
135
+ // command_line_interface.RegisterGenerator("--foo_out", "--foo_opt", ...)
136
+ // Then you could invoke the compiler with a command like:
137
+ // protoc --foo_out=enable_bar:outdir --foo_opt=enable_baz
138
+ // This will pass "enable_bar,enable_baz" as the parameter to the generator.
139
+ void RegisterGenerator(const string& flag_name,
140
+ const string& option_flag_name,
141
+ CodeGenerator* generator,
142
+ const string& help_text);
143
+
144
+ // Enables "plugins". In this mode, if a command-line flag ends with "_out"
145
+ // but does not match any registered generator, the compiler will attempt to
146
+ // find a "plugin" to implement the generator. Plugins are just executables.
147
+ // They should live somewhere in the PATH.
148
+ //
149
+ // The compiler determines the executable name to search for by concatenating
150
+ // exe_name_prefix with the unrecognized flag name, removing "_out". So, for
151
+ // example, if exe_name_prefix is "protoc-" and you pass the flag --foo_out,
152
+ // the compiler will try to run the program "protoc-foo".
153
+ //
154
+ // The plugin program should implement the following usage:
155
+ // plugin [--out=OUTDIR] [--parameter=PARAMETER] PROTO_FILES < DESCRIPTORS
156
+ // --out indicates the output directory (as passed to the --foo_out
157
+ // parameter); if omitted, the current directory should be used. --parameter
158
+ // gives the generator parameter, if any was provided (see below). The
159
+ // PROTO_FILES list the .proto files which were given on the compiler
160
+ // command-line; these are the files for which the plugin is expected to
161
+ // generate output code. Finally, DESCRIPTORS is an encoded FileDescriptorSet
162
+ // (as defined in descriptor.proto). This is piped to the plugin's stdin.
163
+ // The set will include descriptors for all the files listed in PROTO_FILES as
164
+ // well as all files that they import. The plugin MUST NOT attempt to read
165
+ // the PROTO_FILES directly -- it must use the FileDescriptorSet.
166
+ //
167
+ // The plugin should generate whatever files are necessary, as code generators
168
+ // normally do. It should write the names of all files it generates to
169
+ // stdout. The names should be relative to the output directory, NOT absolute
170
+ // names or relative to the current directory. If any errors occur, error
171
+ // messages should be written to stderr. If an error is fatal, the plugin
172
+ // should exit with a non-zero exit code.
173
+ //
174
+ // Plugins can have generator parameters similar to normal built-in
175
+ // generators. Extra generator parameters can be passed in via a matching
176
+ // "_opt" parameter. For example:
177
+ // protoc --plug_out=enable_bar:outdir --plug_opt=enable_baz
178
+ // This will pass "enable_bar,enable_baz" as the parameter to the plugin.
179
+ //
180
+ void AllowPlugins(const string& exe_name_prefix);
181
+
182
+ // Run the Protocol Compiler with the given command-line parameters.
183
+ // Returns the error code which should be returned by main().
184
+ //
185
+ // It may not be safe to call Run() in a multi-threaded environment because
186
+ // it calls strerror(). I'm not sure why you'd want to do this anyway.
187
+ int Run(int argc, const char* const argv[]);
188
+
189
+ // DEPRECATED. Calling this method has no effect. Protocol compiler now
190
+ // always try to find the .proto file relative to the current directory
191
+ // first and if the file is not found, it will then treat the input path
192
+ // as a virutal path.
193
+ void SetInputsAreProtoPathRelative(bool /* enable */) {}
194
+
195
+ // Provides some text which will be printed when the --version flag is
196
+ // used. The version of libprotoc will also be printed on the next line
197
+ // after this text.
198
+ void SetVersionInfo(const string& text) {
199
+ version_info_ = text;
200
+ }
201
+
202
+
203
+ private:
204
+ // -----------------------------------------------------------------
205
+
206
+ class ErrorPrinter;
207
+ class GeneratorContextImpl;
208
+ class MemoryOutputStream;
209
+ typedef hash_map<string, GeneratorContextImpl*> GeneratorContextMap;
210
+
211
+ // Clear state from previous Run().
212
+ void Clear();
213
+
214
+ // Remaps each file in input_files_ so that it is relative to one of the
215
+ // directories in proto_path_. Returns false if an error occurred. This
216
+ // is only used if inputs_are_proto_path_relative_ is false.
217
+ bool MakeInputsBeProtoPathRelative(
218
+ DiskSourceTree* source_tree);
219
+
220
+ // Return status for ParseArguments() and InterpretArgument().
221
+ enum ParseArgumentStatus {
222
+ PARSE_ARGUMENT_DONE_AND_CONTINUE,
223
+ PARSE_ARGUMENT_DONE_AND_EXIT,
224
+ PARSE_ARGUMENT_FAIL
225
+ };
226
+
227
+ // Parse all command-line arguments.
228
+ ParseArgumentStatus ParseArguments(int argc, const char* const argv[]);
229
+
230
+ // Read an argument file and append the file's content to the list of
231
+ // arguments. Return false if the file cannot be read.
232
+ bool ExpandArgumentFile(const string& file, std::vector<string>* arguments);
233
+
234
+ // Parses a command-line argument into a name/value pair. Returns
235
+ // true if the next argument in the argv should be used as the value,
236
+ // false otherwise.
237
+ //
238
+ // Examples:
239
+ // "-Isrc/protos" ->
240
+ // name = "-I", value = "src/protos"
241
+ // "--cpp_out=src/foo.pb2.cc" ->
242
+ // name = "--cpp_out", value = "src/foo.pb2.cc"
243
+ // "foo.proto" ->
244
+ // name = "", value = "foo.proto"
245
+ bool ParseArgument(const char* arg, string* name, string* value);
246
+
247
+ // Interprets arguments parsed with ParseArgument.
248
+ ParseArgumentStatus InterpretArgument(const string& name,
249
+ const string& value);
250
+
251
+ // Print the --help text to stderr.
252
+ void PrintHelpText();
253
+
254
+ // Loads proto_path_ into the provided source_tree.
255
+ bool InitializeDiskSourceTree(DiskSourceTree* source_tree);
256
+
257
+ // Loads descriptor_set_in into the provided database
258
+ bool PopulateSimpleDescriptorDatabase(SimpleDescriptorDatabase* database);
259
+
260
+ // Parses input_files_ into parsed_files
261
+ bool ParseInputFiles(DescriptorPool* descriptor_pool,
262
+ std::vector<const FileDescriptor*>* parsed_files);
263
+
264
+ // Generate the given output file from the given input.
265
+ struct OutputDirective; // see below
266
+ bool GenerateOutput(const std::vector<const FileDescriptor*>& parsed_files,
267
+ const OutputDirective& output_directive,
268
+ GeneratorContext* generator_context);
269
+ bool GeneratePluginOutput(
270
+ const std::vector<const FileDescriptor*>& parsed_files,
271
+ const string& plugin_name, const string& parameter,
272
+ GeneratorContext* generator_context, string* error);
273
+
274
+ // Implements --encode and --decode.
275
+ bool EncodeOrDecode(const DescriptorPool* pool);
276
+
277
+ // Implements the --descriptor_set_out option.
278
+ bool WriteDescriptorSet(
279
+ const std::vector<const FileDescriptor*>& parsed_files);
280
+
281
+ // Implements the --dependency_out option
282
+ bool GenerateDependencyManifestFile(
283
+ const std::vector<const FileDescriptor*>& parsed_files,
284
+ const GeneratorContextMap& output_directories,
285
+ DiskSourceTree* source_tree);
286
+
287
+ // Get all transitive dependencies of the given file (including the file
288
+ // itself), adding them to the given list of FileDescriptorProtos. The
289
+ // protos will be ordered such that every file is listed before any file that
290
+ // depends on it, so that you can call DescriptorPool::BuildFile() on them
291
+ // in order. Any files in *already_seen will not be added, and each file
292
+ // added will be inserted into *already_seen. If include_source_code_info is
293
+ // true then include the source code information in the FileDescriptorProtos.
294
+ // If include_json_name is true, populate the json_name field of
295
+ // FieldDescriptorProto for all fields.
296
+ static void GetTransitiveDependencies(
297
+ const FileDescriptor* file,
298
+ bool include_json_name,
299
+ bool include_source_code_info,
300
+ std::set<const FileDescriptor*>* already_seen,
301
+ RepeatedPtrField<FileDescriptorProto>* output);
302
+
303
+ // Implements the --print_free_field_numbers. This function prints free field
304
+ // numbers into stdout for the message and it's nested message types in
305
+ // post-order, i.e. nested types first. Printed range are left-right
306
+ // inclusive, i.e. [a, b].
307
+ //
308
+ // Groups:
309
+ // For historical reasons, groups are considered to share the same
310
+ // field number space with the parent message, thus it will not print free
311
+ // field numbers for groups. The field numbers used in the groups are
312
+ // excluded in the free field numbers of the parent message.
313
+ //
314
+ // Extension Ranges:
315
+ // Extension ranges are considered ocuppied field numbers and they will not be
316
+ // listed as free numbers in the output.
317
+ void PrintFreeFieldNumbers(const Descriptor* descriptor);
318
+
319
+ // -----------------------------------------------------------------
320
+
321
+ // The name of the executable as invoked (i.e. argv[0]).
322
+ string executable_name_;
323
+
324
+ // Version info set with SetVersionInfo().
325
+ string version_info_;
326
+
327
+ // Registered generators.
328
+ struct GeneratorInfo {
329
+ string flag_name;
330
+ string option_flag_name;
331
+ CodeGenerator* generator;
332
+ string help_text;
333
+ };
334
+ typedef std::map<string, GeneratorInfo> GeneratorMap;
335
+ GeneratorMap generators_by_flag_name_;
336
+ GeneratorMap generators_by_option_name_;
337
+ // A map from generator names to the parameters specified using the option
338
+ // flag. For example, if the user invokes the compiler with:
339
+ // protoc --foo_out=outputdir --foo_opt=enable_bar ...
340
+ // Then there will be an entry ("--foo_out", "enable_bar") in this map.
341
+ std::map<string, string> generator_parameters_;
342
+ // Similar to generator_parameters_, but stores the parameters for plugins.
343
+ std::map<string, string> plugin_parameters_;
344
+
345
+ // See AllowPlugins(). If this is empty, plugins aren't allowed.
346
+ string plugin_prefix_;
347
+
348
+ // Maps specific plugin names to files. When executing a plugin, this map
349
+ // is searched first to find the plugin executable. If not found here, the
350
+ // PATH (or other OS-specific search strategy) is searched.
351
+ std::map<string, string> plugins_;
352
+
353
+ // Stuff parsed from command line.
354
+ enum Mode {
355
+ MODE_COMPILE, // Normal mode: parse .proto files and compile them.
356
+ MODE_ENCODE, // --encode: read text from stdin, write binary to stdout.
357
+ MODE_DECODE, // --decode: read binary from stdin, write text to stdout.
358
+ MODE_PRINT, // Print mode: print info of the given .proto files and exit.
359
+ };
360
+
361
+ Mode mode_;
362
+
363
+ enum PrintMode {
364
+ PRINT_NONE, // Not in MODE_PRINT
365
+ PRINT_FREE_FIELDS, // --print_free_fields
366
+ };
367
+
368
+ PrintMode print_mode_;
369
+
370
+ enum ErrorFormat {
371
+ ERROR_FORMAT_GCC, // GCC error output format (default).
372
+ ERROR_FORMAT_MSVS // Visual Studio output (--error_format=msvs).
373
+ };
374
+
375
+ ErrorFormat error_format_;
376
+
377
+ std::vector<std::pair<string, string> >
378
+ proto_path_; // Search path for proto files.
379
+ std::vector<string> input_files_; // Names of the input proto files.
380
+
381
+ // Names of proto files which are allowed to be imported. Used by build
382
+ // systems to enforce depend-on-what-you-import.
383
+ std::set<string> direct_dependencies_;
384
+ bool direct_dependencies_explicitly_set_;
385
+
386
+ // If there's a violation of depend-on-what-you-import, this string will be
387
+ // presented to the user. "%s" will be replaced with the violating import.
388
+ string direct_dependencies_violation_msg_;
389
+
390
+ // output_directives_ lists all the files we are supposed to output and what
391
+ // generator to use for each.
392
+ struct OutputDirective {
393
+ string name; // E.g. "--foo_out"
394
+ CodeGenerator* generator; // NULL for plugins
395
+ string parameter;
396
+ string output_location;
397
+ };
398
+ std::vector<OutputDirective> output_directives_;
399
+
400
+ // When using --encode or --decode, this names the type we are encoding or
401
+ // decoding. (Empty string indicates --decode_raw.)
402
+ string codec_type_;
403
+
404
+ // If --descriptor_set_in was given, these are filenames containing
405
+ // parsed FileDescriptorSets to be used for loading protos. Otherwise, empty.
406
+ std::vector<string> descriptor_set_in_names_;
407
+
408
+ // If --descriptor_set_out was given, this is the filename to which the
409
+ // FileDescriptorSet should be written. Otherwise, empty.
410
+ string descriptor_set_out_name_;
411
+
412
+ // If --dependency_out was given, this is the path to the file where the
413
+ // dependency file will be written. Otherwise, empty.
414
+ string dependency_out_name_;
415
+
416
+ // Path to a file that contains serialized AccessInfo which provides
417
+ // relative hotness of fields per message. This helps protoc to generate
418
+ // better code.
419
+ string profile_path_;
420
+
421
+ // True if --include_imports was given, meaning that we should
422
+ // write all transitive dependencies to the DescriptorSet. Otherwise, only
423
+ // the .proto files listed on the command-line are added.
424
+ bool imports_in_descriptor_set_;
425
+
426
+ // True if --include_source_info was given, meaning that we should not strip
427
+ // SourceCodeInfo from the DescriptorSet.
428
+ bool source_info_in_descriptor_set_;
429
+
430
+ // Was the --disallow_services flag used?
431
+ bool disallow_services_;
432
+
433
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CommandLineInterface);
434
+ };
435
+
436
+ } // namespace compiler
437
+ } // namespace protobuf
438
+
439
+ } // namespace google
440
+ #endif // GOOGLE_PROTOBUF_COMPILER_COMMAND_LINE_INTERFACE_H__
kortex_api/include/google/protobuf/compiler/cpp/cpp_generator.h ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Generates C++ code for a given .proto file.
36
+
37
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
38
+ #define GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
39
+
40
+ #include <string>
41
+ #include <google/protobuf/compiler/code_generator.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace cpp {
47
+
48
+ // CodeGenerator implementation which generates a C++ source file and
49
+ // header. If you create your own protocol compiler binary and you want
50
+ // it to support C++ output, you can do so by registering an instance of this
51
+ // CodeGenerator with the CommandLineInterface in your main() function.
52
+ class LIBPROTOC_EXPORT CppGenerator : public CodeGenerator {
53
+ public:
54
+ CppGenerator();
55
+ ~CppGenerator();
56
+
57
+ // implements CodeGenerator ----------------------------------------
58
+ bool Generate(const FileDescriptor* file,
59
+ const string& parameter,
60
+ GeneratorContext* generator_context,
61
+ string* error) const;
62
+
63
+ private:
64
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CppGenerator);
65
+ };
66
+
67
+ } // namespace cpp
68
+ } // namespace compiler
69
+ } // namespace protobuf
70
+
71
+ } // namespace google
72
+ #endif // GOOGLE_PROTOBUF_COMPILER_CPP_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/csharp/csharp_generator.h ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Generates C# code for a given .proto file.
32
+
33
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
34
+ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
35
+
36
+ #include <string>
37
+
38
+ #include <google/protobuf/compiler/code_generator.h>
39
+
40
+ namespace google {
41
+ namespace protobuf {
42
+ namespace compiler {
43
+ namespace csharp {
44
+
45
+ // CodeGenerator implementation which generates a C# source file and
46
+ // header. If you create your own protocol compiler binary and you want
47
+ // it to support C# output, you can do so by registering an instance of this
48
+ // CodeGenerator with the CommandLineInterface in your main() function.
49
+ class LIBPROTOC_EXPORT Generator
50
+ : public google::protobuf::compiler::CodeGenerator {
51
+ public:
52
+ virtual bool Generate(
53
+ const FileDescriptor* file,
54
+ const string& parameter,
55
+ GeneratorContext* generator_context,
56
+ string* error) const;
57
+ };
58
+
59
+ } // namespace csharp
60
+ } // namespace compiler
61
+ } // namespace protobuf
62
+ } // namespace google
63
+
64
+ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/csharp/csharp_names.h ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Provides a mechanism for mapping a descriptor to the
36
+ // fully-qualified name of the corresponding C# class.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
39
+ #define GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
40
+
41
+ #include <string>
42
+ #include <google/protobuf/stubs/port.h>
43
+
44
+ namespace google {
45
+ namespace protobuf {
46
+
47
+ class Descriptor;
48
+ class EnumDescriptor;
49
+ class FileDescriptor;
50
+ class ServiceDescriptor;
51
+
52
+ namespace compiler {
53
+ namespace csharp {
54
+
55
+ // Requires:
56
+ // descriptor != NULL
57
+ //
58
+ // Returns:
59
+ // The namespace to use for given file descriptor.
60
+ string LIBPROTOC_EXPORT GetFileNamespace(const FileDescriptor* descriptor);
61
+
62
+ // Requires:
63
+ // descriptor != NULL
64
+ //
65
+ // Returns:
66
+ // The fully-qualified C# class name.
67
+ string LIBPROTOC_EXPORT GetClassName(const Descriptor* descriptor);
68
+
69
+ // Requires:
70
+ // descriptor != NULL
71
+ //
72
+ // Returns:
73
+ // The fully-qualified name of the C# class that provides
74
+ // access to the file descriptor. Proto compiler generates
75
+ // such class for each .proto file processed.
76
+ string LIBPROTOC_EXPORT GetReflectionClassName(const FileDescriptor* descriptor);
77
+
78
+ // Generates output file name for given file descriptor. If generate_directories
79
+ // is true, the output file will be put under directory corresponding to file's
80
+ // namespace. base_namespace can be used to strip some of the top level
81
+ // directories. E.g. for file with namespace "Bar.Foo" and base_namespace="Bar",
82
+ // the resulting file will be put under directory "Foo" (and not "Bar/Foo").
83
+ //
84
+ // Requires:
85
+ // descriptor != NULL
86
+ // error != NULL
87
+ //
88
+ // Returns:
89
+ // The file name to use as output file for given file descriptor. In case
90
+ // of failure, this function will return empty string and error parameter
91
+ // will contain the error message.
92
+ string LIBPROTOC_EXPORT GetOutputFile(
93
+ const google::protobuf::FileDescriptor* descriptor,
94
+ const string file_extension,
95
+ const bool generate_directories,
96
+ const string base_namespace,
97
+ string* error);
98
+
99
+ } // namespace csharp
100
+ } // namespace compiler
101
+ } // namespace protobuf
102
+ } // namespace google
103
+
104
+ #endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_NAMES_H__
kortex_api/include/google/protobuf/compiler/importer.h ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // This file is the public interface to the .proto file parser.
36
+
37
+ #ifndef GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__
38
+ #define GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__
39
+
40
+ #include <string>
41
+ #include <vector>
42
+ #include <set>
43
+ #include <utility>
44
+ #include <google/protobuf/descriptor.h>
45
+ #include <google/protobuf/descriptor_database.h>
46
+ #include <google/protobuf/compiler/parser.h>
47
+
48
+ namespace google {
49
+ namespace protobuf {
50
+
51
+ namespace io { class ZeroCopyInputStream; }
52
+
53
+ namespace compiler {
54
+
55
+ // Defined in this file.
56
+ class Importer;
57
+ class MultiFileErrorCollector;
58
+ class SourceTree;
59
+ class DiskSourceTree;
60
+
61
+ // TODO(kenton): Move all SourceTree stuff to a separate file?
62
+
63
+ // An implementation of DescriptorDatabase which loads files from a SourceTree
64
+ // and parses them.
65
+ //
66
+ // Note: This class is not thread-safe since it maintains a table of source
67
+ // code locations for error reporting. However, when a DescriptorPool wraps
68
+ // a DescriptorDatabase, it uses mutex locking to make sure only one method
69
+ // of the database is called at a time, even if the DescriptorPool is used
70
+ // from multiple threads. Therefore, there is only a problem if you create
71
+ // multiple DescriptorPools wrapping the same SourceTreeDescriptorDatabase
72
+ // and use them from multiple threads.
73
+ //
74
+ // Note: This class does not implement FindFileContainingSymbol() or
75
+ // FindFileContainingExtension(); these will always return false.
76
+ class LIBPROTOBUF_EXPORT SourceTreeDescriptorDatabase : public DescriptorDatabase {
77
+ public:
78
+ SourceTreeDescriptorDatabase(SourceTree* source_tree);
79
+ ~SourceTreeDescriptorDatabase();
80
+
81
+ // Instructs the SourceTreeDescriptorDatabase to report any parse errors
82
+ // to the given MultiFileErrorCollector. This should be called before
83
+ // parsing. error_collector must remain valid until either this method
84
+ // is called again or the SourceTreeDescriptorDatabase is destroyed.
85
+ void RecordErrorsTo(MultiFileErrorCollector* error_collector) {
86
+ error_collector_ = error_collector;
87
+ }
88
+
89
+ // Gets a DescriptorPool::ErrorCollector which records errors to the
90
+ // MultiFileErrorCollector specified with RecordErrorsTo(). This collector
91
+ // has the ability to determine exact line and column numbers of errors
92
+ // from the information given to it by the DescriptorPool.
93
+ DescriptorPool::ErrorCollector* GetValidationErrorCollector() {
94
+ using_validation_error_collector_ = true;
95
+ return &validation_error_collector_;
96
+ }
97
+
98
+ // implements DescriptorDatabase -----------------------------------
99
+ bool FindFileByName(const string& filename, FileDescriptorProto* output);
100
+ bool FindFileContainingSymbol(const string& symbol_name,
101
+ FileDescriptorProto* output);
102
+ bool FindFileContainingExtension(const string& containing_type,
103
+ int field_number,
104
+ FileDescriptorProto* output);
105
+
106
+ private:
107
+ class SingleFileErrorCollector;
108
+
109
+ SourceTree* source_tree_;
110
+ MultiFileErrorCollector* error_collector_;
111
+
112
+ class LIBPROTOBUF_EXPORT ValidationErrorCollector : public DescriptorPool::ErrorCollector {
113
+ public:
114
+ ValidationErrorCollector(SourceTreeDescriptorDatabase* owner);
115
+ ~ValidationErrorCollector();
116
+
117
+ // implements ErrorCollector ---------------------------------------
118
+ void AddError(const string& filename,
119
+ const string& element_name,
120
+ const Message* descriptor,
121
+ ErrorLocation location,
122
+ const string& message);
123
+
124
+ virtual void AddWarning(const string& filename,
125
+ const string& element_name,
126
+ const Message* descriptor,
127
+ ErrorLocation location,
128
+ const string& message);
129
+
130
+ private:
131
+ SourceTreeDescriptorDatabase* owner_;
132
+ };
133
+ friend class ValidationErrorCollector;
134
+
135
+ bool using_validation_error_collector_;
136
+ SourceLocationTable source_locations_;
137
+ ValidationErrorCollector validation_error_collector_;
138
+ };
139
+
140
+ // Simple interface for parsing .proto files. This wraps the process
141
+ // of opening the file, parsing it with a Parser, recursively parsing all its
142
+ // imports, and then cross-linking the results to produce a FileDescriptor.
143
+ //
144
+ // This is really just a thin wrapper around SourceTreeDescriptorDatabase.
145
+ // You may find that SourceTreeDescriptorDatabase is more flexible.
146
+ //
147
+ // TODO(kenton): I feel like this class is not well-named.
148
+ class LIBPROTOBUF_EXPORT Importer {
149
+ public:
150
+ Importer(SourceTree* source_tree,
151
+ MultiFileErrorCollector* error_collector);
152
+ ~Importer();
153
+
154
+ // Import the given file and build a FileDescriptor representing it. If
155
+ // the file is already in the DescriptorPool, the existing FileDescriptor
156
+ // will be returned. The FileDescriptor is property of the DescriptorPool,
157
+ // and will remain valid until it is destroyed. If any errors occur, they
158
+ // will be reported using the error collector and Import() will return NULL.
159
+ //
160
+ // A particular Importer object will only report errors for a particular
161
+ // file once. All future attempts to import the same file will return NULL
162
+ // without reporting any errors. The idea is that you might want to import
163
+ // a lot of files without seeing the same errors over and over again. If
164
+ // you want to see errors for the same files repeatedly, you can use a
165
+ // separate Importer object to import each one (but use the same
166
+ // DescriptorPool so that they can be cross-linked).
167
+ const FileDescriptor* Import(const string& filename);
168
+
169
+ // The DescriptorPool in which all imported FileDescriptors and their
170
+ // contents are stored.
171
+ inline const DescriptorPool* pool() const {
172
+ return &pool_;
173
+ }
174
+
175
+ void AddUnusedImportTrackFile(const string& file_name);
176
+ void ClearUnusedImportTrackFiles();
177
+
178
+
179
+ private:
180
+ SourceTreeDescriptorDatabase database_;
181
+ DescriptorPool pool_;
182
+
183
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Importer);
184
+ };
185
+
186
+ // If the importer encounters problems while trying to import the proto files,
187
+ // it reports them to a MultiFileErrorCollector.
188
+ class LIBPROTOBUF_EXPORT MultiFileErrorCollector {
189
+ public:
190
+ inline MultiFileErrorCollector() {}
191
+ virtual ~MultiFileErrorCollector();
192
+
193
+ // Line and column numbers are zero-based. A line number of -1 indicates
194
+ // an error with the entire file (e.g. "not found").
195
+ virtual void AddError(const string& filename, int line, int column,
196
+ const string& message) = 0;
197
+
198
+ virtual void AddWarning(const string& filename, int line, int column,
199
+ const string& message) {}
200
+
201
+ private:
202
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MultiFileErrorCollector);
203
+ };
204
+
205
+ // Abstract interface which represents a directory tree containing proto files.
206
+ // Used by the default implementation of Importer to resolve import statements
207
+ // Most users will probably want to use the DiskSourceTree implementation,
208
+ // below.
209
+ class LIBPROTOBUF_EXPORT SourceTree {
210
+ public:
211
+ inline SourceTree() {}
212
+ virtual ~SourceTree();
213
+
214
+ // Open the given file and return a stream that reads it, or NULL if not
215
+ // found. The caller takes ownership of the returned object. The filename
216
+ // must be a path relative to the root of the source tree and must not
217
+ // contain "." or ".." components.
218
+ virtual io::ZeroCopyInputStream* Open(const string& filename) = 0;
219
+
220
+ // If Open() returns NULL, calling this method immediately will return an
221
+ // description of the error.
222
+ // Subclasses should implement this method and return a meaningful value for
223
+ // better error reporting.
224
+ // TODO(xiaofeng): change this to a pure virtual function.
225
+ virtual string GetLastErrorMessage();
226
+
227
+ private:
228
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SourceTree);
229
+ };
230
+
231
+ // An implementation of SourceTree which loads files from locations on disk.
232
+ // Multiple mappings can be set up to map locations in the DiskSourceTree to
233
+ // locations in the physical filesystem.
234
+ class LIBPROTOBUF_EXPORT DiskSourceTree : public SourceTree {
235
+ public:
236
+ DiskSourceTree();
237
+ ~DiskSourceTree();
238
+
239
+ // Map a path on disk to a location in the SourceTree. The path may be
240
+ // either a file or a directory. If it is a directory, the entire tree
241
+ // under it will be mapped to the given virtual location. To map a directory
242
+ // to the root of the source tree, pass an empty string for virtual_path.
243
+ //
244
+ // If multiple mapped paths apply when opening a file, they will be searched
245
+ // in order. For example, if you do:
246
+ // MapPath("bar", "foo/bar");
247
+ // MapPath("", "baz");
248
+ // and then you do:
249
+ // Open("bar/qux");
250
+ // the DiskSourceTree will first try to open foo/bar/qux, then baz/bar/qux,
251
+ // returning the first one that opens successfuly.
252
+ //
253
+ // disk_path may be an absolute path or relative to the current directory,
254
+ // just like a path you'd pass to open().
255
+ void MapPath(const string& virtual_path, const string& disk_path);
256
+
257
+ // Return type for DiskFileToVirtualFile().
258
+ enum DiskFileToVirtualFileResult {
259
+ SUCCESS,
260
+ SHADOWED,
261
+ CANNOT_OPEN,
262
+ NO_MAPPING
263
+ };
264
+
265
+ // Given a path to a file on disk, find a virtual path mapping to that
266
+ // file. The first mapping created with MapPath() whose disk_path contains
267
+ // the filename is used. However, that virtual path may not actually be
268
+ // usable to open the given file. Possible return values are:
269
+ // * SUCCESS: The mapping was found. *virtual_file is filled in so that
270
+ // calling Open(*virtual_file) will open the file named by disk_file.
271
+ // * SHADOWED: A mapping was found, but using Open() to open this virtual
272
+ // path will end up returning some different file. This is because some
273
+ // other mapping with a higher precedence also matches this virtual path
274
+ // and maps it to a different file that exists on disk. *virtual_file
275
+ // is filled in as it would be in the SUCCESS case. *shadowing_disk_file
276
+ // is filled in with the disk path of the file which would be opened if
277
+ // you were to call Open(*virtual_file).
278
+ // * CANNOT_OPEN: The mapping was found and was not shadowed, but the
279
+ // file specified cannot be opened. When this value is returned,
280
+ // errno will indicate the reason the file cannot be opened. *virtual_file
281
+ // will be set to the virtual path as in the SUCCESS case, even though
282
+ // it is not useful.
283
+ // * NO_MAPPING: Indicates that no mapping was found which contains this
284
+ // file.
285
+ DiskFileToVirtualFileResult
286
+ DiskFileToVirtualFile(const string& disk_file,
287
+ string* virtual_file,
288
+ string* shadowing_disk_file);
289
+
290
+ // Given a virtual path, find the path to the file on disk.
291
+ // Return true and update disk_file with the on-disk path if the file exists.
292
+ // Return false and leave disk_file untouched if the file doesn't exist.
293
+ bool VirtualFileToDiskFile(const string& virtual_file, string* disk_file);
294
+
295
+ // implements SourceTree -------------------------------------------
296
+ virtual io::ZeroCopyInputStream* Open(const string& filename);
297
+
298
+ virtual string GetLastErrorMessage();
299
+
300
+ private:
301
+ struct Mapping {
302
+ string virtual_path;
303
+ string disk_path;
304
+
305
+ inline Mapping(const string& virtual_path_param,
306
+ const string& disk_path_param)
307
+ : virtual_path(virtual_path_param), disk_path(disk_path_param) {}
308
+ };
309
+ std::vector<Mapping> mappings_;
310
+ string last_error_message_;
311
+
312
+ // Like Open(), but returns the on-disk path in disk_file if disk_file is
313
+ // non-NULL and the file could be successfully opened.
314
+ io::ZeroCopyInputStream* OpenVirtualFile(const string& virtual_file,
315
+ string* disk_file);
316
+
317
+ // Like Open() but given the actual on-disk path.
318
+ io::ZeroCopyInputStream* OpenDiskFile(const string& filename);
319
+
320
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(DiskSourceTree);
321
+ };
322
+
323
+ } // namespace compiler
324
+ } // namespace protobuf
325
+
326
+ } // namespace google
327
+ #endif // GOOGLE_PROTOBUF_COMPILER_IMPORTER_H__
kortex_api/include/google/protobuf/compiler/java/java_generator.h ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Generates Java code for a given .proto file.
36
+
37
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
38
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
39
+
40
+ #include <string>
41
+ #include <google/protobuf/compiler/code_generator.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace java {
47
+
48
+ // CodeGenerator implementation which generates Java code. If you create your
49
+ // own protocol compiler binary and you want it to support Java output, you
50
+ // can do so by registering an instance of this CodeGenerator with the
51
+ // CommandLineInterface in your main() function.
52
+ class LIBPROTOC_EXPORT JavaGenerator : public CodeGenerator {
53
+ public:
54
+ JavaGenerator();
55
+ ~JavaGenerator();
56
+
57
+ // implements CodeGenerator ----------------------------------------
58
+ bool Generate(const FileDescriptor* file,
59
+ const string& parameter,
60
+ GeneratorContext* context,
61
+ string* error) const;
62
+
63
+ private:
64
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaGenerator);
65
+ };
66
+
67
+ } // namespace java
68
+ } // namespace compiler
69
+ } // namespace protobuf
70
+
71
+ } // namespace google
72
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/java/java_names.h ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Provides a mechanism for mapping a descriptor to the
36
+ // fully-qualified name of the corresponding Java class.
37
+
38
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
39
+ #define GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
40
+
41
+ #include <string>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+
46
+ class Descriptor;
47
+ class EnumDescriptor;
48
+ class FileDescriptor;
49
+ class ServiceDescriptor;
50
+
51
+ namespace compiler {
52
+ namespace java {
53
+
54
+ // Requires:
55
+ // descriptor != NULL
56
+ //
57
+ // Returns:
58
+ // The fully-qualified Java class name.
59
+ string ClassName(const Descriptor* descriptor);
60
+
61
+ // Requires:
62
+ // descriptor != NULL
63
+ //
64
+ // Returns:
65
+ // The fully-qualified Java class name.
66
+ string ClassName(const EnumDescriptor* descriptor);
67
+
68
+ // Requires:
69
+ // descriptor != NULL
70
+ //
71
+ // Returns:
72
+ // The fully-qualified Java class name.
73
+ string ClassName(const FileDescriptor* descriptor);
74
+
75
+ // Requires:
76
+ // descriptor != NULL
77
+ //
78
+ // Returns:
79
+ // The fully-qualified Java class name.
80
+ string ClassName(const ServiceDescriptor* descriptor);
81
+
82
+ } // namespace java
83
+ } // namespace compiler
84
+ } // namespace protobuf
85
+ } // namespace google
86
+
87
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_NAMES_H__
kortex_api/include/google/protobuf/compiler/javanano/javanano_generator.h ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // http://code.google.com/p/protobuf/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Author: kenton@google.com (Kenton Varda)
32
+ // Based on original Protocol Buffers design by
33
+ // Sanjay Ghemawat, Jeff Dean, and others.
34
+ //
35
+ // Generates Java nano code for a given .proto file.
36
+
37
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
38
+ #define GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
39
+
40
+ #include <string>
41
+ #include <google/protobuf/compiler/code_generator.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace compiler {
46
+ namespace javanano {
47
+
48
+ // CodeGenerator implementation which generates Java nano code. If you create your
49
+ // own protocol compiler binary and you want it to support Java output for the
50
+ // nano runtime, you can do so by registering an instance of this CodeGenerator with
51
+ // the CommandLineInterface in your main() function.
52
+ class LIBPROTOC_EXPORT JavaNanoGenerator : public CodeGenerator {
53
+ public:
54
+ JavaNanoGenerator();
55
+ ~JavaNanoGenerator();
56
+
57
+ // implements CodeGenerator ----------------------------------------
58
+ bool Generate(const FileDescriptor* file,
59
+ const string& parameter,
60
+ GeneratorContext* output_directory,
61
+ string* error) const;
62
+
63
+ private:
64
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(JavaNanoGenerator);
65
+ };
66
+
67
+ } // namespace javanano
68
+ } // namespace compiler
69
+ } // namespace protobuf
70
+
71
+ } // namespace google
72
+ #endif // GOOGLE_PROTOBUF_COMPILER_JAVANANO_NANO_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/js/js_generator.h ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Generates JavaScript code for a given .proto file.
32
+ //
33
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JS_GENERATOR_H__
34
+ #define GOOGLE_PROTOBUF_COMPILER_JS_GENERATOR_H__
35
+
36
+ #include <string>
37
+ #include <set>
38
+
39
+ #include <google/protobuf/stubs/logging.h>
40
+ #include <google/protobuf/stubs/common.h>
41
+ #include <google/protobuf/compiler/code_generator.h>
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+
46
+ class Descriptor;
47
+ class EnumDescriptor;
48
+ class FieldDescriptor;
49
+ class OneofDescriptor;
50
+ class FileDescriptor;
51
+
52
+ namespace io { class Printer; }
53
+
54
+ namespace compiler {
55
+ namespace js {
56
+
57
+ struct GeneratorOptions {
58
+ // Output path.
59
+ string output_dir;
60
+ // Namespace prefix.
61
+ string namespace_prefix;
62
+ // Enable binary-format support?
63
+ bool binary;
64
+ // What style of imports should be used.
65
+ enum ImportStyle {
66
+ kImportClosure, // goog.require()
67
+ kImportCommonJs, // require()
68
+ kImportBrowser, // no import statements
69
+ kImportEs6, // import { member } from ''
70
+ } import_style;
71
+
72
+ GeneratorOptions()
73
+ : output_dir("."),
74
+ namespace_prefix(""),
75
+ binary(false),
76
+ import_style(kImportClosure),
77
+ add_require_for_enums(false),
78
+ testonly(false),
79
+ library(""),
80
+ error_on_name_conflict(false),
81
+ extension(".js"),
82
+ one_output_file_per_input_file(false),
83
+ annotate_code(false) {}
84
+
85
+ bool ParseFromOptions(
86
+ const std::vector< std::pair< string, string > >& options,
87
+ string* error);
88
+
89
+ // Returns the file name extension to use for generated code.
90
+ string GetFileNameExtension() const {
91
+ return import_style == kImportClosure ? extension : "_pb.js";
92
+ }
93
+
94
+ enum OutputMode {
95
+ // Create an output file for each input .proto file.
96
+ kOneOutputFilePerInputFile,
97
+ // Create an output file for each type.
98
+ kOneOutputFilePerType,
99
+ // Put everything in a single file named by the library option.
100
+ kEverythingInOneFile,
101
+ };
102
+
103
+ // Indicates how to output the generated code based on the provided options.
104
+ OutputMode output_mode() const;
105
+
106
+ // The remaining options are only relevant when we are using kImportClosure.
107
+
108
+ // Add a `goog.requires()` call for each enum type used. If not set, a
109
+ // forward declaration with `goog.forwardDeclare` is produced instead.
110
+ bool add_require_for_enums;
111
+ // Set this as a test-only module via `goog.setTestOnly();`.
112
+ bool testonly;
113
+ // Create a library with name <name>_lib.js rather than a separate .js file
114
+ // per type?
115
+ string library;
116
+ // Error if there are two types that would generate the same output file?
117
+ bool error_on_name_conflict;
118
+ // The extension to use for output file names.
119
+ string extension;
120
+ // Create a separate output file for each input file?
121
+ bool one_output_file_per_input_file;
122
+ // If true, we should build .meta files that contain annotations for
123
+ // generated code. See GeneratedCodeInfo in descriptor.proto.
124
+ bool annotate_code;
125
+ };
126
+
127
+ // CodeGenerator implementation which generates a JavaScript source file and
128
+ // header. If you create your own protocol compiler binary and you want it to
129
+ // support JavaScript output, you can do so by registering an instance of this
130
+ // CodeGenerator with the CommandLineInterface in your main() function.
131
+ class LIBPROTOC_EXPORT Generator : public CodeGenerator {
132
+ public:
133
+ Generator() {}
134
+ virtual ~Generator() {}
135
+
136
+ virtual bool Generate(const FileDescriptor* file,
137
+ const string& parameter,
138
+ GeneratorContext* context,
139
+ string* error) const {
140
+ *error = "Unimplemented Generate() method. Call GenerateAll() instead.";
141
+ return false;
142
+ }
143
+
144
+ virtual bool HasGenerateAll() const { return true; }
145
+
146
+ virtual bool GenerateAll(const std::vector<const FileDescriptor*>& files,
147
+ const string& parameter,
148
+ GeneratorContext* context,
149
+ string* error) const;
150
+
151
+ private:
152
+ void GenerateHeader(const GeneratorOptions& options,
153
+ io::Printer* printer) const;
154
+
155
+ // Generate goog.provides() calls.
156
+ void FindProvides(const GeneratorOptions& options,
157
+ io::Printer* printer,
158
+ const std::vector<const FileDescriptor*>& file,
159
+ std::set<string>* provided) const;
160
+ void FindProvidesForFile(const GeneratorOptions& options,
161
+ io::Printer* printer,
162
+ const FileDescriptor* file,
163
+ std::set<string>* provided) const;
164
+ void FindProvidesForMessage(const GeneratorOptions& options,
165
+ io::Printer* printer,
166
+ const Descriptor* desc,
167
+ std::set<string>* provided) const;
168
+ void FindProvidesForEnum(const GeneratorOptions& options,
169
+ io::Printer* printer,
170
+ const EnumDescriptor* enumdesc,
171
+ std::set<string>* provided) const;
172
+ // For extension fields at file scope.
173
+ void FindProvidesForFields(const GeneratorOptions& options,
174
+ io::Printer* printer,
175
+ const std::vector<const FieldDescriptor*>& fields,
176
+ std::set<string>* provided) const;
177
+ // Print the goog.provides() found by the methods above.
178
+ void GenerateProvides(const GeneratorOptions& options,
179
+ io::Printer* printer,
180
+ std::set<string>* provided) const;
181
+
182
+ // Generate goog.setTestOnly() if indicated.
183
+ void GenerateTestOnly(const GeneratorOptions& options,
184
+ io::Printer* printer) const;
185
+
186
+ // Generate goog.requires() calls.
187
+ void GenerateRequiresForLibrary(
188
+ const GeneratorOptions& options, io::Printer* printer,
189
+ const std::vector<const FileDescriptor*>& files,
190
+ std::set<string>* provided) const;
191
+ void GenerateRequiresForMessage(const GeneratorOptions& options,
192
+ io::Printer* printer,
193
+ const Descriptor* desc,
194
+ std::set<string>* provided) const;
195
+ // For extension fields at file scope.
196
+ void GenerateRequiresForExtensions(
197
+ const GeneratorOptions& options, io::Printer* printer,
198
+ const std::vector<const FieldDescriptor*>& fields,
199
+ std::set<string>* provided) const;
200
+ void GenerateRequiresImpl(const GeneratorOptions& options,
201
+ io::Printer* printer, std::set<string>* required,
202
+ std::set<string>* forwards,
203
+ std::set<string>* provided, bool require_jspb,
204
+ bool require_extension, bool require_map) const;
205
+ void FindRequiresForMessage(const GeneratorOptions& options,
206
+ const Descriptor* desc,
207
+ std::set<string>* required,
208
+ std::set<string>* forwards,
209
+ bool* have_message) const;
210
+ void FindRequiresForField(const GeneratorOptions& options,
211
+ const FieldDescriptor* field,
212
+ std::set<string>* required,
213
+ std::set<string>* forwards) const;
214
+ void FindRequiresForExtension(const GeneratorOptions& options,
215
+ const FieldDescriptor* field,
216
+ std::set<string>* required,
217
+ std::set<string>* forwards) const;
218
+
219
+ void GenerateFile(const GeneratorOptions& options,
220
+ io::Printer* printer,
221
+ const FileDescriptor* file) const;
222
+
223
+ // Generate definitions for all message classes and enums in all files,
224
+ // processing the files in dependence order.
225
+ void GenerateFilesInDepOrder(
226
+ const GeneratorOptions& options, io::Printer* printer,
227
+ const std::vector<const FileDescriptor*>& file) const;
228
+ // Helper for above.
229
+ void GenerateFileAndDeps(const GeneratorOptions& options,
230
+ io::Printer* printer,
231
+ const FileDescriptor* root,
232
+ std::set<const FileDescriptor*>* all_files,
233
+ std::set<const FileDescriptor*>* generated) const;
234
+
235
+ // Generate definitions for all message classes and enums.
236
+ void GenerateClassesAndEnums(const GeneratorOptions& options,
237
+ io::Printer* printer,
238
+ const FileDescriptor* file) const;
239
+
240
+ void GenerateFieldValueExpression(io::Printer* printer,
241
+ const char* obj_reference,
242
+ const FieldDescriptor* field,
243
+ bool use_default) const;
244
+
245
+ // Generate definition for one class.
246
+ void GenerateClass(const GeneratorOptions& options,
247
+ io::Printer* printer,
248
+ const Descriptor* desc) const;
249
+ void GenerateClassConstructor(const GeneratorOptions& options,
250
+ io::Printer* printer,
251
+ const Descriptor* desc) const;
252
+ void GenerateClassFieldInfo(const GeneratorOptions& options,
253
+ io::Printer* printer,
254
+ const Descriptor* desc) const;
255
+ void GenerateClassXid(const GeneratorOptions& options,
256
+ io::Printer* printer,
257
+ const Descriptor* desc) const;
258
+ void GenerateOneofCaseDefinition(const GeneratorOptions& options,
259
+ io::Printer* printer,
260
+ const OneofDescriptor* oneof) const;
261
+ void GenerateClassToObject(const GeneratorOptions& options,
262
+ io::Printer* printer,
263
+ const Descriptor* desc) const;
264
+ void GenerateClassFieldToObject(const GeneratorOptions& options,
265
+ io::Printer* printer,
266
+ const FieldDescriptor* field) const;
267
+ void GenerateClassFromObject(const GeneratorOptions& options,
268
+ io::Printer* printer,
269
+ const Descriptor* desc) const;
270
+ void GenerateClassFieldFromObject(const GeneratorOptions& options,
271
+ io::Printer* printer,
272
+ const FieldDescriptor* field) const;
273
+ void GenerateClassClone(const GeneratorOptions& options,
274
+ io::Printer* printer,
275
+ const Descriptor* desc) const;
276
+ void GenerateClassRegistration(const GeneratorOptions& options,
277
+ io::Printer* printer,
278
+ const Descriptor* desc) const;
279
+ void GenerateClassFields(const GeneratorOptions& options,
280
+ io::Printer* printer,
281
+ const Descriptor* desc) const;
282
+ void GenerateClassField(const GeneratorOptions& options,
283
+ io::Printer* printer,
284
+ const FieldDescriptor* desc) const;
285
+ void GenerateClassExtensionFieldInfo(const GeneratorOptions& options,
286
+ io::Printer* printer,
287
+ const Descriptor* desc) const;
288
+ void GenerateClassDeserialize(const GeneratorOptions& options,
289
+ io::Printer* printer,
290
+ const Descriptor* desc) const;
291
+ void GenerateClassDeserializeBinary(const GeneratorOptions& options,
292
+ io::Printer* printer,
293
+ const Descriptor* desc) const;
294
+ void GenerateClassDeserializeBinaryField(const GeneratorOptions& options,
295
+ io::Printer* printer,
296
+ const FieldDescriptor* field) const;
297
+ void GenerateClassSerializeBinary(const GeneratorOptions& options,
298
+ io::Printer* printer,
299
+ const Descriptor* desc) const;
300
+ void GenerateClassSerializeBinaryField(const GeneratorOptions& options,
301
+ io::Printer* printer,
302
+ const FieldDescriptor* field) const;
303
+
304
+ // Generate definition for one enum.
305
+ void GenerateEnum(const GeneratorOptions& options,
306
+ io::Printer* printer,
307
+ const EnumDescriptor* enumdesc) const;
308
+
309
+ // Generate an extension definition.
310
+ void GenerateExtension(const GeneratorOptions& options,
311
+ io::Printer* printer,
312
+ const FieldDescriptor* field) const;
313
+
314
+ // Generate addFoo() method for repeated primitive fields.
315
+ void GenerateRepeatedPrimitiveHelperMethods(const GeneratorOptions& options,
316
+ io::Printer* printer,
317
+ const FieldDescriptor* field,
318
+ bool untyped) const;
319
+
320
+ // Generate addFoo() method for repeated message fields.
321
+ void GenerateRepeatedMessageHelperMethods(const GeneratorOptions& options,
322
+ io::Printer* printer,
323
+ const FieldDescriptor* field) const;
324
+
325
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Generator);
326
+ };
327
+
328
+ } // namespace js
329
+ } // namespace compiler
330
+ } // namespace protobuf
331
+
332
+ } // namespace google
333
+ #endif // GOOGLE_PROTOBUF_COMPILER_JS_GENERATOR_H__
kortex_api/include/google/protobuf/compiler/js/well_known_types_embed.h ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ #ifndef GOOGLE_PROTOBUF_COMPILER_JS_WELL_KNOWN_TYPES_EMBED_H__
32
+ #define GOOGLE_PROTOBUF_COMPILER_JS_WELL_KNOWN_TYPES_EMBED_H__
33
+
34
+ #include <stddef.h>
35
+
36
+ struct FileToc {
37
+ const char* name;
38
+ const char* data;
39
+ };
40
+
41
+ extern struct FileToc well_known_types_js[];
42
+
43
+ #endif // GOOGLE_PROTOBUF_COMPILER_JS_WELL_KNOWN_TYPES_EMBED_H__
kortex_api/include/google/protobuf/compiler/objectivec/objectivec_generator.h ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Protocol Buffers - Google's data interchange format
2
+ // Copyright 2008 Google Inc. All rights reserved.
3
+ // https://developers.google.com/protocol-buffers/
4
+ //
5
+ // Redistribution and use in source and binary forms, with or without
6
+ // modification, are permitted provided that the following conditions are
7
+ // met:
8
+ //
9
+ // * Redistributions of source code must retain the above copyright
10
+ // notice, this list of conditions and the following disclaimer.
11
+ // * Redistributions in binary form must reproduce the above
12
+ // copyright notice, this list of conditions and the following disclaimer
13
+ // in the documentation and/or other materials provided with the
14
+ // distribution.
15
+ // * Neither the name of Google Inc. nor the names of its
16
+ // contributors may be used to endorse or promote products derived from
17
+ // this software without specific prior written permission.
18
+ //
19
+ // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
+ // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ // Generates ObjectiveC code for a given .proto file.
32
+
33
+ #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
34
+ #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__
35
+
36
+ #include <string>
37
+ #include <google/protobuf/compiler/code_generator.h>
38
+
39
+ namespace google {
40
+ namespace protobuf {
41
+ namespace compiler {
42
+ namespace objectivec {
43
+
44
+ // CodeGenerator implementation which generates a ObjectiveC source file and
45
+ // header. If you create your own protocol compiler binary and you want it to
46
+ // support ObjectiveC output, you can do so by registering an instance of this
47
+ // CodeGenerator with the CommandLineInterface in your main() function.
48
+ class LIBPROTOC_EXPORT ObjectiveCGenerator : public CodeGenerator {
49
+ public:
50
+ ObjectiveCGenerator();
51
+ ~ObjectiveCGenerator();
52
+
53
+ // implements CodeGenerator ----------------------------------------
54
+ bool HasGenerateAll() const;
55
+ bool Generate(const FileDescriptor* file,
56
+ const string& parameter,
57
+ GeneratorContext* context,
58
+ string* error) const;
59
+ bool GenerateAll(const vector<const FileDescriptor*>& files,
60
+ const string& parameter,
61
+ GeneratorContext* context,
62
+ string* error) const;
63
+
64
+ private:
65
+ GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator);
66
+ };
67
+
68
+ } // namespace objectivec
69
+ } // namespace compiler
70
+ } // namespace protobuf
71
+ } // namespace google
72
+ #endif // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_GENERATOR_H__