capstone_finish
Dependencies: BufferedSerial motor_sn7544
ros/message_operations.h@10:ca4e4062701a, 2019-11-26 (annotated)
- Committer:
- Jeonghoon
- Date:
- Tue Nov 26 15:30:27 2019 +0000
- Revision:
- 10:ca4e4062701a
- Parent:
- 3:2a3664dc6634
capstone finish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jeonghoon | 3:2a3664dc6634 | 1 | /* |
Jeonghoon | 3:2a3664dc6634 | 2 | * Copyright (C) 2010, Willow Garage, Inc. |
Jeonghoon | 3:2a3664dc6634 | 3 | * |
Jeonghoon | 3:2a3664dc6634 | 4 | * Redistribution and use in source and binary forms, with or without |
Jeonghoon | 3:2a3664dc6634 | 5 | * modification, are permitted provided that the following conditions are met: |
Jeonghoon | 3:2a3664dc6634 | 6 | * * Redistributions of source code must retain the above copyright notice, |
Jeonghoon | 3:2a3664dc6634 | 7 | * this list of conditions and the following disclaimer. |
Jeonghoon | 3:2a3664dc6634 | 8 | * * Redistributions in binary form must reproduce the above copyright |
Jeonghoon | 3:2a3664dc6634 | 9 | * notice, this list of conditions and the following disclaimer in the |
Jeonghoon | 3:2a3664dc6634 | 10 | * documentation and/or other materials provided with the distribution. |
Jeonghoon | 3:2a3664dc6634 | 11 | * * Neither the names of Willow Garage, Inc. nor the names of its |
Jeonghoon | 3:2a3664dc6634 | 12 | * contributors may be used to endorse or promote products derived from |
Jeonghoon | 3:2a3664dc6634 | 13 | * this software without specific prior written permission. |
Jeonghoon | 3:2a3664dc6634 | 14 | * |
Jeonghoon | 3:2a3664dc6634 | 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Jeonghoon | 3:2a3664dc6634 | 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Jeonghoon | 3:2a3664dc6634 | 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
Jeonghoon | 3:2a3664dc6634 | 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
Jeonghoon | 3:2a3664dc6634 | 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
Jeonghoon | 3:2a3664dc6634 | 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
Jeonghoon | 3:2a3664dc6634 | 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
Jeonghoon | 3:2a3664dc6634 | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
Jeonghoon | 3:2a3664dc6634 | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
Jeonghoon | 3:2a3664dc6634 | 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
Jeonghoon | 3:2a3664dc6634 | 25 | * POSSIBILITY OF SUCH DAMAGE. |
Jeonghoon | 3:2a3664dc6634 | 26 | */ |
Jeonghoon | 3:2a3664dc6634 | 27 | |
Jeonghoon | 3:2a3664dc6634 | 28 | #ifndef ROSLIB_MESSAGE_OPERATIONS_H |
Jeonghoon | 3:2a3664dc6634 | 29 | #define ROSLIB_MESSAGE_OPERATIONS_H |
Jeonghoon | 3:2a3664dc6634 | 30 | |
Jeonghoon | 3:2a3664dc6634 | 31 | #include <ostream> |
Jeonghoon | 3:2a3664dc6634 | 32 | |
Jeonghoon | 3:2a3664dc6634 | 33 | namespace ros |
Jeonghoon | 3:2a3664dc6634 | 34 | { |
Jeonghoon | 3:2a3664dc6634 | 35 | namespace message_operations |
Jeonghoon | 3:2a3664dc6634 | 36 | { |
Jeonghoon | 3:2a3664dc6634 | 37 | |
Jeonghoon | 3:2a3664dc6634 | 38 | template<typename M> |
Jeonghoon | 3:2a3664dc6634 | 39 | struct Printer |
Jeonghoon | 3:2a3664dc6634 | 40 | { |
Jeonghoon | 3:2a3664dc6634 | 41 | template<typename Stream> |
Jeonghoon | 3:2a3664dc6634 | 42 | static void stream(Stream& s, const std::string& indent, const M& value) |
Jeonghoon | 3:2a3664dc6634 | 43 | { |
Jeonghoon | 3:2a3664dc6634 | 44 | (void)indent; |
Jeonghoon | 3:2a3664dc6634 | 45 | s << value << "\n"; |
Jeonghoon | 3:2a3664dc6634 | 46 | } |
Jeonghoon | 3:2a3664dc6634 | 47 | }; |
Jeonghoon | 3:2a3664dc6634 | 48 | |
Jeonghoon | 3:2a3664dc6634 | 49 | // Explicitly specialize for uint8_t/int8_t because otherwise it thinks it's a char, and treats |
Jeonghoon | 3:2a3664dc6634 | 50 | // the value as a character code |
Jeonghoon | 3:2a3664dc6634 | 51 | template<> |
Jeonghoon | 3:2a3664dc6634 | 52 | struct Printer<int8_t> |
Jeonghoon | 3:2a3664dc6634 | 53 | { |
Jeonghoon | 3:2a3664dc6634 | 54 | template<typename Stream> |
Jeonghoon | 3:2a3664dc6634 | 55 | static void stream(Stream& s, const std::string& indent, int8_t value) |
Jeonghoon | 3:2a3664dc6634 | 56 | { |
Jeonghoon | 3:2a3664dc6634 | 57 | (void)indent; |
Jeonghoon | 3:2a3664dc6634 | 58 | s << static_cast<int32_t>(value) << "\n"; |
Jeonghoon | 3:2a3664dc6634 | 59 | } |
Jeonghoon | 3:2a3664dc6634 | 60 | }; |
Jeonghoon | 3:2a3664dc6634 | 61 | |
Jeonghoon | 3:2a3664dc6634 | 62 | template<> |
Jeonghoon | 3:2a3664dc6634 | 63 | struct Printer<uint8_t> |
Jeonghoon | 3:2a3664dc6634 | 64 | { |
Jeonghoon | 3:2a3664dc6634 | 65 | template<typename Stream> |
Jeonghoon | 3:2a3664dc6634 | 66 | static void stream(Stream& s, const std::string& indent, uint8_t value) |
Jeonghoon | 3:2a3664dc6634 | 67 | { |
Jeonghoon | 3:2a3664dc6634 | 68 | (void)indent; |
Jeonghoon | 3:2a3664dc6634 | 69 | s << static_cast<uint32_t>(value) << "\n"; |
Jeonghoon | 3:2a3664dc6634 | 70 | } |
Jeonghoon | 3:2a3664dc6634 | 71 | }; |
Jeonghoon | 3:2a3664dc6634 | 72 | |
Jeonghoon | 3:2a3664dc6634 | 73 | } // namespace message_operations |
Jeonghoon | 3:2a3664dc6634 | 74 | } // namespace ros |
Jeonghoon | 3:2a3664dc6634 | 75 | |
Jeonghoon | 3:2a3664dc6634 | 76 | #endif // ROSLIB_MESSAGE_OPERATIONS_H |