message-print.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include <iostream>
7 
8 #include "t265-messages.h"
9 using namespace t265;
10 
11 #define map_str(X) {X, #X}
12 std::map<BULK_MESSAGE_ID, std::string> bulk_message_names = {
64 };
65 
66 std::map<CONTROL_MESSAGE_ID, std::string> control_message_names = {
70 };
71 
72 
73 template <typename T>
74 static std::string message_name(const T & header) {
75  auto id = BULK_MESSAGE_ID(header.wMessageID);
76  if(bulk_message_names.count(id) != 0) {
77  return bulk_message_names.at(id);
78  }
79  std::stringstream s;
80  s << std::hex << "UNKNOWN ID 0x" << id;
81  return s.str();
82 }
83 
84 std::map<MESSAGE_STATUS, std::string> message_status_names = {
105 };
106 
107 template <typename T>
108 static std::string status_name(const T & header) {
109  auto id = MESSAGE_STATUS(header.wStatus);
110  if(message_status_names.count(id) != 0) {
111  return message_status_names.at(id);
112  }
113  std::stringstream s;
114  s << std::hex << "UNKNOWN STATUS at 0x" << id;
115  return s.str();
116 }
117 
MESSAGE_STATUS
Defines all bulk message return statuses.
GLdouble s
std::map< MESSAGE_STATUS, std::string > message_status_names
Definition: message-print.h:84
GLsizei const GLchar *const * string
std_msgs::Header * header(M &m)
returns Header<M>::pointer(m);
GLenum GLuint id
static std::string message_name(const T &header)
Definition: message-print.h:74
std::map< BULK_MESSAGE_ID, std::string > bulk_message_names
Definition: message-print.h:12
static std::string status_name(const T &header)
#define map_str(X)
Definition: message-print.h:11
std::map< CONTROL_MESSAGE_ID, std::string > control_message_names
Definition: message-print.h:66
BULK_MESSAGE_ID
Defines all bulk messages ids.


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:21