Virtual Testbed
Ship dynamics simulator for extreme conditions
directory_entry.hh
1 #ifndef VTESTBED_IGES_DIRECTORY_ENTRY_HH
2 #define VTESTBED_IGES_DIRECTORY_ENTRY_HH
3 
4 #include <iosfwd>
5 
6 #include <vtestbed/iges/types.hh>
7 
8 namespace vtb {
9 
10  namespace iges {
11 
31  struct Directory_entry {
32 
33  typedef Integer* pointer;
34  typedef const Integer* const_pointer;
35  typedef pointer iterator;
36  typedef const_pointer const_iterator;
37  typedef size_t size_type;
38  typedef Integer& reference;
39  typedef const Integer& const_reference;
40 
41  union {
42  struct {
43  Integer _entitytype = 0;
44  mutable Integer _parameterdata = 0;
45  Integer _structure = 0;
46  Integer _linefontpattern = 0;
47  Integer _level = 0;
48  Integer _view = 0;
49  Integer _transformation_matrix = 0;
50  Integer _display_associativity = 0;
51  char _status[8] {'0', '0', '0', '0', '0', '0', '0', '0'};
52  Integer _entitytype2 = 0;
53  Integer _lineweight = 0;
54  Integer _color = 0;
55  Integer _linecount = 0;
56  Integer _form = 0;
57  Integer _reserved1 = 0;
58  Integer _reserved2 = 0;
59  char _label[8] {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
60  Integer _subscript = 0;
61  };
62  Integer _fields[18];
63  };
64 
65  inline pointer
66  data() noexcept {
67  return this->_fields;
68  }
69 
70  inline const_pointer
71  data() const noexcept {
72  return this->_fields;
73  }
74 
75  static constexpr inline size_type
76  size() noexcept {
77  return sizeof(_fields) / sizeof(Integer);
78  }
79 
80  inline iterator
81  begin() noexcept {
82  return this->data();
83  }
84 
85  inline const_iterator
86  begin() const noexcept {
87  return this->data();
88  }
89 
90  inline iterator
91  end() noexcept {
92  return this->data() + this->size();
93  }
94 
95  inline const_iterator
96  end() const noexcept {
97  return this->data() + this->size();
98  }
99 
100  inline reference
101  operator[](size_type i) noexcept {
102  return this->_fields[i];
103  }
104 
105  inline const_reference
106  operator[](size_type i) const noexcept {
107  return this->_fields[i];
108  }
109 
110  inline Integer
111  type() const noexcept {
112  return this->_entitytype;
113  }
114 
115  inline void
116  type(Integer rhs) noexcept {
117  this->_entitytype = rhs;
118  }
119 
120  inline void
121  parameter_data(Integer number) const {
122  this->_parameterdata = number;
123  }
124 
125  inline size_type
126  sequence_number() const noexcept {
127  return 2*this->_parameterdata - 1;
128  }
129 
130  inline void
131  status(size_type i, char ch) {
132  this->_status[i] = ch;
133  }
134 
135  inline void
136  dependent(bool b) {
137  this->status(3, b ? '3' : '0');
138  }
139 
140  };
141 
142  const char*
143  operator>>(const char* text, Directory_entry& entry);
144 
145  std::ostream&
146  operator<<(std::ostream& out, const Directory_entry& rhs);
147 
148  }
149 
150 }
151 
152 #endif // vim:filetype=cpp
Directory section entry.
Main namespace.
Definition: convert.hh:9