ros melodic library with custom message
Dependents: Robot_team1_QEI_Douglas Robot_team1
ros_lib/smach_msgs/SmachContainerStatus.h@3:b964e3f71102, 2019-12-03 (annotated)
- Committer:
- florine_van
- Date:
- Tue Dec 03 09:39:29 2019 +0000
- Revision:
- 3:b964e3f71102
- Parent:
- 0:020db18a476d
Clean code and remove unused lines
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scarter1 | 0:020db18a476d | 1 | #ifndef _ROS_smach_msgs_SmachContainerStatus_h |
scarter1 | 0:020db18a476d | 2 | #define _ROS_smach_msgs_SmachContainerStatus_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 | #include "std_msgs/Header.h" |
scarter1 | 0:020db18a476d | 9 | |
scarter1 | 0:020db18a476d | 10 | namespace smach_msgs |
scarter1 | 0:020db18a476d | 11 | { |
scarter1 | 0:020db18a476d | 12 | |
scarter1 | 0:020db18a476d | 13 | class SmachContainerStatus : public ros::Msg |
scarter1 | 0:020db18a476d | 14 | { |
scarter1 | 0:020db18a476d | 15 | public: |
scarter1 | 0:020db18a476d | 16 | typedef std_msgs::Header _header_type; |
scarter1 | 0:020db18a476d | 17 | _header_type header; |
scarter1 | 0:020db18a476d | 18 | typedef const char* _path_type; |
scarter1 | 0:020db18a476d | 19 | _path_type path; |
scarter1 | 0:020db18a476d | 20 | uint32_t initial_states_length; |
scarter1 | 0:020db18a476d | 21 | typedef char* _initial_states_type; |
scarter1 | 0:020db18a476d | 22 | _initial_states_type st_initial_states; |
scarter1 | 0:020db18a476d | 23 | _initial_states_type * initial_states; |
scarter1 | 0:020db18a476d | 24 | uint32_t active_states_length; |
scarter1 | 0:020db18a476d | 25 | typedef char* _active_states_type; |
scarter1 | 0:020db18a476d | 26 | _active_states_type st_active_states; |
scarter1 | 0:020db18a476d | 27 | _active_states_type * active_states; |
scarter1 | 0:020db18a476d | 28 | typedef const char* _local_data_type; |
scarter1 | 0:020db18a476d | 29 | _local_data_type local_data; |
scarter1 | 0:020db18a476d | 30 | typedef const char* _info_type; |
scarter1 | 0:020db18a476d | 31 | _info_type info; |
scarter1 | 0:020db18a476d | 32 | |
scarter1 | 0:020db18a476d | 33 | SmachContainerStatus(): |
scarter1 | 0:020db18a476d | 34 | header(), |
scarter1 | 0:020db18a476d | 35 | path(""), |
scarter1 | 0:020db18a476d | 36 | initial_states_length(0), initial_states(NULL), |
scarter1 | 0:020db18a476d | 37 | active_states_length(0), active_states(NULL), |
scarter1 | 0:020db18a476d | 38 | local_data(""), |
scarter1 | 0:020db18a476d | 39 | info("") |
scarter1 | 0:020db18a476d | 40 | { |
scarter1 | 0:020db18a476d | 41 | } |
scarter1 | 0:020db18a476d | 42 | |
scarter1 | 0:020db18a476d | 43 | virtual int serialize(unsigned char *outbuffer) const |
scarter1 | 0:020db18a476d | 44 | { |
scarter1 | 0:020db18a476d | 45 | int offset = 0; |
scarter1 | 0:020db18a476d | 46 | offset += this->header.serialize(outbuffer + offset); |
scarter1 | 0:020db18a476d | 47 | uint32_t length_path = strlen(this->path); |
scarter1 | 0:020db18a476d | 48 | varToArr(outbuffer + offset, length_path); |
scarter1 | 0:020db18a476d | 49 | offset += 4; |
scarter1 | 0:020db18a476d | 50 | memcpy(outbuffer + offset, this->path, length_path); |
scarter1 | 0:020db18a476d | 51 | offset += length_path; |
scarter1 | 0:020db18a476d | 52 | *(outbuffer + offset + 0) = (this->initial_states_length >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 53 | *(outbuffer + offset + 1) = (this->initial_states_length >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 54 | *(outbuffer + offset + 2) = (this->initial_states_length >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 55 | *(outbuffer + offset + 3) = (this->initial_states_length >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 56 | offset += sizeof(this->initial_states_length); |
scarter1 | 0:020db18a476d | 57 | for( uint32_t i = 0; i < initial_states_length; i++){ |
scarter1 | 0:020db18a476d | 58 | uint32_t length_initial_statesi = strlen(this->initial_states[i]); |
scarter1 | 0:020db18a476d | 59 | varToArr(outbuffer + offset, length_initial_statesi); |
scarter1 | 0:020db18a476d | 60 | offset += 4; |
scarter1 | 0:020db18a476d | 61 | memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi); |
scarter1 | 0:020db18a476d | 62 | offset += length_initial_statesi; |
scarter1 | 0:020db18a476d | 63 | } |
scarter1 | 0:020db18a476d | 64 | *(outbuffer + offset + 0) = (this->active_states_length >> (8 * 0)) & 0xFF; |
scarter1 | 0:020db18a476d | 65 | *(outbuffer + offset + 1) = (this->active_states_length >> (8 * 1)) & 0xFF; |
scarter1 | 0:020db18a476d | 66 | *(outbuffer + offset + 2) = (this->active_states_length >> (8 * 2)) & 0xFF; |
scarter1 | 0:020db18a476d | 67 | *(outbuffer + offset + 3) = (this->active_states_length >> (8 * 3)) & 0xFF; |
scarter1 | 0:020db18a476d | 68 | offset += sizeof(this->active_states_length); |
scarter1 | 0:020db18a476d | 69 | for( uint32_t i = 0; i < active_states_length; i++){ |
scarter1 | 0:020db18a476d | 70 | uint32_t length_active_statesi = strlen(this->active_states[i]); |
scarter1 | 0:020db18a476d | 71 | varToArr(outbuffer + offset, length_active_statesi); |
scarter1 | 0:020db18a476d | 72 | offset += 4; |
scarter1 | 0:020db18a476d | 73 | memcpy(outbuffer + offset, this->active_states[i], length_active_statesi); |
scarter1 | 0:020db18a476d | 74 | offset += length_active_statesi; |
scarter1 | 0:020db18a476d | 75 | } |
scarter1 | 0:020db18a476d | 76 | uint32_t length_local_data = strlen(this->local_data); |
scarter1 | 0:020db18a476d | 77 | varToArr(outbuffer + offset, length_local_data); |
scarter1 | 0:020db18a476d | 78 | offset += 4; |
scarter1 | 0:020db18a476d | 79 | memcpy(outbuffer + offset, this->local_data, length_local_data); |
scarter1 | 0:020db18a476d | 80 | offset += length_local_data; |
scarter1 | 0:020db18a476d | 81 | uint32_t length_info = strlen(this->info); |
scarter1 | 0:020db18a476d | 82 | varToArr(outbuffer + offset, length_info); |
scarter1 | 0:020db18a476d | 83 | offset += 4; |
scarter1 | 0:020db18a476d | 84 | memcpy(outbuffer + offset, this->info, length_info); |
scarter1 | 0:020db18a476d | 85 | offset += length_info; |
scarter1 | 0:020db18a476d | 86 | return offset; |
scarter1 | 0:020db18a476d | 87 | } |
scarter1 | 0:020db18a476d | 88 | |
scarter1 | 0:020db18a476d | 89 | virtual int deserialize(unsigned char *inbuffer) |
scarter1 | 0:020db18a476d | 90 | { |
scarter1 | 0:020db18a476d | 91 | int offset = 0; |
scarter1 | 0:020db18a476d | 92 | offset += this->header.deserialize(inbuffer + offset); |
scarter1 | 0:020db18a476d | 93 | uint32_t length_path; |
scarter1 | 0:020db18a476d | 94 | arrToVar(length_path, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 95 | offset += 4; |
scarter1 | 0:020db18a476d | 96 | for(unsigned int k= offset; k< offset+length_path; ++k){ |
scarter1 | 0:020db18a476d | 97 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 98 | } |
scarter1 | 0:020db18a476d | 99 | inbuffer[offset+length_path-1]=0; |
scarter1 | 0:020db18a476d | 100 | this->path = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 101 | offset += length_path; |
scarter1 | 0:020db18a476d | 102 | uint32_t initial_states_lengthT = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 103 | initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 104 | initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 105 | initial_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 106 | offset += sizeof(this->initial_states_length); |
scarter1 | 0:020db18a476d | 107 | if(initial_states_lengthT > initial_states_length) |
scarter1 | 0:020db18a476d | 108 | this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*)); |
scarter1 | 0:020db18a476d | 109 | initial_states_length = initial_states_lengthT; |
scarter1 | 0:020db18a476d | 110 | for( uint32_t i = 0; i < initial_states_length; i++){ |
scarter1 | 0:020db18a476d | 111 | uint32_t length_st_initial_states; |
scarter1 | 0:020db18a476d | 112 | arrToVar(length_st_initial_states, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 113 | offset += 4; |
scarter1 | 0:020db18a476d | 114 | for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){ |
scarter1 | 0:020db18a476d | 115 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 116 | } |
scarter1 | 0:020db18a476d | 117 | inbuffer[offset+length_st_initial_states-1]=0; |
scarter1 | 0:020db18a476d | 118 | this->st_initial_states = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 119 | offset += length_st_initial_states; |
scarter1 | 0:020db18a476d | 120 | memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*)); |
scarter1 | 0:020db18a476d | 121 | } |
scarter1 | 0:020db18a476d | 122 | uint32_t active_states_lengthT = ((uint32_t) (*(inbuffer + offset))); |
scarter1 | 0:020db18a476d | 123 | active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
scarter1 | 0:020db18a476d | 124 | active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
scarter1 | 0:020db18a476d | 125 | active_states_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
scarter1 | 0:020db18a476d | 126 | offset += sizeof(this->active_states_length); |
scarter1 | 0:020db18a476d | 127 | if(active_states_lengthT > active_states_length) |
scarter1 | 0:020db18a476d | 128 | this->active_states = (char**)realloc(this->active_states, active_states_lengthT * sizeof(char*)); |
scarter1 | 0:020db18a476d | 129 | active_states_length = active_states_lengthT; |
scarter1 | 0:020db18a476d | 130 | for( uint32_t i = 0; i < active_states_length; i++){ |
scarter1 | 0:020db18a476d | 131 | uint32_t length_st_active_states; |
scarter1 | 0:020db18a476d | 132 | arrToVar(length_st_active_states, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 133 | offset += 4; |
scarter1 | 0:020db18a476d | 134 | for(unsigned int k= offset; k< offset+length_st_active_states; ++k){ |
scarter1 | 0:020db18a476d | 135 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 136 | } |
scarter1 | 0:020db18a476d | 137 | inbuffer[offset+length_st_active_states-1]=0; |
scarter1 | 0:020db18a476d | 138 | this->st_active_states = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 139 | offset += length_st_active_states; |
scarter1 | 0:020db18a476d | 140 | memcpy( &(this->active_states[i]), &(this->st_active_states), sizeof(char*)); |
scarter1 | 0:020db18a476d | 141 | } |
scarter1 | 0:020db18a476d | 142 | uint32_t length_local_data; |
scarter1 | 0:020db18a476d | 143 | arrToVar(length_local_data, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 144 | offset += 4; |
scarter1 | 0:020db18a476d | 145 | for(unsigned int k= offset; k< offset+length_local_data; ++k){ |
scarter1 | 0:020db18a476d | 146 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 147 | } |
scarter1 | 0:020db18a476d | 148 | inbuffer[offset+length_local_data-1]=0; |
scarter1 | 0:020db18a476d | 149 | this->local_data = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 150 | offset += length_local_data; |
scarter1 | 0:020db18a476d | 151 | uint32_t length_info; |
scarter1 | 0:020db18a476d | 152 | arrToVar(length_info, (inbuffer + offset)); |
scarter1 | 0:020db18a476d | 153 | offset += 4; |
scarter1 | 0:020db18a476d | 154 | for(unsigned int k= offset; k< offset+length_info; ++k){ |
scarter1 | 0:020db18a476d | 155 | inbuffer[k-1]=inbuffer[k]; |
scarter1 | 0:020db18a476d | 156 | } |
scarter1 | 0:020db18a476d | 157 | inbuffer[offset+length_info-1]=0; |
scarter1 | 0:020db18a476d | 158 | this->info = (char *)(inbuffer + offset-1); |
scarter1 | 0:020db18a476d | 159 | offset += length_info; |
scarter1 | 0:020db18a476d | 160 | return offset; |
scarter1 | 0:020db18a476d | 161 | } |
scarter1 | 0:020db18a476d | 162 | |
scarter1 | 0:020db18a476d | 163 | const char * getType(){ return "smach_msgs/SmachContainerStatus"; }; |
scarter1 | 0:020db18a476d | 164 | const char * getMD5(){ return "5ba2bb79ac19e3842d562a191f2a675b"; }; |
scarter1 | 0:020db18a476d | 165 | |
scarter1 | 0:020db18a476d | 166 | }; |
scarter1 | 0:020db18a476d | 167 | |
scarter1 | 0:020db18a476d | 168 | } |
scarter1 | 0:020db18a476d | 169 | #endif |