[136] | 1 | #ifndef LIB3DV_DETAIL_RAW_DATA_H
|
---|
| 2 | #define LIB3DV_DETAIL_RAW_DATA_H
|
---|
| 3 |
|
---|
| 4 | /* lib3dv/detail/raw_data.h
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2013 VisLab
|
---|
| 7 | *
|
---|
| 8 | * This file is part of lib3dv; you can redistribute it and/or modify
|
---|
| 9 | * it under the terms of the GNU Lesser General Public License as published by
|
---|
| 10 | * the Free Software Foundation; either version 3 of the License, or (at
|
---|
| 11 | * your option) any later version.
|
---|
| 12 | *
|
---|
| 13 | * This program is distributed in the hope that it will be useful, but
|
---|
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 16 | * General Public License for more details.
|
---|
| 17 | *
|
---|
| 18 | * You should have received a copy of the GNU Lesser General Public License
|
---|
| 19 | * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | #include <lib3dv/detail/protocol.h>
|
---|
| 23 | #include <lib3dv/detail/protocol.h>
|
---|
| 24 |
|
---|
| 25 | #include <boost/dynamic_bitset.hpp>
|
---|
| 26 |
|
---|
| 27 | #include <stdint.h>
|
---|
| 28 |
|
---|
| 29 | namespace lib3dv
|
---|
| 30 | {
|
---|
| 31 | namespace detail
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * @brief Convenience struct to reassemble some raw data.
|
---|
| 35 | **/
|
---|
| 36 | template<typename H>
|
---|
| 37 | struct raw_data
|
---|
| 38 | {
|
---|
| 39 | H m_header; ///< Header.
|
---|
| 40 | boost::dynamic_bitset<> m_fragments; ///< Received fragments.
|
---|
| 41 | std::vector<uint8_t> m_buffer; ///< Raw data buffer.
|
---|
| 42 | };
|
---|
| 43 |
|
---|
| 44 | struct raw_data_fragment
|
---|
| 45 | {
|
---|
| 46 | protocol::data_header m_header;
|
---|
| 47 | uint32_t m_fragment;
|
---|
| 48 | uint32_t m_total_fragments;
|
---|
| 49 | std::vector<uint8_t> m_buffer;
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | typedef raw_data<protocol::image_info_header> raw_image_type;
|
---|
| 53 | typedef raw_data<protocol::terrain_info_header> raw_terrain_type;
|
---|
| 54 | typedef raw_data<protocol::obstacles_map_info_header> raw_obstacles_type;
|
---|
| 55 | typedef raw_data<protocol::motion_info_header> raw_motion_type;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | #endif
|
---|
| 60 |
|
---|
| 61 |
|
---|