IAddInfoLayout.hpp
1 #ifndef DM_IADDINFO_LAYOUT_HPP_INCLUDED
2 #define DM_IADDINFO_LAYOUT_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/ColumnTypes.hpp"
10 #include "DM/Handle.hpp"
11 #include "DM/ObjectBase.hpp"
12 #include "DM/AutoLink.hpp" //enable autolink
13 
14 //boost
15 #include <boost/any.hpp>
16 
17 DM_NAMESPACE_BEGIN
18 
19 /// \brief AddInfo layouts describe a set of attributes that can be attached to geometry objects
20 /**
21  Managing attributes, layout and views is a core feature of the DM library. Please refer to the
22  \ref dm_attributes section for implementation concepts and to the <a href="examples.html">examples</a>
23  section (attribute handling) for further details.
24 */
25 class DM_API IAddInfoLayout : public ObjectBase
26 {
27 public:
28  /// returns the predefined column name for a specific semantic.
29  static const char* getColumnName(ColumnSemantic::Type semantic);
30  /// returns the column type of a predefined semantic
31  static ColumnType::Type getColumnType(ColumnSemantic::Type semantic);
32 
33  /// find the semantic enumerator based on a given colum name
34  /// \return corresponding enumerator of ColumnSemantic::null if the given name isn't a predefined colum name
35  static ColumnSemantic::Type getColumnSemantic(const char* name, bool caseSensitive = true);
36  /// find the type of a predefined column based on a given colum name
37  /// \return corresponding enumerator of ColumnType::count if the given name isn't a predefined colum name
38  static ColumnType::Type getColumnType(const char* name, bool caseSensitive = true);
39 
40 
41 protected:
42  virtual ~IAddInfoLayout() {}
43 
44 public:
45  virtual unsigned columns() const = 0;
46 
47  virtual const char* name(unsigned index) const = 0;
48  virtual ColumnType::Type type(unsigned index) const = 0;
49  virtual ColumnSemantic::Type semantic(unsigned index) const = 0;
50  virtual unsigned size(unsigned index) const = 0; ///< returns array size
51 
52  virtual int index(const char*) const = 0;
53  virtual int index(ColumnSemantic::Type) const = 0;
54 };
55 
57 
58 DM_NAMESPACE_END
59 
60 
61 #endif //DM_IADDINFO_LAYOUT_HPP_INCLUDED