/usr/include/opengm/utilities/macros.hxx is in libopengm-dev 2.3.6+20160905-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #pragma once
#ifndef OPENGM_MACROS
#define OPENGM_MACROS
#include <string>
#include "opengm/opengm.hxx"
#define STRING_TO_ENUM_1( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) ENUM_OUT=CLASS_OF_ENUM::ENTRY_1 \
else (throw RuntimeError(std::string("Wrong value for parameter")+std::string(#PARAM_NAME)))
#define STRING_TO_ENUM_2( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) ENUM_OUT=CLASS_OF_ENUM::ENTRY_1 \
else if (NAME_STRING==std::string( #ENTRY_2)) ENUM_OUT=CLASS_OF_ENUM::ENTRY_2 \
else (throw RuntimeError(std::string("Wrong value for parameter")+std::string(#PARAM_NAME)))
#define STRING_TO_ENUM_3( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_4( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_5( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_6( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENTYR_6,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else if (NAME_STRING==std::string( #ENTRY_6)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_6;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_7( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENTYR_6,ENTYR_7,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else if (NAME_STRING==std::string( #ENTRY_6)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_6;} \
else if (NAME_STRING==std::string( #ENTRY_7)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_7;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_8( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENTYR_6,ENTYR_7,ENTYR_8,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else if (NAME_STRING==std::string( #ENTRY_6)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_6;} \
else if (NAME_STRING==std::string( #ENTRY_7)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_7;} \
else if (NAME_STRING==std::string( #ENTRY_8)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_8;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_9( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENTYR_6,ENTYR_7,ENTYR_8,ENTYR_9,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else if (NAME_STRING==std::string( #ENTRY_6)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_6;} \
else if (NAME_STRING==std::string( #ENTRY_7)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_7;} \
else if (NAME_STRING==std::string( #ENTRY_8)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_8;} \
else if (NAME_STRING==std::string( #ENTRY_9)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_9;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#define STRING_TO_ENUM_10( CLASS_OF_ENUM,NAME_STRING,PARAM_NAME,ENTRY_1,ENTYR_2,ENTYR_3,ENTYR_4,ENTYR_5,ENTYR_6,ENTYR_7,ENTYR_8,ENTYR_9,ENTYR_10,ENUM_OUT) \
if (NAME_STRING==std::string( #ENTRY_1)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_1;} \
else if (NAME_STRING==std::string( #ENTRY_2)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_2;} \
else if (NAME_STRING==std::string( #ENTRY_3)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_3;} \
else if (NAME_STRING==std::string( #ENTRY_4)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_4;} \
else if (NAME_STRING==std::string( #ENTRY_5)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_5;} \
else if (NAME_STRING==std::string( #ENTRY_6)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_6;} \
else if (NAME_STRING==std::string( #ENTRY_7)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_7;} \
else if (NAME_STRING==std::string( #ENTRY_8)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_8;} \
else if (NAME_STRING==std::string( #ENTRY_9)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_9;} \
else if (NAME_STRING==std::string( #ENTRY_10)) {ENUM_OUT=CLASS_OF_ENUM::ENTRY_10;} \
else {throw RuntimeError(std::string("unsupported value for parameter ")+std::string(#PARAM_NAME));}
#endif // #ifndef OPENGM_MACROS
|