Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ros_lib/dynamic_reconfigure/BoolParameter.h@0:8f3710bfd298, 2020-09-02 (annotated)
- Committer:
- irfantitok
- Date:
- Wed Sep 02 13:51:31 2020 +0000
- Revision:
- 0:8f3710bfd298
Resolved round not found
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| irfantitok | 0:8f3710bfd298 | 1 | #ifndef _ROS_dynamic_reconfigure_BoolParameter_h |
| irfantitok | 0:8f3710bfd298 | 2 | #define _ROS_dynamic_reconfigure_BoolParameter_h |
| irfantitok | 0:8f3710bfd298 | 3 | |
| irfantitok | 0:8f3710bfd298 | 4 | #include <stdint.h> |
| irfantitok | 0:8f3710bfd298 | 5 | #include <string.h> |
| irfantitok | 0:8f3710bfd298 | 6 | #include <stdlib.h> |
| irfantitok | 0:8f3710bfd298 | 7 | #include "ros/msg.h" |
| irfantitok | 0:8f3710bfd298 | 8 | |
| irfantitok | 0:8f3710bfd298 | 9 | namespace dynamic_reconfigure |
| irfantitok | 0:8f3710bfd298 | 10 | { |
| irfantitok | 0:8f3710bfd298 | 11 | |
| irfantitok | 0:8f3710bfd298 | 12 | class BoolParameter : public ros::Msg |
| irfantitok | 0:8f3710bfd298 | 13 | { |
| irfantitok | 0:8f3710bfd298 | 14 | public: |
| irfantitok | 0:8f3710bfd298 | 15 | typedef const char* _name_type; |
| irfantitok | 0:8f3710bfd298 | 16 | _name_type name; |
| irfantitok | 0:8f3710bfd298 | 17 | typedef bool _value_type; |
| irfantitok | 0:8f3710bfd298 | 18 | _value_type value; |
| irfantitok | 0:8f3710bfd298 | 19 | |
| irfantitok | 0:8f3710bfd298 | 20 | BoolParameter(): |
| irfantitok | 0:8f3710bfd298 | 21 | name(""), |
| irfantitok | 0:8f3710bfd298 | 22 | value(0) |
| irfantitok | 0:8f3710bfd298 | 23 | { |
| irfantitok | 0:8f3710bfd298 | 24 | } |
| irfantitok | 0:8f3710bfd298 | 25 | |
| irfantitok | 0:8f3710bfd298 | 26 | virtual int serialize(unsigned char *outbuffer) const |
| irfantitok | 0:8f3710bfd298 | 27 | { |
| irfantitok | 0:8f3710bfd298 | 28 | int offset = 0; |
| irfantitok | 0:8f3710bfd298 | 29 | uint32_t length_name = strlen(this->name); |
| irfantitok | 0:8f3710bfd298 | 30 | varToArr(outbuffer + offset, length_name); |
| irfantitok | 0:8f3710bfd298 | 31 | offset += 4; |
| irfantitok | 0:8f3710bfd298 | 32 | memcpy(outbuffer + offset, this->name, length_name); |
| irfantitok | 0:8f3710bfd298 | 33 | offset += length_name; |
| irfantitok | 0:8f3710bfd298 | 34 | union { |
| irfantitok | 0:8f3710bfd298 | 35 | bool real; |
| irfantitok | 0:8f3710bfd298 | 36 | uint8_t base; |
| irfantitok | 0:8f3710bfd298 | 37 | } u_value; |
| irfantitok | 0:8f3710bfd298 | 38 | u_value.real = this->value; |
| irfantitok | 0:8f3710bfd298 | 39 | *(outbuffer + offset + 0) = (u_value.base >> (8 * 0)) & 0xFF; |
| irfantitok | 0:8f3710bfd298 | 40 | offset += sizeof(this->value); |
| irfantitok | 0:8f3710bfd298 | 41 | return offset; |
| irfantitok | 0:8f3710bfd298 | 42 | } |
| irfantitok | 0:8f3710bfd298 | 43 | |
| irfantitok | 0:8f3710bfd298 | 44 | virtual int deserialize(unsigned char *inbuffer) |
| irfantitok | 0:8f3710bfd298 | 45 | { |
| irfantitok | 0:8f3710bfd298 | 46 | int offset = 0; |
| irfantitok | 0:8f3710bfd298 | 47 | uint32_t length_name; |
| irfantitok | 0:8f3710bfd298 | 48 | arrToVar(length_name, (inbuffer + offset)); |
| irfantitok | 0:8f3710bfd298 | 49 | offset += 4; |
| irfantitok | 0:8f3710bfd298 | 50 | for(unsigned int k= offset; k< offset+length_name; ++k){ |
| irfantitok | 0:8f3710bfd298 | 51 | inbuffer[k-1]=inbuffer[k]; |
| irfantitok | 0:8f3710bfd298 | 52 | } |
| irfantitok | 0:8f3710bfd298 | 53 | inbuffer[offset+length_name-1]=0; |
| irfantitok | 0:8f3710bfd298 | 54 | this->name = (char *)(inbuffer + offset-1); |
| irfantitok | 0:8f3710bfd298 | 55 | offset += length_name; |
| irfantitok | 0:8f3710bfd298 | 56 | union { |
| irfantitok | 0:8f3710bfd298 | 57 | bool real; |
| irfantitok | 0:8f3710bfd298 | 58 | uint8_t base; |
| irfantitok | 0:8f3710bfd298 | 59 | } u_value; |
| irfantitok | 0:8f3710bfd298 | 60 | u_value.base = 0; |
| irfantitok | 0:8f3710bfd298 | 61 | u_value.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); |
| irfantitok | 0:8f3710bfd298 | 62 | this->value = u_value.real; |
| irfantitok | 0:8f3710bfd298 | 63 | offset += sizeof(this->value); |
| irfantitok | 0:8f3710bfd298 | 64 | return offset; |
| irfantitok | 0:8f3710bfd298 | 65 | } |
| irfantitok | 0:8f3710bfd298 | 66 | |
| irfantitok | 0:8f3710bfd298 | 67 | const char * getType(){ return "dynamic_reconfigure/BoolParameter"; }; |
| irfantitok | 0:8f3710bfd298 | 68 | const char * getMD5(){ return "23f05028c1a699fb83e22401228c3a9e"; }; |
| irfantitok | 0:8f3710bfd298 | 69 | |
| irfantitok | 0:8f3710bfd298 | 70 | }; |
| irfantitok | 0:8f3710bfd298 | 71 | |
| irfantitok | 0:8f3710bfd298 | 72 | } |
| irfantitok | 0:8f3710bfd298 | 73 | #endif |