TuttleOFX
1
|
00001 #ifndef _SAM_UTILITY_HPP_ 00002 #define _SAM_UTILITY_HPP_ 00003 00004 #include <boost/algorithm/string/predicate.hpp> 00005 00006 #include <string> 00007 #include <iostream> 00008 #include <tuttle/common/utils/global.hpp> 00009 #include <csignal> 00010 00011 bool string_to_boolean( const std::string& str ) 00012 { 00013 return ( str == "1" || boost::iequals(str, "y") || boost::iequals(str, "yes") || boost::iequals(str, "true") ); 00014 } 00015 00016 void signal_callback_handler( int signum ) 00017 { 00018 std::ostringstream os; 00019 os << "Signal "<< strsignal(signum) << "(" << signum << ") was caught.\nTerminate sam."; 00020 TUTTLE_LOG_WARNING(os.str()); 00021 exit(signum); 00022 } 00023 00024 #endif