Point Cloud Library (PCL)  1.8.0
openni2_metadata_wrapper.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2009-2012, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  * Copyright (c) 2014, respective authors.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  *
15  * * Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * * Redistributions in binary form must reproduce the above
18  * copyright notice, this list of conditions and the following
19  * disclaimer in the documentation and/or other materials provided
20  * with the distribution.
21  * * Neither the name of the copyright holder(s) nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  */
39 
40 #pragma once
41 #ifndef PCL_IO_OPENNI2_METADATA_WRAPPER_H_
42 #define PCL_IO_OPENNI2_METADATA_WRAPPER_H_
43 
44 #include <pcl/pcl_config.h>
45 
46 #if defined(HAVE_OPENNI2)
47 
48 #include <pcl/io/image_metadata_wrapper.h>
49 #include <pcl/io/openni2/openni.h>
50 
51 namespace pcl
52 {
53  namespace io
54  {
55  namespace openni2
56  {
57  class Openni2FrameWrapper : public pcl::io::FrameWrapper
58  {
59  public:
60  Openni2FrameWrapper (openni::VideoFrameRef metadata)
61  : metadata_(metadata)
62  {}
63 
64  virtual inline const void*
65  getData () const
66  {
67  return (metadata_.getData ());
68  }
69 
70  virtual inline unsigned
71  getDataSize () const
72  {
73  return (metadata_.getDataSize ());
74  }
75 
76  virtual inline unsigned
77  getWidth () const
78  {
79  return (metadata_.getWidth ());
80  }
81 
82  virtual inline unsigned
83  getHeight () const
84  {
85  return (metadata_.getHeight ());
86  }
87 
88  virtual inline unsigned
89  getFrameID () const
90  {
91  return (metadata_.getFrameIndex ());
92  }
93 
94  virtual inline uint64_t
95  getTimestamp () const
96  {
97  return (metadata_.getTimestamp ());
98  }
99 
100 
101  const inline openni::VideoFrameRef&
102  getMetaData () const
103  {
104  return (metadata_);
105  }
106 
107  private:
108  openni::VideoFrameRef metadata_; // Internally reference counted
109  };
110 
111  } // namespace
112  }
113 }
114 #endif // HAVE_OPENNI2
115 
116 #endif // PCL_IO_OPENNI2_METADATA_WRAPPER_H_
Pure abstract interface to wrap native frame data types.