3 #ifndef LVR2_TYPES_VARIANTCHANNEL 4 #define LVR2_TYPES_VARIANTCHANNEL 6 #include <boost/variant.hpp> 17 template<
typename... T>
20 using base = boost::variant<Channel<T>...>;
23 template <
class T1,
class Tuple>
39 static constexpr std::size_t
num_types = std::tuple_size<types>::value;
41 template <std::
size_t N>
49 boost::shared_array<U>
dataPtr()
const;
51 template<std::
size_t N>
52 boost::shared_array<type_of_index<N> >
dataPtr()
const 78 os <<
"type: " << ch.
type() <<
", " << static_cast <
const base &>(ch);
100 return channel.
width();
108 std::enable_if_t<std::is_same<U, V>::value,
int> = 0>
115 std::enable_if_t<!std::is_same<U, V>::value,
int> = 0>
118 throw std::invalid_argument(
"tried to get wrong type of channel");
119 return boost::shared_array<U>();
123 struct CloneVisitor :
public boost::static_visitor< VariantChannel<T...> >
128 return channel.
clone();
132 template <
class T1,
class... Types>
134 static constexpr std::size_t
value = 0;
137 template <
class T1,
class U,
class... Types>
144 template<
typename ...Tp>
150 #include "VariantChannel.tcc" 152 #endif // LVR2_TYPES_VARIANTCHANNEL size_t operator()(const Channel< U > &channel) const
Access type index with type.
boost::shared_array< type_of_index< N > > dataPtr() const
const DataPtr dataPtr() const
size_t numElements() const
Channel< U > extract() const
VariantChannel< T... > clone() const
VariantChannel< T... > operator()(const Channel< U > &channel) const
int type() const
Get type index of a map entry.
boost::optional< VariantChannel< Tp... > > VariantChannelOptional
static constexpr std::size_t value
size_t operator()(const Channel< U > &channel) const
boost::variant< Channel< T >... > base
friend std::ostream & operator<<(std::ostream &os, const VariantChannel< T... > &ch)
boost::shared_array< U > operator()(const Channel< V > &channel) const
boost::shared_array< U > dataPtr() const
typename std::tuple_element< N, types >::type type_of_index
Channel< T > clone() const
size_t numElements() const
static constexpr std::size_t num_types