ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
dynamic_reconfigure/Config.h@2:65cba0dcf634, 2022-01-27 (annotated)
- Committer:
- gosari
- Date:
- Thu Jan 27 11:36:16 2022 +0000
- Revision:
- 2:65cba0dcf634
- Parent:
- 0:9e9b7db60fd5
for message communication with mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_dynamic_reconfigure_Config_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_dynamic_reconfigure_Config_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 | #include "dynamic_reconfigure/BoolParameter.h" |
garyservin | 0:9e9b7db60fd5 | 9 | #include "dynamic_reconfigure/IntParameter.h" |
garyservin | 0:9e9b7db60fd5 | 10 | #include "dynamic_reconfigure/StrParameter.h" |
garyservin | 0:9e9b7db60fd5 | 11 | #include "dynamic_reconfigure/DoubleParameter.h" |
garyservin | 0:9e9b7db60fd5 | 12 | #include "dynamic_reconfigure/GroupState.h" |
garyservin | 0:9e9b7db60fd5 | 13 | |
garyservin | 0:9e9b7db60fd5 | 14 | namespace dynamic_reconfigure |
garyservin | 0:9e9b7db60fd5 | 15 | { |
garyservin | 0:9e9b7db60fd5 | 16 | |
garyservin | 0:9e9b7db60fd5 | 17 | class Config : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 18 | { |
garyservin | 0:9e9b7db60fd5 | 19 | public: |
garyservin | 0:9e9b7db60fd5 | 20 | uint32_t bools_length; |
garyservin | 0:9e9b7db60fd5 | 21 | typedef dynamic_reconfigure::BoolParameter _bools_type; |
garyservin | 0:9e9b7db60fd5 | 22 | _bools_type st_bools; |
garyservin | 0:9e9b7db60fd5 | 23 | _bools_type * bools; |
garyservin | 0:9e9b7db60fd5 | 24 | uint32_t ints_length; |
garyservin | 0:9e9b7db60fd5 | 25 | typedef dynamic_reconfigure::IntParameter _ints_type; |
garyservin | 0:9e9b7db60fd5 | 26 | _ints_type st_ints; |
garyservin | 0:9e9b7db60fd5 | 27 | _ints_type * ints; |
garyservin | 0:9e9b7db60fd5 | 28 | uint32_t strs_length; |
garyservin | 0:9e9b7db60fd5 | 29 | typedef dynamic_reconfigure::StrParameter _strs_type; |
garyservin | 0:9e9b7db60fd5 | 30 | _strs_type st_strs; |
garyservin | 0:9e9b7db60fd5 | 31 | _strs_type * strs; |
garyservin | 0:9e9b7db60fd5 | 32 | uint32_t doubles_length; |
garyservin | 0:9e9b7db60fd5 | 33 | typedef dynamic_reconfigure::DoubleParameter _doubles_type; |
garyservin | 0:9e9b7db60fd5 | 34 | _doubles_type st_doubles; |
garyservin | 0:9e9b7db60fd5 | 35 | _doubles_type * doubles; |
garyservin | 0:9e9b7db60fd5 | 36 | uint32_t groups_length; |
garyservin | 0:9e9b7db60fd5 | 37 | typedef dynamic_reconfigure::GroupState _groups_type; |
garyservin | 0:9e9b7db60fd5 | 38 | _groups_type st_groups; |
garyservin | 0:9e9b7db60fd5 | 39 | _groups_type * groups; |
garyservin | 0:9e9b7db60fd5 | 40 | |
garyservin | 0:9e9b7db60fd5 | 41 | Config(): |
garyservin | 0:9e9b7db60fd5 | 42 | bools_length(0), bools(NULL), |
garyservin | 0:9e9b7db60fd5 | 43 | ints_length(0), ints(NULL), |
garyservin | 0:9e9b7db60fd5 | 44 | strs_length(0), strs(NULL), |
garyservin | 0:9e9b7db60fd5 | 45 | doubles_length(0), doubles(NULL), |
garyservin | 0:9e9b7db60fd5 | 46 | groups_length(0), groups(NULL) |
garyservin | 0:9e9b7db60fd5 | 47 | { |
garyservin | 0:9e9b7db60fd5 | 48 | } |
garyservin | 0:9e9b7db60fd5 | 49 | |
garyservin | 0:9e9b7db60fd5 | 50 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 51 | { |
garyservin | 0:9e9b7db60fd5 | 52 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 53 | *(outbuffer + offset + 0) = (this->bools_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 54 | *(outbuffer + offset + 1) = (this->bools_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 55 | *(outbuffer + offset + 2) = (this->bools_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 56 | *(outbuffer + offset + 3) = (this->bools_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 57 | offset += sizeof(this->bools_length); |
garyservin | 0:9e9b7db60fd5 | 58 | for( uint32_t i = 0; i < bools_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 59 | offset += this->bools[i].serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 60 | } |
garyservin | 0:9e9b7db60fd5 | 61 | *(outbuffer + offset + 0) = (this->ints_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 62 | *(outbuffer + offset + 1) = (this->ints_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 63 | *(outbuffer + offset + 2) = (this->ints_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 64 | *(outbuffer + offset + 3) = (this->ints_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 65 | offset += sizeof(this->ints_length); |
garyservin | 0:9e9b7db60fd5 | 66 | for( uint32_t i = 0; i < ints_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 67 | offset += this->ints[i].serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 68 | } |
garyservin | 0:9e9b7db60fd5 | 69 | *(outbuffer + offset + 0) = (this->strs_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 70 | *(outbuffer + offset + 1) = (this->strs_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 71 | *(outbuffer + offset + 2) = (this->strs_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 72 | *(outbuffer + offset + 3) = (this->strs_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 73 | offset += sizeof(this->strs_length); |
garyservin | 0:9e9b7db60fd5 | 74 | for( uint32_t i = 0; i < strs_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 75 | offset += this->strs[i].serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 76 | } |
garyservin | 0:9e9b7db60fd5 | 77 | *(outbuffer + offset + 0) = (this->doubles_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 78 | *(outbuffer + offset + 1) = (this->doubles_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 79 | *(outbuffer + offset + 2) = (this->doubles_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 80 | *(outbuffer + offset + 3) = (this->doubles_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 81 | offset += sizeof(this->doubles_length); |
garyservin | 0:9e9b7db60fd5 | 82 | for( uint32_t i = 0; i < doubles_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 83 | offset += this->doubles[i].serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 84 | } |
garyservin | 0:9e9b7db60fd5 | 85 | *(outbuffer + offset + 0) = (this->groups_length >> (8 * 0)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 86 | *(outbuffer + offset + 1) = (this->groups_length >> (8 * 1)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 87 | *(outbuffer + offset + 2) = (this->groups_length >> (8 * 2)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 88 | *(outbuffer + offset + 3) = (this->groups_length >> (8 * 3)) & 0xFF; |
garyservin | 0:9e9b7db60fd5 | 89 | offset += sizeof(this->groups_length); |
garyservin | 0:9e9b7db60fd5 | 90 | for( uint32_t i = 0; i < groups_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 91 | offset += this->groups[i].serialize(outbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 92 | } |
garyservin | 0:9e9b7db60fd5 | 93 | return offset; |
garyservin | 0:9e9b7db60fd5 | 94 | } |
garyservin | 0:9e9b7db60fd5 | 95 | |
garyservin | 0:9e9b7db60fd5 | 96 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 97 | { |
garyservin | 0:9e9b7db60fd5 | 98 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 99 | uint32_t bools_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 100 | bools_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 101 | bools_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 102 | bools_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 103 | offset += sizeof(this->bools_length); |
garyservin | 0:9e9b7db60fd5 | 104 | if(bools_lengthT > bools_length) |
garyservin | 0:9e9b7db60fd5 | 105 | this->bools = (dynamic_reconfigure::BoolParameter*)realloc(this->bools, bools_lengthT * sizeof(dynamic_reconfigure::BoolParameter)); |
garyservin | 0:9e9b7db60fd5 | 106 | bools_length = bools_lengthT; |
garyservin | 0:9e9b7db60fd5 | 107 | for( uint32_t i = 0; i < bools_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 108 | offset += this->st_bools.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 109 | memcpy( &(this->bools[i]), &(this->st_bools), sizeof(dynamic_reconfigure::BoolParameter)); |
garyservin | 0:9e9b7db60fd5 | 110 | } |
garyservin | 0:9e9b7db60fd5 | 111 | uint32_t ints_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 112 | ints_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 113 | ints_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 114 | ints_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 115 | offset += sizeof(this->ints_length); |
garyservin | 0:9e9b7db60fd5 | 116 | if(ints_lengthT > ints_length) |
garyservin | 0:9e9b7db60fd5 | 117 | this->ints = (dynamic_reconfigure::IntParameter*)realloc(this->ints, ints_lengthT * sizeof(dynamic_reconfigure::IntParameter)); |
garyservin | 0:9e9b7db60fd5 | 118 | ints_length = ints_lengthT; |
garyservin | 0:9e9b7db60fd5 | 119 | for( uint32_t i = 0; i < ints_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 120 | offset += this->st_ints.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 121 | memcpy( &(this->ints[i]), &(this->st_ints), sizeof(dynamic_reconfigure::IntParameter)); |
garyservin | 0:9e9b7db60fd5 | 122 | } |
garyservin | 0:9e9b7db60fd5 | 123 | uint32_t strs_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 124 | strs_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 125 | strs_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 126 | strs_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 127 | offset += sizeof(this->strs_length); |
garyservin | 0:9e9b7db60fd5 | 128 | if(strs_lengthT > strs_length) |
garyservin | 0:9e9b7db60fd5 | 129 | this->strs = (dynamic_reconfigure::StrParameter*)realloc(this->strs, strs_lengthT * sizeof(dynamic_reconfigure::StrParameter)); |
garyservin | 0:9e9b7db60fd5 | 130 | strs_length = strs_lengthT; |
garyservin | 0:9e9b7db60fd5 | 131 | for( uint32_t i = 0; i < strs_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 132 | offset += this->st_strs.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 133 | memcpy( &(this->strs[i]), &(this->st_strs), sizeof(dynamic_reconfigure::StrParameter)); |
garyservin | 0:9e9b7db60fd5 | 134 | } |
garyservin | 0:9e9b7db60fd5 | 135 | uint32_t doubles_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 136 | doubles_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 137 | doubles_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 138 | doubles_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 139 | offset += sizeof(this->doubles_length); |
garyservin | 0:9e9b7db60fd5 | 140 | if(doubles_lengthT > doubles_length) |
garyservin | 0:9e9b7db60fd5 | 141 | this->doubles = (dynamic_reconfigure::DoubleParameter*)realloc(this->doubles, doubles_lengthT * sizeof(dynamic_reconfigure::DoubleParameter)); |
garyservin | 0:9e9b7db60fd5 | 142 | doubles_length = doubles_lengthT; |
garyservin | 0:9e9b7db60fd5 | 143 | for( uint32_t i = 0; i < doubles_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 144 | offset += this->st_doubles.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 145 | memcpy( &(this->doubles[i]), &(this->st_doubles), sizeof(dynamic_reconfigure::DoubleParameter)); |
garyservin | 0:9e9b7db60fd5 | 146 | } |
garyservin | 0:9e9b7db60fd5 | 147 | uint32_t groups_lengthT = ((uint32_t) (*(inbuffer + offset))); |
garyservin | 0:9e9b7db60fd5 | 148 | groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
garyservin | 0:9e9b7db60fd5 | 149 | groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
garyservin | 0:9e9b7db60fd5 | 150 | groups_lengthT |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
garyservin | 0:9e9b7db60fd5 | 151 | offset += sizeof(this->groups_length); |
garyservin | 0:9e9b7db60fd5 | 152 | if(groups_lengthT > groups_length) |
garyservin | 0:9e9b7db60fd5 | 153 | this->groups = (dynamic_reconfigure::GroupState*)realloc(this->groups, groups_lengthT * sizeof(dynamic_reconfigure::GroupState)); |
garyservin | 0:9e9b7db60fd5 | 154 | groups_length = groups_lengthT; |
garyservin | 0:9e9b7db60fd5 | 155 | for( uint32_t i = 0; i < groups_length; i++){ |
garyservin | 0:9e9b7db60fd5 | 156 | offset += this->st_groups.deserialize(inbuffer + offset); |
garyservin | 0:9e9b7db60fd5 | 157 | memcpy( &(this->groups[i]), &(this->st_groups), sizeof(dynamic_reconfigure::GroupState)); |
garyservin | 0:9e9b7db60fd5 | 158 | } |
garyservin | 0:9e9b7db60fd5 | 159 | return offset; |
garyservin | 0:9e9b7db60fd5 | 160 | } |
garyservin | 0:9e9b7db60fd5 | 161 | |
garyservin | 0:9e9b7db60fd5 | 162 | const char * getType(){ return "dynamic_reconfigure/Config"; }; |
garyservin | 0:9e9b7db60fd5 | 163 | const char * getMD5(){ return "958f16a05573709014982821e6822580"; }; |
garyservin | 0:9e9b7db60fd5 | 164 | |
garyservin | 0:9e9b7db60fd5 | 165 | }; |
garyservin | 0:9e9b7db60fd5 | 166 | |
garyservin | 0:9e9b7db60fd5 | 167 | } |
garyservin | 0:9e9b7db60fd5 | 168 | #endif |