IColBufferManagerWrite.hpp
1 #ifndef DM_COL_BUFFER_MANAGER_WRITE_HPP_INCLUDED
2 #define DM_COL_BUFFER_MANAGER_WRITE_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 
13 DM_NAMESPACE_BEGIN
14 
15 /// \brief managing interface for creating and filling point coordinates and attributes into a column based continuous memory buffer
16 class DM_API IColBufferManagerWrite : public ObjectBase
17 {
18 protected:
19  virtual ~IColBufferManagerWrite() {}
20 
21 public:
22  /// \brief initialise row buffers (first function that will be called by GenericConverter::initColBufferManager)
23  /// \param[in] cols number of column buffers that are required
24  /// \param[in] rows number of elements each row buffer needs to provide
25  virtual void setSize(unsigned cols, int64_t rows) = 0;
26 
27  /// \brief communicating the column type and label
28  /**
29  This function that will be called (by GenericConverter::initColBufferManager) for each column after the initial setSize function was called.
30  The caller therefore communicates the type and label of each column that will be processed. The function must return the type of the internal
31  columns buffer, which may differ from the provided type. However, only fixed size type are accepted:
32 
33  DM::ColumnType | Memory Size and Representation
34  ----------------|--------------------------------
35  int_ | 4 byte, signed integer
36  uint_ | 4 byte, unsigned integer
37  char_ | 1 byte, integer
38  uchar_ | 1 byte, unsigned integer
39  short_ | 2 byte, integer
40  ushort_ | 2 byte, unsigned integer
41  float_ | 4 byte, real
42  double_ | 8 byte, real
43  llong_ | 8 byte, signed integer
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  \param[in] colType DM type of the column/attribute
50  \param[in] colLabel label of current column/attribute
51  \return element type of internal column buffer
52  */
53  virtual ColumnType::Type setColumnType(unsigned col, ColumnType::Type colType, const char* colLabel) = 0;
54 
55  /// \brief get the pointer to the corresponding column buffer
56  /**
57  Will be called after the corresponding setSize and setColumnType calls. It is assumed that the returned
58  pointer shows to an initialised and properly sized memory chunk, that can be filled. Note that null values
59  do not change the corresponding memory byte(s).
60  */
61  virtual void * getColumnBuffer(unsigned col) = 0;
62 };
63 
64 DM_NAMESPACE_END
65 
66 #endif //DM_COL_BUFFER_MANAGER_WRITE_HPP_INCLUDED