Channel.hpp
Go to the documentation of this file.
1 
28 #pragma once
29 
30 #ifndef LVR2_TYPES_CHANNEL
31 #define LVR2_TYPES_CHANNEL
32 
33 #include "ElementProxy.hpp"
34 #include <memory>
35 #include <boost/optional.hpp>
36 #include <boost/shared_array.hpp>
37 #include <iostream>
38 
39 namespace lvr2 {
40 
41 template<typename T>
42 class Channel
43 {
44 public:
45  using Optional = boost::optional<Channel<T> >;
46  using Ptr = std::shared_ptr<Channel<T> >;
47  using DataType = T;
48  using DataPtr = boost::shared_array<T>;
49 
50  Channel();
51  Channel(size_t n, size_t width);
52  Channel(size_t n, size_t width, DataPtr ptr);
53 
54 
55  // clone
56  Channel<T> clone() const;
57 
58  ElementProxy<T> operator[](const unsigned& idx);
59  const ElementProxy<T> operator[](const unsigned& idx) const;
60 
61  size_t width() const;
62  size_t numElements() const;
63  const DataPtr dataPtr() const;
64  DataPtr dataPtr();
65 
66  friend std::ostream& operator<<(std::ostream& os, const Channel<T>& ch)
67  {
68  os << "size: [" << ch.numElements() << "," << ch.width() << "]";
69  return os;
70  }
71 
72 protected:
73  size_t m_numElements;
76 };
77 
78 template<typename T>
80 
81 template<typename T>
82 using ChannelPtr = typename Channel<T>::Ptr;
83 
84 template<typename T>
86 
90 
94 
98 
102 
103 
104 } // namespace lvr2
105 
106 #include "Channel.tcc"
107 
108 #endif // LVR2_TYPES_CHANNEL
size_t m_numElements
Definition: Channel.hpp:73
size_t width() const
boost::shared_array< float > DataPtr
Definition: Channel.hpp:48
const DataPtr dataPtr() const
DoubleChannel::Ptr DoubleChannelPtr
Definition: Channel.hpp:93
UCharChannel::Optional UCharChannelOptional
Definition: Channel.hpp:96
DataPtr m_data
Definition: Channel.hpp:75
IndexChannel::Ptr IndexChannelPtr
Definition: Channel.hpp:101
FloatChannel::Optional FloatChannelOptional
Definition: Channel.hpp:88
boost::optional< Channel< float > > Optional
Definition: Channel.hpp:45
UCharChannel::Ptr UCharChannelPtr
Definition: Channel.hpp:97
IndexChannel::Optional IndexChannelOptional
Definition: Channel.hpp:100
ElementProxy< T > operator[](const unsigned &idx)
FloatChannel::Ptr FloatChannelPtr
Definition: Channel.hpp:89
Channel< T > clone() const
typename Channel< T >::Optional ChannelOptional
Definition: Channel.hpp:85
size_t numElements() const
std::shared_ptr< Channel< float > > Ptr
Definition: Channel.hpp:46
DoubleChannel::Optional DoubleChannelOptional
Definition: Channel.hpp:92
size_t m_elementWidth
Definition: Channel.hpp:74
typename Channel< T >::Ptr ChannelPtr
Definition: Channel.hpp:82


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06