/**
 * File: hashStringTable
 *
 * Author: raul
 * Created: 02/27/15
 * 
 * Description:
 * 
 * Copyright: Anki, Inc. 2015
 *
 **/

#ifndef __Util_CharacterStringMap_H__
#define __Util_CharacterStringMap_H__

#include <unordered_map>
#include <string>

namespace Anki {
namespace Util {

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// HashStringTable
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class HashStringTable
{
public:

  using IdType = size_t;
  
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Methods
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  // IdType <-> String
  IdType GetIdFromString(const std::string& str);
  const std::string& GetStrFromId(const IdType myId) const;

private:

  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Attributes
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  static const std::string failStr;
  
  // id to string table
  using IdToStringTable = std::unordered_map<IdType, std::string>;
  IdToStringTable _idToString;
};

} // namespace
} // namespace

#endif
