8 #ifndef enum_type_map_h
9 #define enum_type_map_h
25 template<
typename EnumType>
29 typedef typename std::map<std::string, EnumType>
Str2Enum;
30 typedef typename std::map<EnumType, std::string>
Enum2Str;
49 QDPIO::cout <<
"Allowed enum " <<
typeIDString <<
" std::string-value pairs are: " << std::endl;
50 QDPIO::cout <<
"==================== " << std::endl;
53 QDPIO::cout <<
" String: " <<
it->second <<
", Int value of enum: " <<
it->first << std::endl;
75 success =
enum_map.insert(make_pair(
t,
s)).second;
77 std::cerr <<
"Enum-String Insertion Failure. Enum="<<
t<<
" String=" <<
s << std::endl;
78 std::cerr <<
"Most Likely pair already inserted. Check relevant files for duplicates" << std::endl << std::flush ;
83 success &=
str_map.insert(make_pair(
s,
t)).second;
85 std::cerr <<
"String-Enum Insertion Failure. Enum="<<
t<<
" String=" <<
s << std::endl;
86 std::cerr <<
"Most Likely pair already inserted. Check relevant files for duplicates" << std::endl << std::flush ;
139 QDPIO::cerr <<
"Caught Exception parsing XML: " << xml_e << std::endl;
148 QDPIO::cerr <<
"No enum " <<
typeIDString <<
" registered for std::string " << e.
val_str <<
" while parsing XML Query " << path << std::endl;
166 QDPIO::cerr <<
"No std::string found for enum " <<
typeIDString <<
" with value " <<
t <<
" while attempting to write XML " << std::endl;
176 QDPIO::cerr <<
"Caught Exception writing XML: " << xml_e << std::endl;
183 BinaryReader& bin_in,
188 QDP::readDesc(bin_in, string_in);
191 QDPIO::cerr <<
"Caught Exception parsing BIN: " << bin_e << std::endl;
200 QDPIO::cerr <<
"No enum " <<
typeIDString <<
" registered for std::string " << e.
val_str <<
" while parsing Binary lookup" << std::endl;
209 BinaryWriter& bin_out,
217 QDPIO::cerr <<
"No std::string found for enum " <<
typeIDString <<
" with value " <<
t <<
" while attempting to write BIN " << std::endl;
224 QDP::writeDesc(bin_out, string_out);
227 QDPIO::cerr <<
"Caught Exception writing BIN: " << bin_e << std::endl;
Primary include file for CHROMA library code.
Main enum std::map holder.
void write(const std::string &typeIDString, XMLWriter &xml_out, const std::string &path, const EnumType &t)
Writer.
EnumTypeMap(const EnumTypeMap< EnumType > &t)
void read(const std::string &typeIDString, BinaryReader &bin_in, EnumType &t)
"Reader"
bool registerPair(const std::string &s, const EnumType t)
Function registers a std::string/enum pair.
void dumpMapStrings(const std::string &typeIDString)
void write(const std::string &typeIDString, BinaryWriter &bin_out, const EnumType &t)
Writer.
std::string lookUpString(const EnumType &t)
Look up a std::string from an enum.
EnumType lookUpEnum(const std::string &s)
Look up an enum based on a std::string.
std::map< EnumType, std::string > Enum2Str
std::map< EnumType, std::string >::iterator Enum2StrIterator
std::map< std::string, EnumType > Str2Enum
std::map< std::string, EnumType >::iterator Str2EnumIterator
void read(const std::string &typeIDString, XMLReader &xml_in, const std::string &path, EnumType &t)
"Reader"
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams ¶m)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams ¶m)
Writer parameters.
const std::string typeIDString
Asqtad Staggered-Dirac operator.
multi1d< LatticeFermion > s(Ncb)
EnumLookupException(const std::string &s)
const std::string val_str
StringLookupException(const EnumType &t)