ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/dynamic_reconfigure/ParamDescription.h@0:020db18a476d, 2019-10-30 (annotated)
- Committer:
- scarter1
- Date:
- Wed Oct 30 14:59:49 2019 +0000
- Revision:
- 0:020db18a476d
melodic library;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_dynamic_reconfigure_ParamDescription_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_dynamic_reconfigure_ParamDescription_h |
scarter1 | 0:020db18a476d | 3 | |
scarter1 | 0:020db18a476d | 4 | #include <stdint.h> |
scarter1 | 0:020db18a476d | 5 | #include <string.h> |
scarter1 | 0:020db18a476d | 6 | #include <stdlib.h> |
scarter1 | 0:020db18a476d | 7 | #include "ros/msg.h" |
scarter1 | 0:020db18a476d | 8 | |
scarter1 | 0:020db18a476d | 9 | namespace dynamic_reconfigure |
scarter1 | 0:020db18a476d | 10 | { |
scarter1 | 0:020db18a476d | 11 | |
scarter1 | 0:020db18a476d | 12 | class ParamDescription : public ros::Msg |
scarter1 | 0:020db18a476d | 13 | { |
scarter1 | 0:020db18a476d | 14 | public: |
scarter1 | 0:020db18a476d | 15 | typedef const char* _name_type; |
scarter1 | 0:020db18a476d | 16 | _name_type name; |
scarter1 | 0:020db18a476d | 17 | typedef const char* _type_type; |
scarter1 | 0:020db18a476d | 18 | _type_type type; |
scarter1 | 0:020db18a476d | 19 | typedef uint32_t _level_type; |
scarter1 | 0:020db18a476d | 20 | _level_type level; |
scarter1 | 0:020db18a476d | 21 | typedef const char* _description_type; |
scarter1 | 0:020db18a476d | 22 | _description_type description; |
scarter1 | 0:020db18a476d | 23 | typedef const char* _edit_method_type; |
scarter1 | 0:020db18a476d | 24 | _edit_method_type edit_method; |
scarter1 | 0:020db18a476d | 25 | |
scarter1 | 0:020db18a476d | 26 | ParamDescription(): |
scarter1 | 0:020db18a476d | 27 | name(""), |
scarter1 | 0:020db18a476d | 28 | type(""), |
scarter1 | 0:020db18a476d | 29 | level(0), |
scarter1 | 0:020db18a476d | 30 | description(""), |
scarter1 | 0:020db18a476d | 31 | edit_method("") |
scarter1 | 0:020db18a476d | 32 | { |
scarter1 | 0:020db18a476d | 33 | } |
scarter1 | 0:020db18a476d | 34 | |
scarter1 | 0:020db18a476d | 35 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 36 | { |
scarter1 | 0:020db18a476d | 37 | int offset = 0; |
scarter1 | 0:020db18a476d | 38 | uint32_t length_name = strlen(this->name); |
scarter1 | 0:020db18a476d | 39 | varToArr(outbuffer + offset, length_name); |
scarter1 | 0:020db18a476d | 40 | offset += 4; |
scarter1 | 0:020db18a476d | 41 | memcpy(outbuffer + offset, this->name, length_name); |
scarter1 | 0:020db18a476d | 42 | offset += length_name; |
scarter1 | 0:020db18a476d | 43 | uint32_t length_type = strlen(this->type); |
scarter1 | 0:020db18a476d | 44 | varToArr(outbuffer + offset, length_type); |
scarter1 | 0:020db18a476d | 45 | offset += 4; |
scarter1 | 0:020db18a476d | 46 | memcpy(outbuffer + offset, this->type, length_type); |
scarter1 | 0:020db18a476d | 47 | offset += length_type; |
scarter1 | 0:020db18a476d | 48 | *(outbuffer + offset + 0) = (this->level >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 49 | *(outbuffer + offset + 1) = (this->level >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 50 | *(outbuffer + offset + 2) = (this->level >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 51 | *(outbuffer + offset + 3) = (this->level >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 52 | offset += sizeof(this->level); |
scarter1 | 0:020db18a476d | 53 | uint32_t length_description = strlen(this->description); |
scarter1 | 0:020db18a476d | 54 | varToArr(outbuffer + offset, length_description); |
scarter1 | 0:020db18a476d | 55 | offset += 4; |
scarter1 | 0:020db18a476d | 56 | memcpy(outbuffer + offset, this->description, length_description); |
scarter1 | 0:020db18a476d | 57 | offset += length_description; |
scarter1 | 0:020db18a476d | 58 | uint32_t length_edit_method = strlen(this->edit_method); |
scarter1 | 0:020db18a476d | 59 | varToArr(outbuffer + offset, length_edit_method); |
scarter1 | 0:020db18a476d | 60 | offset += 4; |
scarter1 | 0:020db18a476d | 61 | memcpy(outbuffer + offset, this->edit_method, length_edit_method); |
scarter1 | 0:020db18a476d | 62 | offset += length_edit_method; |
scarter1 | 0:020db18a476d | 63 | return offset; |
scarter1 | 0:020db18a476d | 64 | } |
scarter1 | 0:020db18a476d | 65 | |
scarter1 | 0:020db18a476d | 66 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 67 | { |
scarter1 | 0:020db18a476d | 68 | int offset = 0; |
scarter1 | 0:020db18a476d | 69 | uint32_t length_name; |
scarter1 | 0:020db18a476d | 70 | arrToVar(length_name, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 71 | offset += 4; |
scarter1 | 0:020db18a476d | 72 | for(unsigned int k= offset; k< offset+length_name; ++k){ |
scarter1 | 0:020db18a476d | 73 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 74 | } |
scarter1 | 0:020db18a476d | 75 | inbuffer[offset+length_name-1]=0; |
scarter1 | 0:020db18a476d | 76 | this->name = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 77 | offset += length_name; |
scarter1 | 0:020db18a476d | 78 | uint32_t length_type; |
scarter1 | 0:020db18a476d | 79 | arrToVar(length_type, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 80 | offset += 4; |
scarter1 | 0:020db18a476d | 81 | for(unsigned int k= offset; k< offset+length_type; ++k){ |
scarter1 | 0:020db18a476d | 82 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 83 | } |
scarter1 | 0:020db18a476d | 84 | inbuffer[offset+length_type-1]=0; |
scarter1 | 0:020db18a476d | 85 | this->type = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 86 | offset += length_type; |
scarter1 | 0:020db18a476d | 87 | this->level = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 88 | this->level |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 89 | this->level |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 90 | this->level |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 91 | offset += sizeof(this->level); |
scarter1 | 0:020db18a476d | 92 | uint32_t length_description; |
scarter1 | 0:020db18a476d | 93 | arrToVar(length_description, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 94 | offset += 4; |
scarter1 | 0:020db18a476d | 95 | for(unsigned int k= offset; k< offset+length_description; ++k){ |
scarter1 | 0:020db18a476d | 96 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 97 | } |
scarter1 | 0:020db18a476d | 98 | inbuffer[offset+length_description-1]=0; |
scarter1 | 0:020db18a476d | 99 | this->description = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 100 | offset += length_description; |
scarter1 | 0:020db18a476d | 101 | uint32_t length_edit_method; |
scarter1 | 0:020db18a476d | 102 | arrToVar(length_edit_method, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 103 | offset += 4; |
scarter1 | 0:020db18a476d | 104 | for(unsigned int k= offset; k< offset+length_edit_method; ++k){ |
scarter1 | 0:020db18a476d | 105 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 106 | } |
scarter1 | 0:020db18a476d | 107 | inbuffer[offset+length_edit_method-1]=0; |
scarter1 | 0:020db18a476d | 108 | this->edit_method = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 109 | offset += length_edit_method; |
scarter1 | 0:020db18a476d | 110 | return offset; |
scarter1 | 0:020db18a476d | 111 | } |
scarter1 | 0:020db18a476d | 112 | |
scarter1 | 0:020db18a476d | 113 | const char * getType(){ return "dynamic_reconfigure/ParamDescription"; }; |
scarter1 | 0:020db18a476d | 114 | const char * getMD5(){ return "7434fcb9348c13054e0c3b267c8cb34d"; }; |
scarter1 | 0:020db18a476d | 115 | |
scarter1 | 0:020db18a476d | 116 | }; |
scarter1 | 0:020db18a476d | 117 | |
scarter1 | 0:020db18a476d | 118 | } |
scarter1 | 0:020db18a476d | 119 | #endif |