BRE12
anchordict.h
1 #ifndef ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3 
4 #if defined(_MSC_VER) || \
5  (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
6  (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
7 #pragma once
8 #endif
9 
10 #include <vector>
11 
12 #include "../anchor.h"
13 
14 namespace YAML {
22 template <class T>
23 class AnchorDict {
24  public:
25  void Register(anchor_t anchor, T value) {
26  if (anchor > m_data.size()) {
27  m_data.resize(anchor);
28  }
29  m_data[anchor - 1] = value;
30  }
31 
32  T Get(anchor_t anchor) const { return m_data[anchor - 1]; }
33 
34  private:
35  std::vector<T> m_data;
36 };
37 }
38 
39 #endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
An object that stores and retrieves values correlating to anchor_t values.
Definition: anchordict.h:23
Definition: DrawableObjectLoader.h:10