Rumba C++ SDK
IndexedBuffer.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 
17 #include "Value.h"
18 #include "Buffer.h"
19 
20  namespace maquina
21  {
23  template<typename T>
24  class IndexedBufferConst : public Value
25  {
26  public:
27  typedef T value_type;
28 
30 
31  IndexedBufferConst(const Value &v);
32 
34  IndexedBufferConst(const gsl::span<const uint32_t>& indices, const gsl::span<const T>& values);
35 
36  static bool can_cast(const Value &v);
37 
39  gsl::span<const uint32_t> read_indices() const;
40 
42  gsl::span<const value_type> read_values() const;
43 
45  IndexedBufferConst(const std::shared_ptr<Impl> &impl) : Value(impl) {}
46  };
47 
49  template<typename T>
51  {
52  public:
53  typedef T value_type;
54 
56  gsl::span<uint32_t> write_indices();
57 
59  gsl::span<value_type> write_values();
60 
62  IndexedBuffer(const std::shared_ptr<Impl> &impl) : IndexedBufferConst<T>(impl) {}
63  };
64 
78 
79 #ifndef kernel_EXPORTS
93 #endif // kernel_EXPORTS
94 
100  typedef IndexedBuffer<Imath::V2f> IndexedBufferV2f;
101  typedef IndexedBuffer<Imath::V3f> IndexedBufferV3f;
102  typedef IndexedBuffer<Imath::V4f> IndexedBufferV4f;
103  typedef IndexedBuffer<Imath::V2i> IndexedBufferV2i;
104  typedef IndexedBuffer<Imath::V3i> IndexedBufferV3i;
105  typedef IndexedBuffer<Imath::V4i> IndexedBufferV4i;
106  typedef IndexedBuffer<Imath::M44f> IndexedBufferM44f;
107  typedef IndexedBuffer<Imath::Box3f> IndexedBufferBox3f;
108 
109 #ifndef kernel_EXPORTS
123 #endif // kernel_EXPORTS
124  }
IndexedBufferConst< Imath::V2i > IndexedBufferConstV2i
Definition: IndexedBuffer.h:73
IndexedBufferConst< int32_t > IndexedBufferConstInt32
Definition: IndexedBuffer.h:65
IndexedBufferConst< Imath::Box3f > IndexedBufferConstBox3f
Definition: IndexedBuffer.h:77
static bool can_cast(const Value &v)
IndexedBufferConst< uint8_t > IndexedBufferConstUInt8
Definition: IndexedBuffer.h:66
gsl::span< const value_type > read_values() const
Return a readable accessor on the indices buffer.
A read only buffer of indexed values. It is composed of a buffer of indexes of the size of the compon...
Definition: IndexedBuffer.h:24
T value_type
Definition: IndexedBuffer.h:27
gsl::span< value_type > write_values()
Return a writable accessor on the indices buffer.
IndexedBufferConst< Imath::V3f > IndexedBufferConstV3f
Definition: IndexedBuffer.h:71
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
IndexedBufferConst(const Value &v)
Cast a Value object in IndexedBufferConst.
T value_type
Definition: IndexedBuffer.h:53
IndexedBufferConst< double > IndexedBufferConstDouble
Definition: IndexedBuffer.h:69
IndexedBufferConst< Imath::V4i > IndexedBufferConstV4i
Definition: IndexedBuffer.h:75
#define MAQUINA_EXPORT
Definition: Export.h:31
gsl::span< const uint32_t > read_indices() const
Return a readable accessor on the indices buffer.
IndexedBufferConst< float > IndexedBufferConstFloat
Definition: IndexedBuffer.h:68
IndexedBufferConst< uint32_t > IndexedBufferConstUInt32
Definition: IndexedBuffer.h:67
IndexedBufferConst< Imath::V4f > IndexedBufferConstV4f
Definition: IndexedBuffer.h:72
IndexedBufferConst< Imath::M44f > IndexedBufferConstM44f
Definition: IndexedBuffer.h:76
#define MAQUINA_EXTERN_TEMPLATE
Definition: Export.h:25
gsl::span< uint32_t > write_indices()
Return a writable accessor on the indices buffer.
Definition: ImathBox.h:67
IndexedBufferConst< Imath::V3i > IndexedBufferConstV3i
Definition: IndexedBuffer.h:74
Vec2< float > V2f
Definition: ImathVec.h:688
A writable IndexedBuffer.
Definition: IndexedBuffer.h:50
IndexedBufferConst< Imath::V2f > IndexedBufferConstV2f
Definition: IndexedBuffer.h:70
Base class of all Rumba values.
Definition: Value.h:34