Point Cloud Library (PCL)  1.12.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 
42 #if defined(HAVE_OPENNI2)
43 
44 #include <pcl/pcl_config.h>
45 
46 #include <pcl/io/image_metadata_wrapper.h>
47 #include <pcl/io/openni2/openni.h>
48 
49 namespace pcl
50 {
51  namespace io
52  {
53  namespace openni2
54  {
55  class Openni2FrameWrapper : public pcl::io::FrameWrapper
56  {
57  public:
58  Openni2FrameWrapper (const openni::VideoFrameRef& metadata)
59  : metadata_(metadata)
60  {}
61 
62  inline const void*
63  getData () const override
64  {
65  return (metadata_.getData ());
66  }
67 
68  inline unsigned
69  getDataSize () const override
70  {
71  return (metadata_.getDataSize ());
72  }
73 
74  inline unsigned
75  getWidth () const override
76  {
77  return (metadata_.getWidth ());
78  }
79 
80  inline unsigned
81  getHeight () const override
82  {
83  return (metadata_.getHeight ());
84  }
85 
86  inline unsigned
87  getFrameID () const override
88  {
89  return (metadata_.getFrameIndex ());
90  }
91 
92  inline std::uint64_t
93  getTimestamp () const override
94  {
95  return (metadata_.getTimestamp ());
96  }
97 
98 
99  const inline openni::VideoFrameRef&
100  getMetaData () const
101  {
102  return (metadata_);
103  }
104 
105  private:
106  openni::VideoFrameRef metadata_; // Internally reference counted
107  };
108 
109  } // namespace
110  }
111 }
112 #endif // HAVE_OPENNI2
Pure abstract interface to wrap native frame data types.