diff --git a/include/ceres/types.h b/include/ceres/types.h index d01e921bb..4473ad50b 100644 --- a/include/ceres/types.h +++ b/include/ceres/types.h @@ -498,6 +498,12 @@ CERES_EXPORT bool StringToNumericDiffMethodType( std::string value, NumericDiffMethodType* type); +CERES_EXPORT const char* LoggingTypeToString(LoggingType type); +CERES_EXPORT bool StringtoLoggingType(std::string value, LoggingType* type); + +CERES_EXPORT const char* DumpFormatTypeToString(DumpFormatType type); +CERES_EXPORT bool StringtoDumpFormatType(std::string value, LoggingType* type); + CERES_EXPORT const char* TerminationTypeToString(TerminationType type); CERES_EXPORT bool IsSchurType(LinearSolverType type); diff --git a/internal/ceres/types.cc b/internal/ceres/types.cc index 932ec7d70..469141452 100644 --- a/internal/ceres/types.cc +++ b/internal/ceres/types.cc @@ -336,6 +336,39 @@ const char* TerminationTypeToString(TerminationType type) { } } +const char* LoggingTypeToString(LoggingType type) { + switch (type) { + CASESTR(SILENT); + CASESTR(PER_MINIMIZER_ITERATION); + default: + return "UNKNOWN"; + } +} + +bool StringtoLoggingType(std::string value, LoggingType* type) { + UpperCase(&value); + STRENUM(SILENT); + STRENUM(PER_MINIMIZER_ITERATION); + return false; +} + + +const char* DumpFormatTypeToString(DumpFormatType type) { + switch (type) { + CASESTR(CONSOLE); + CASESTR(TEXTFILE); + default: + return "UNKNOWN"; + } +} + +bool StringtoDumpFormatType(std::string value, DumpFormatType* type) { + UpperCase(&value); + STRENUM(CONSOLE); + STRENUM(TEXTFILE); + return false; +} + #undef CASESTR #undef STRENUM