No description
visualization_msgs/MenuEntry.h@3:d7bea56ad88b, 2020-03-30 (annotated)
- Committer:
- Anaph
- Date:
- Mon Mar 30 22:15:01 2020 +0000
- Revision:
- 3:d7bea56ad88b
- Parent:
- 0:9e9b7db60fd5
No description
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_visualization_msgs_MenuEntry_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_visualization_msgs_MenuEntry_h |
garyservin | 0:9e9b7db60fd5 | 3 | |
garyservin | 0:9e9b7db60fd5 | 4 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 7 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 8 | |
garyservin | 0:9e9b7db60fd5 | 9 | namespace visualization_msgs |
garyservin | 0:9e9b7db60fd5 | 10 | { |
garyservin | 0:9e9b7db60fd5 | 11 | |
garyservin | 0:9e9b7db60fd5 | 12 | class MenuEntry : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 13 | { |
garyservin | 0:9e9b7db60fd5 | 14 | public: |
garyservin | 0:9e9b7db60fd5 | 15 | typedef uint32_t _id_type; |
garyservin | 0:9e9b7db60fd5 | 16 | _id_type id; |
garyservin | 0:9e9b7db60fd5 | 17 | typedef uint32_t _parent_id_type; |
garyservin | 0:9e9b7db60fd5 | 18 | _parent_id_type parent_id; |
garyservin | 0:9e9b7db60fd5 | 19 | typedef const char* _title_type; |
garyservin | 0:9e9b7db60fd5 | 20 | _title_type title; |
garyservin | 0:9e9b7db60fd5 | 21 | typedef const char* _command_type; |
garyservin | 0:9e9b7db60fd5 | 22 | _command_type command; |
garyservin | 0:9e9b7db60fd5 | 23 | typedef uint8_t _command_type_type; |
garyservin | 0:9e9b7db60fd5 | 24 | _command_type_type command_type; |
garyservin | 0:9e9b7db60fd5 | 25 | enum { FEEDBACK = 0 }; |
garyservin | 0:9e9b7db60fd5 | 26 | enum { ROSRUN = 1 }; |
garyservin | 0:9e9b7db60fd5 | 27 | enum { ROSLAUNCH = 2 }; |
garyservin | 0:9e9b7db60fd5 | 28 | |
garyservin | 0:9e9b7db60fd5 | 29 | MenuEntry(): |
garyservin | 0:9e9b7db60fd5 | 30 | id(0), |
garyservin | 0:9e9b7db60fd5 | 31 | parent_id(0), |
garyservin | 0:9e9b7db60fd5 | 32 | title(""), |
garyservin | 0:9e9b7db60fd5 | 33 | command(""), |
garyservin | 0:9e9b7db60fd5 | 34 | command_type(0) |
garyservin | 0:9e9b7db60fd5 | 35 | { |
garyservin | 0:9e9b7db60fd5 | 36 | } |
garyservin | 0:9e9b7db60fd5 | 37 | |
garyservin | 0:9e9b7db60fd5 | 38 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 39 | { |
garyservin | 0:9e9b7db60fd5 | 40 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 41 | *(outbuffer + offset + 0) = (this->id >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 42 | *(outbuffer + offset + 1) = (this->id >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 43 | *(outbuffer + offset + 2) = (this->id >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 44 | *(outbuffer + offset + 3) = (this->id >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 45 | offset += sizeof(this->id); |
garyservin | 0:9e9b7db60fd5 | 46 | *(outbuffer + offset + 0) = (this->parent_id >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 47 | *(outbuffer + offset + 1) = (this->parent_id >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 48 | *(outbuffer + offset + 2) = (this->parent_id >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 49 | *(outbuffer + offset + 3) = (this->parent_id >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 50 | offset += sizeof(this->parent_id); |
garyservin | 0:9e9b7db60fd5 | 51 | uint32_t length_title = strlen(this->title); |
garyservin | 0:9e9b7db60fd5 | 52 | varToArr(outbuffer + offset, length_title); |
garyservin | 0:9e9b7db60fd5 | 53 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 54 | memcpy(outbuffer + offset, this->title, length_title); |
garyservin | 0:9e9b7db60fd5 | 55 | offset += length_title; |
garyservin | 0:9e9b7db60fd5 | 56 | uint32_t length_command = strlen(this->command); |
garyservin | 0:9e9b7db60fd5 | 57 | varToArr(outbuffer + offset, length_command); |
garyservin | 0:9e9b7db60fd5 | 58 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 59 | memcpy(outbuffer + offset, this->command, length_command); |
garyservin | 0:9e9b7db60fd5 | 60 | offset += length_command; |
garyservin | 0:9e9b7db60fd5 | 61 | *(outbuffer + offset + 0) = (this->command_type >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 62 | offset += sizeof(this->command_type); |
garyservin | 0:9e9b7db60fd5 | 63 | return offset; |
garyservin | 0:9e9b7db60fd5 | 64 | } |
garyservin | 0:9e9b7db60fd5 | 65 | |
garyservin | 0:9e9b7db60fd5 | 66 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 67 | { |
garyservin | 0:9e9b7db60fd5 | 68 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 69 | this->id = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 70 | this->id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 71 | this->id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 72 | this->id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 73 | offset += sizeof(this->id); |
garyservin | 0:9e9b7db60fd5 | 74 | this->parent_id = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 75 | this->parent_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 76 | this->parent_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 77 | this->parent_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 78 | offset += sizeof(this->parent_id); |
garyservin | 0:9e9b7db60fd5 | 79 | uint32_t length_title; |
garyservin | 0:9e9b7db60fd5 | 80 | arrToVar(length_title, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 81 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 82 | for(unsigned int k= offset; k< offset+length_title; ++k){ |
garyservin | 0:9e9b7db60fd5 | 83 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 84 | } |
garyservin | 0:9e9b7db60fd5 | 85 | inbuffer[offset+length_title-1]=0; |
garyservin | 0:9e9b7db60fd5 | 86 | this->title = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 87 | offset += length_title; |
garyservin | 0:9e9b7db60fd5 | 88 | uint32_t length_command; |
garyservin | 0:9e9b7db60fd5 | 89 | arrToVar(length_command, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 90 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 91 | for(unsigned int k= offset; k< offset+length_command; ++k){ |
garyservin | 0:9e9b7db60fd5 | 92 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 93 | } |
garyservin | 0:9e9b7db60fd5 | 94 | inbuffer[offset+length_command-1]=0; |
garyservin | 0:9e9b7db60fd5 | 95 | this->command = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 96 | offset += length_command; |
garyservin | 0:9e9b7db60fd5 | 97 | this->command_type = ((uint8_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 98 | offset += sizeof(this->command_type); |
garyservin | 0:9e9b7db60fd5 | 99 | return offset; |
garyservin | 0:9e9b7db60fd5 | 100 | } |
garyservin | 0:9e9b7db60fd5 | 101 | |
garyservin | 0:9e9b7db60fd5 | 102 | const char * getType(){ return "visualization_msgs/MenuEntry"; }; |
garyservin | 0:9e9b7db60fd5 | 103 | const char * getMD5(){ return "b90ec63024573de83b57aa93eb39be2d"; }; |
garyservin | 0:9e9b7db60fd5 | 104 | |
garyservin | 0:9e9b7db60fd5 | 105 | }; |
garyservin | 0:9e9b7db60fd5 | 106 | |
garyservin | 0:9e9b7db60fd5 | 107 | } |
garyservin | 0:9e9b7db60fd5 | 108 | #endif |