libLAS API Reference (svn-trunk)
variablerecord.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * $Id: lasvariablerecord.hpp 889 2008-09-28 04:17:22Z hobu $
3 *
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
7 *
8 ******************************************************************************
9 * Copyright (c) 2008, Phil Vachon
10 * Copyright (c) 2008, Howard Butler
11 *
12 * All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following
16 * conditions are met:
17 *
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.
28 *
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
40 * OF SUCH DAMAGE.
41 ****************************************************************************/
42
43#ifndef LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
44#define LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
45
46#include <liblas/detail/private_utility.hpp>
47#include <liblas/external/property_tree/ptree.hpp>
48#include <liblas/export.hpp>
49// boost
50#include <boost/array.hpp>
51// std
52#include <string>
53#include <vector>
54#include <iostream>
55
56namespace liblas {
57
60{
61public:
62
67
72
74
80
83 uint16_t GetReserved() const;
84
85 void SetReserved(uint16_t data);
86
90 std::string GetUserId(bool pad /*= false*/) const;
91
92 void SetUserId(std::string const& id);
93
97 uint16_t GetRecordId() const;
98
99 void SetRecordId(uint16_t id);
100
103 uint16_t GetRecordLength() const;
104
105 void SetRecordLength(uint16_t length);
106
110 std::string GetDescription(bool pad /*= false*/) const;
111
112 void SetDescription(std::string const& text);
113
115 std::vector<uint8_t> const& GetData() const;
116
117 void SetData(std::vector<uint8_t> const& data);
118
121 bool equal(VariableRecord const& other) const;
122
124 std::size_t GetTotalSize() const;
125
126 liblas::property_tree::ptree GetPTree() const;
127
128 enum
129 {
132 };
133
134private:
135
136 std::vector<uint8_t> m_data;
137 boost::array<char, 32> m_description;
138 boost::array<char, 16> m_user_id;
139 uint16_t m_reserved;
140 uint16_t m_record_id;
141 uint16_t m_record_size; // length after header
142};
143
147inline bool operator==(VariableRecord const& lhs, VariableRecord const& rhs)
148{
149 return lhs.equal(rhs);
150}
151
155inline bool operator!=(VariableRecord const& lhs, VariableRecord const& rhs)
156{
157 return (!(lhs == rhs));
158}
159
160LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::VariableRecord const&);
161
162
163} // namespace liblas
164
165#endif // LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
Representation of variable-length record data.
Definition variablerecord.hpp:60
void SetData(std::vector< uint8_t > const &data)
std::size_t GetTotalSize() const
Get the total size of the VLR in bytes.
void SetReserved(uint16_t data)
VariableRecord(VariableRecord const &other)
Copy constructor.
uint16_t GetReserved() const
Get record signature (LAS 1.0) or reserved bytes (LAS 1.1).
VariableRecord & operator=(VariableRecord const &rhs)
Assignment operator.
std::string GetDescription(bool pad) const
Get text description of data in the record.
std::string GetUserId(bool pad) const
Get identifier of user which created the record.
liblas::property_tree::ptree GetPTree() const
void SetRecordLength(uint16_t length)
uint16_t GetRecordId() const
Get identifier of record.
void SetRecordId(uint16_t id)
std::vector< uint8_t > const & GetData() const
Get the data for this VLR.
uint16_t GetRecordLength() const
Get record length after the header.
void SetUserId(std::string const &id)
@ eUserIdSize
Definition variablerecord.hpp:130
@ eDescriptionSize
Definition variablerecord.hpp:131
void SetDescription(std::string const &text)
bool equal(VariableRecord const &other) const
Compare actual header object against the other.
VariableRecord()
Default constructor.
#define LAS_DLL
Definition export.hpp:58
Namespace grouping all elements of libLAS public interface.
Definition bounds.hpp:60
bool operator!=(Classification const &lhs, Classification const &rhs)
Not-equal-to operator implemented in terms of Classification::equal.
Definition classification.hpp:232
std::ostream & operator<<(std::ostream &os, Classification const &cls)
The output stream operator is based on std::bitset<N>::operator<<.
Definition classification.hpp:247
bool operator==(Classification const &lhs, Classification const &rhs)
Equal-to operator implemented in terms of Classification::equal.
Definition classification.hpp:226