1 /******************************************************************************
2  * Copyright (c) 2016, Hobu Inc.
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following
8  * conditions are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided
15  *       with the distribution.
16  *     * Neither the name of the Martin Isenburg or Iowa Department
17  *       of Natural Resources nor the names of its contributors may be
18  *       used to endorse or promote products derived from this software
19  *       without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32  * OF SUCH DAMAGE.
33  ****************************************************************************/
34 
35 #pragma once
36 
37 #include <pdal/Dimension.hpp>
38 
39 namespace pdal
40 {
41 namespace Dimension
42 {
43 
44 class Detail
45 {
46 public:
Detail()47     Detail() : m_id(Id::Unknown), m_offsetOrOrder(-1), m_type(Type::None)
48     {}
49     //NOTE - This is strange, but for some reason things run faster with
50     // this NOOP virtual dtor.  Perhaps it has something to do with
51     // an inlining optimization or perhaps alignment (though a void * doesn't
52     // cause the same performance improvement) It may help on no machine
53     // except mine, but it doesn't hurt anything, either.
~Detail()54     virtual ~Detail()
55     {}
56 
setOffset(int offset)57     void setOffset(int offset)
58         { m_offsetOrOrder = offset; }
setOrder(int order)59     void setOrder(int order)
60         { m_offsetOrOrder = order; }
setType(Type type)61     void setType(Type type)
62         { m_type = type; }
setId(Id id)63     void setId(Id id)
64         { m_id = id; }
id() const65     Id id() const
66         { return m_id; }
offset() const67     int offset() const
68         { return m_offsetOrOrder; }
order() const69     int order() const
70         { return m_offsetOrOrder; }
type() const71     Type type() const
72         { return m_type; }
size() const73     size_t size() const
74         { return Dimension::size(m_type); }
base() const75     BaseType base() const
76         { return Dimension::base(m_type); }
77 
78 private:
79     Id m_id;
80     int m_offsetOrOrder;
81     Type m_type;
82 };
83 typedef std::vector<Detail> DetailList;
84 
85 } // namespace Dimension
86 } // namespace pdal
87 
88