~ubuntu-branches/ubuntu/utopic/liblas/utopic

« back to all changes in this revision

Viewing changes to include/liblas/lasvariablerecord.hpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2013-11-26 16:03:56 UTC
  • mto: (2.1.1 experimental) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: package-import@ubuntu.com-20131126160356-r94gc8jmp4lm0yix
Tags: upstream-1.7.0
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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/cstdint.hpp>
47
 
// std
48
 
#include <string>
49
 
#include <vector>
50
 
 
51
 
namespace liblas {
52
 
 
53
 
/// Representation of variable-length record data.
54
 
class LASVariableRecord
55
 
{
56
 
public:
57
 
 
58
 
    /// Default constructor.
59
 
    /// Zero-initialization of record data.
60
 
    /// \exception No throw
61
 
    LASVariableRecord(); 
62
 
 
63
 
    /// Copy constructor.
64
 
    /// Construction of new record object as a copy of existing one.
65
 
    /// \exception No throw
66
 
    LASVariableRecord(LASVariableRecord const& other);
67
 
    
68
 
    ~LASVariableRecord();
69
 
 
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);
75
 
 
76
 
    /// Get record signature (LAS 1.0) or reserved bytes (LAS 1.1).
77
 
    /// \exception No throw
78
 
    uint16_t GetReserved() const;
79
 
    
80
 
    void SetReserved(uint16_t);
81
 
 
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;
86
 
    
87
 
    void SetUserId(std::string const&);
88
 
 
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;
93
 
    
94
 
    void SetRecordId(uint16_t);
95
 
 
96
 
    /// Get record length after the header.
97
 
    /// \exception No throw
98
 
    uint16_t GetRecordLength() const;
99
 
    
100
 
    void SetRecordLength(uint16_t);
101
 
 
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;
106
 
    
107
 
    void SetDescription(std::string const&);
108
 
 
109
 
    /// Get the data for this VLR
110
 
    std::vector<uint8_t> const& GetData() const;
111
 
    
112
 
    void SetData(std::vector<uint8_t> const&);
113
 
 
114
 
    /// Compare actual header object against the other.
115
 
    /// \exception No throw
116
 
    bool equal(LASVariableRecord const& other) const;
117
 
 
118
 
    /// Get the total size of the VLR in bytes
119
 
    uint32_t GetTotalSize() const;
120
 
    
121
 
private:
122
 
 
123
 
    enum
124
 
    {
125
 
        eUIDSize = 16,
126
 
        eDescriptionSize = 32
127
 
    };
128
 
    
129
 
    uint16_t m_reserved;
130
 
    uint16_t m_recordId;
131
 
    uint16_t m_recordLength; // after header
132
 
 
133
 
    char m_userId[eUIDSize];
134
 
    char m_desc[eDescriptionSize];
135
 
    std::vector<uint8_t> m_data;
136
 
};
137
 
 
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)
142
 
{
143
 
    return lhs.equal(rhs);
144
 
}
145
 
 
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)
150
 
{
151
 
    return (!(lhs == rhs));
152
 
}
153
 
 
154
 
} // namespace liblas
155
 
 
156
 
#endif // LIBLAS_LASVARIABLERECORD_HPP_INCLUDED