IColBufferManagerRead.hpp
1 #ifndef DM_COL_BUFFER_MANAGER_READ_HPP_INCLUDED
2 #define DM_COL_BUFFER_MANAGER_READ_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/ObjectBase.hpp"
10 #include "DM/ColumnTypes.hpp"
11 #include "DM/AutoLink.hpp" //enable autolink
12 #include "DM/IValueTranslator.hpp"
13 
14 DM_NAMESPACE_BEGIN
15 
16 /// \brief managing interface for creating and filling point coordinates and attributes into a column based continuous memory buffer
17 class DM_API IColBufferManagerRead : public ObjectBase
18 {
19 protected:
20  virtual ~IColBufferManagerRead() {}
21 
22 public:
23  virtual int64_t getRows() const = 0;
24  virtual int64_t getColumns() const = 0;
25 
26  /// \brief get internal column type
27  /**
28  This function that will be called (by GenericConverter::initColBufferManager) for each column after the initial setSize function was called.
29  The caller therefore communicates the type and label of each column that will be processed. The function must return the type of the internal
30  columns buffer, which may differ from the provided type. However, only fixed size type are accepted:
31 
32  DM::ColumnType | Memory Size and Representation
33  ----------------|--------------------------------
34  int_ | 4 byte, signed integer
35  uint_ | 4 byte, unsigned integer
36  char_ | 1 byte, integer
37  uchar_ | 1 byte, unsigned integer
38  short_ | 2 byte, integer
39  ushort_ | 2 byte, unsigned integer
40  float_ | 4 byte, real
41  double_ | 8 byte, real
42  llong_ | 8 byte, signed integer
43 
44 
45  Its the managers responsibility to create appropriate sized column buffers and that are initialise with appropriate null values,
46  since the subsequent buffer filling doesn't write any null values are the corresponding memory positions.
47 
48  \param[in] col current column index
49  \return element type of internal column buffer
50  */
51  virtual ColumnType::Type getColumnType(unsigned col) const = 0;
52 
53  /// \brief get optional translator object for translating values before setting
54  virtual const IValueTranslator* getTranslator(unsigned col) const = 0;
55 
56  /// \brief get the pointer to the corresponding column buffer
57  /**
58  Will be called after the corresponding setSize and setColumnType calls. It is assumed that the returned
59  pointer shows to an initialised and properly sized memory chunk, that can be filled. Note that null values
60  do not change the corresponding memory byte(s).
61  */
62  virtual const void * getColumnBuffer(unsigned col) const = 0;
63 
64  /// \brief get stride size between subsequent elements in the column buffer
65  /**
66  In case of continuous memory array the stride size is equal to the element size (in bytes)
67  */
68  virtual unsigned getStride(unsigned col) const = 0;
69 
70 };
71 
72 DM_NAMESPACE_END
73 
74 #endif //DM_COL_BUFFER_MANAGER_READ_HPP_INCLUDED