1
/******************************************************************************
2
* $Id: lasvariablerecord.hpp 889 2008-09-28 04:17:22Z hobu $
4
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
5
* Purpose: LAS record header class
6
* Author: Phil Vachon, philippe@cowpig.ca
8
******************************************************************************
9
* Copyright (c) 2008, Phil Vachon
10
* Copyright (c) 2008, Howard Butler
12
* All rights reserved.
14
* Redistribution and use in source and binary forms, with or without
15
* modification, are permitted provided that the following
18
* * Redistributions of source code must retain the above copyright
19
* notice, this list of conditions and the following disclaimer.
20
* * Redistributions in binary form must reproduce the above copyright
21
* notice, this list of conditions and the following disclaimer in
22
* the documentation and/or other materials provided
23
* with the distribution.
24
* * Neither the name of the Martin Isenburg or Iowa Department
25
* of Natural Resources nor the names of its contributors may be
26
* used to endorse or promote products derived from this software
27
* without specific prior written permission.
29
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
36
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
37
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
38
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
39
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
41
****************************************************************************/
43
#ifndef LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
44
#define LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
46
#include <liblas/cstdint.hpp>
53
/// Representation of variable-length record data.
54
class LASVariableRecord
58
/// Default constructor.
59
/// Zero-initialization of record data.
60
/// \exception No throw
64
/// Construction of new record object as a copy of existing one.
65
/// \exception No throw
66
LASVariableRecord(LASVariableRecord const& other);
70
/// Assignment operator.
71
/// Construction and initializition of record object by
72
/// assignment of another one.
73
/// \exception No throw
74
LASVariableRecord& operator=(LASVariableRecord const& rhs);
76
/// Get record signature (LAS 1.0) or reserved bytes (LAS 1.1).
77
/// \exception No throw
78
uint16_t GetReserved() const;
80
void SetReserved(uint16_t);
82
/// Get identifier of user which created the record.
83
/// The character data is up to 16 bytes long.
84
/// \exception No throw
85
std::string GetUserId(bool pad /*= false*/) const;
87
void SetUserId(std::string const&);
89
/// Get identifier of record.
90
/// The record ID is closely related to the user ID.
91
/// \exception No throw
92
uint16_t GetRecordId() const;
94
void SetRecordId(uint16_t);
96
/// Get record length after the header.
97
/// \exception No throw
98
uint16_t GetRecordLength() const;
100
void SetRecordLength(uint16_t);
102
/// Get text description of data in the record.
103
/// The character data is up to 32 bytes long.
104
/// \exception No throw
105
std::string GetDescription(bool pad /*= false*/) const;
107
void SetDescription(std::string const&);
109
/// Get the data for this VLR
110
std::vector<uint8_t> const& GetData() const;
112
void SetData(std::vector<uint8_t> const&);
114
/// Compare actual header object against the other.
115
/// \exception No throw
116
bool equal(LASVariableRecord const& other) const;
118
/// Get the total size of the VLR in bytes
119
uint32_t GetTotalSize() const;
126
eDescriptionSize = 32
131
uint16_t m_recordLength; // after header
133
char m_userId[eUIDSize];
134
char m_desc[eDescriptionSize];
135
std::vector<uint8_t> m_data;
138
/// Equality operator.
139
/// Implemented in terms of LASVariableRecord::equal member function.
140
/// \exception No throw
141
inline bool operator==(LASVariableRecord const& lhs, LASVariableRecord const& rhs)
143
return lhs.equal(rhs);
146
/// Inequality operator.
147
/// Implemented in terms of LASRecordHeader::equal member function.
148
/// \exception No throw
149
inline bool operator!=(LASVariableRecord const& lhs, LASVariableRecord const& rhs)
151
return (!(lhs == rhs));
154
} // namespace liblas
156
#endif // LIBLAS_LASVARIABLERECORD_HPP_INCLUDED