Porting mros2 as an Mbed library.
Dependents: mbed-os-example-mros2 example-mbed-mros2-sub-pose example-mbed-mros2-pub-twist example-mbed-mros2-mturtle-teleop
mros2_msgs/std_msgs/msg/int32.hpp@7:c80f65422d99, 2022-03-19 (annotated)
- Committer:
- smoritaemb
- Date:
- Sat Mar 19 09:23:37 2022 +0900
- Revision:
- 7:c80f65422d99
- Parent:
- 2:159877d749c2
Merge test_assortment_of_msgs branch.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
smoritaemb | 0:580aba13d1a1 | 1 | #include <string> |
smoritaemb | 0:580aba13d1a1 | 2 | |
smoritaemb | 0:580aba13d1a1 | 3 | namespace std_msgs |
smoritaemb | 0:580aba13d1a1 | 4 | { |
smoritaemb | 0:580aba13d1a1 | 5 | namespace msg |
smoritaemb | 0:580aba13d1a1 | 6 | { |
smoritaemb | 0:580aba13d1a1 | 7 | class Int32 |
smoritaemb | 0:580aba13d1a1 | 8 | { |
smoritaemb | 0:580aba13d1a1 | 9 | public: |
smoritaemb | 0:580aba13d1a1 | 10 | std::string getTypeName(); |
smoritaemb | 0:580aba13d1a1 | 11 | int32_t data; |
smoritaemb | 0:580aba13d1a1 | 12 | void copyToBuf(uint8_t *addrPtr) |
smoritaemb | 0:580aba13d1a1 | 13 | { |
smoritaemb | 0:580aba13d1a1 | 14 | memcpy(addrPtr, &data, 4); |
smoritaemb | 0:580aba13d1a1 | 15 | addrPtr += 4; |
smoritaemb | 0:580aba13d1a1 | 16 | } |
smoritaemb | 0:580aba13d1a1 | 17 | |
smoritaemb | 0:580aba13d1a1 | 18 | void copyFromBuf(const uint8_t *addrPtr) |
smoritaemb | 0:580aba13d1a1 | 19 | { |
smoritaemb | 0:580aba13d1a1 | 20 | memcpy(&data, addrPtr, 4); |
smoritaemb | 0:580aba13d1a1 | 21 | addrPtr += 4; |
smoritaemb | 0:580aba13d1a1 | 22 | } |
smoritaemb | 0:580aba13d1a1 | 23 | |
smoritaemb | 2:159877d749c2 | 24 | void memAlign(uint8_t *addrPtr){ |
smoritaemb | 2:159877d749c2 | 25 | return; |
smoritaemb | 2:159877d749c2 | 26 | } |
smoritaemb | 2:159877d749c2 | 27 | |
smoritaemb | 0:580aba13d1a1 | 28 | uint8_t getTotalSize() |
smoritaemb | 0:580aba13d1a1 | 29 | { |
smoritaemb | 0:580aba13d1a1 | 30 | return 4; |
smoritaemb | 0:580aba13d1a1 | 31 | } |
smoritaemb | 0:580aba13d1a1 | 32 | private: |
smoritaemb | 0:580aba13d1a1 | 33 | std::string type_name = "std_msgs::msg::dds_::Int32"; |
smoritaemb | 0:580aba13d1a1 | 34 | }; |
smoritaemb | 0:580aba13d1a1 | 35 | }//namspace msg |
smoritaemb | 0:580aba13d1a1 | 36 | }//namespace std_msgs |
smoritaemb | 0:580aba13d1a1 | 37 | |
smoritaemb | 0:580aba13d1a1 | 38 | namespace message_traits |
smoritaemb | 0:580aba13d1a1 | 39 | { |
smoritaemb | 0:580aba13d1a1 | 40 | |
smoritaemb | 0:580aba13d1a1 | 41 | template<> |
smoritaemb | 0:580aba13d1a1 | 42 | struct TypeName<std_msgs::msg::Int32*> { |
smoritaemb | 0:580aba13d1a1 | 43 | static const char* value() |
smoritaemb | 0:580aba13d1a1 | 44 | { |
smoritaemb | 0:580aba13d1a1 | 45 | return "std_msgs::msg::dds_::Int32_"; |
smoritaemb | 0:580aba13d1a1 | 46 | } |
smoritaemb | 0:580aba13d1a1 | 47 | }; |
smoritaemb | 0:580aba13d1a1 | 48 | |
smoritaemb | 0:580aba13d1a1 | 49 | } |