Concordia
word_map.hpp
1 #ifndef WORD_MAP_HDR
2 #define WORD_MAP_HDR
3 
4 #include <string>
5 #include <map>
6 #include "concordia/concordia_exception.hpp"
7 #include "concordia/common/config.hpp"
8 #include <boost/archive/text_oarchive.hpp>
9 #include <boost/archive/text_iarchive.hpp>
10 #include <boost/serialization/map.hpp>
11 
17 class WordMap {
18 public:
23  explicit WordMap() throw(ConcordiaException);
24 
27  virtual ~WordMap();
28 
37  INDEX_CHARACTER_TYPE getWordCode(const std::string & word)
38  throw(ConcordiaException);
39 
40 private:
41  friend class boost::serialization::access;
42 
43  template<class Archive>
44 
45  void serialize(Archive & ar, const unsigned int version) {
46  ar & _map;
47  ar & _nextFree;
48  }
49 
50  std::map<std::string, INDEX_CHARACTER_TYPE> _map;
51 
52  INDEX_CHARACTER_TYPE _nextFree;
53 };
54 
55 #endif
Definition: concordia_exception.hpp:11
Definition: word_map.hpp:17
virtual ~WordMap()
Definition: word_map.cpp:9
INDEX_CHARACTER_TYPE getWordCode(const std::string &word)
Definition: word_map.cpp:12
WordMap()
Definition: word_map.cpp:5