libLAS API Reference  1.8.1
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 
56 namespace liblas {
57 
60 {
61 public:
62 
66  VariableRecord();
67 
71  VariableRecord(VariableRecord const& other);
72 
73  ~VariableRecord();
74 
79  VariableRecord& operator=(VariableRecord const& rhs);
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  {
130  eUserIdSize = 16,
131  eDescriptionSize = 32
132  };
133 
134 private:
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 
147 inline bool operator==(VariableRecord const& lhs, VariableRecord const& rhs)
148 {
149  return lhs.equal(rhs);
150 }
151 
155 inline bool operator!=(VariableRecord const& lhs, VariableRecord const& rhs)
156 {
157  return (!(lhs == rhs));
158 }
159 
160 LAS_DLL std::ostream& operator<<(std::ostream& os, liblas::VariableRecord const&);
161 
162 
163 } // namespace liblas
164 
165 #endif // LIBLAS_LASVARIABLERECORD_HPP_INCLUDED
bool operator!=(Classification const &lhs, Classification const &rhs)
Not-equal-to operator implemented in terms of Classification::equal.
Definition: classification.hpp:232
Representation of variable-length record data.
Definition: variablerecord.hpp:59
#define LAS_DLL
Definition: export.hpp:58
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
Namespace grouping all elements of libLAS public interface.
Definition: bounds.hpp:60
bool equal(VariableRecord const &other) const
Compare actual header object against the other.