Ariles
node.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4 
5  @copyright 2017-2018 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 */
10 
11 #pragma once
12 
13 
14 namespace ariles
15 {
16  template <class t_RawNode>
18  {
19  public:
20  enum Type
21  {
22  UNDEFINED = 0,
23  GENERIC = 1,
24  ARRAY = 2,
25  MATRIX = 3
26  };
27 
28 
29  public:
30  t_RawNode node_;
31  std::size_t index_;
32  std::size_t size_;
34  bool compact_;
35 
36 
37  public:
38  Node(t_RawNode node, const Type type = GENERIC, const bool compact = false) : node_(node)
39  {
40  type_ = type;
41  index_ = 0;
42  size_ = 0;
43  compact_ = compact;
44  }
45 
46  Node(const std::size_t index, const std::size_t size, const bool compact = false) : index_(index), size_(size)
47  {
48  type_ = ARRAY;
49  compact_ = compact;
50  }
51 
52  Node(t_RawNode node, const std::size_t index, const std::size_t size, const bool compact = false)
53  : node_(node), index_(index), size_(size)
54  {
55  type_ = ARRAY;
56  compact_ = compact;
57  }
58 
59  bool isCompact() const
60  {
61  return (compact_);
62  }
63 
64  bool isMatrix() const
65  {
66  return (MATRIX == type_);
67  }
68 
69  bool isArray() const
70  {
71  return (ARRAY == type_);
72  }
73 
74  bool isAllParsed() const
75  {
76  return (index_ == size_);
77  }
78  };
79 } // namespace ariles
Node(t_RawNode node, const Type type=GENERIC, const bool compact=false)
Definition: node.h:38
Node(const std::size_t index, const std::size_t size, const bool compact=false)
Definition: node.h:46
bool isCompact() const
Definition: node.h:59
bool isAllParsed() const
Definition: node.h:74
Type type_
Definition: node.h:33
Node(t_RawNode node, const std::size_t index, const std::size_t size, const bool compact=false)
Definition: node.h:52
std::size_t size_
Definition: node.h:32
std::size_t index_
Definition: node.h:31
bool isArray() const
Definition: node.h:69
#define ARILES_VISIBILITY_ATTRIBUTE
Definition: helpers.h:69
bool compact_
Definition: node.h:34
Definition: basic.h:17
bool isMatrix() const
Definition: node.h:64
t_RawNode node_
Definition: node.h:30