| 54 | |
| 55 | #ifdef BAIDU_INTERNAL |
| 56 | void GFlag::get_value(boost::any* value) const { |
| 57 | GFLAGS_NAMESPACE::CommandLineFlagInfo info; |
| 58 | if (!GFLAGS_NAMESPACE::GetCommandLineFlagInfo(gflag_name().c_str(), &info)) { |
| 59 | *value = "Unknown gflag=" + gflag_name(); |
| 60 | } else if (info.type == "string") { |
| 61 | *value = info.current_value; |
| 62 | } else if (info.type == "int32") { |
| 63 | *value = static_cast<int>(atoi(info.current_value.c_str())); |
| 64 | } else if (info.type == "int64") { |
| 65 | *value = static_cast<int64_t>(atoll(info.current_value.c_str())); |
| 66 | } else if (info.type == "uint64") { |
| 67 | *value = static_cast<uint64_t>( |
| 68 | strtoull(info.current_value.c_str(), NULL, 10)); |
| 69 | } else if (info.type == "bool") { |
| 70 | *value = (info.current_value == "true"); |
| 71 | } else if (info.type == "double") { |
| 72 | *value = strtod(info.current_value.c_str(), NULL); |
| 73 | } else { |
| 74 | *value = "Unknown type=" + info.type + " of gflag=" + gflag_name(); |
| 75 | } |
| 76 | } |
| 77 | #endif |
| 78 | |
| 79 | std::string GFlag::get_value() const { |