1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
// Author: Yuan Li
#ifndef _BLASR_REGION_TYPE_MAP_HPP_
#define _BLASR_REGION_TYPE_MAP_HPP_
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include "../Types.h"
#include "../Enumerations.h"
class RegionTypeMap {
public:
/// \name Map region type to/from string and index
/// \{
static std::string ToString(RegionType rt);
static RegionType ToRegionType(const std::string & str);
/// \params[in] typeStr - query region type as a string
/// \params[in] typeStrs - a vector region type strings in order
/// \returns index of a region type as string in a vector of region type strings
static int ToIndex(const std::string & typeStr,
const std::vector<std::string> & typeStrs);
/// \params[in] rt - query region type
/// \params[in] typeStrs - a vector region type strings in order
/// \returns index of the query region type in a vector of region type strings
static int ToIndex(RegionType rt,
const std::vector<std::string> & typeStrs);
/// \params[in] rt - query region type
/// \params[in] regionTypes - a vector region type strings in order
/// \returns index of the query region type in a vector of region type enums
static int ToIndex(RegionType rt,
const std::vector<RegionType> & regionTypes);
private:
// Map region type to string
static const std::map<RegionType, std::string> RegionTypeToString;
// Map string to region type
static const std::map<std::string, RegionType> StringToRegionType;
/// \}
};
#endif // _BLASR_REGION_TYPE_MAP_HPP_
|