| 150 | } |
| 151 | |
| 152 | double OSArgument::valueAsDouble() const { |
| 153 | if (!hasValue()) { |
| 154 | LOG_AND_THROW("This argument does not have a value set.") |
| 155 | } |
| 156 | if ((type() != OSArgumentType::Double) && (type() != OSArgumentType::Integer)) { |
| 157 | LOG_AND_THROW("This argument is of type " << type().valueName() << ", not of type Double."); |
| 158 | } |
| 159 | |
| 160 | double result = 0.0; |
| 161 | if (type() == OSArgumentType::Double) { |
| 162 | result = std::get<double>(m_value); |
| 163 | } else { |
| 164 | result = std::get<int>(m_value); |
| 165 | LOG(Warn, "This argument is of type 'Integer' but returning as a Double as requested. You should consider using valueAsInteger instead"); |
| 166 | } |
| 167 | |
| 168 | return result; |
| 169 | } |
| 170 | |
| 171 | int OSArgument::valueAsInteger() const { |
| 172 | if (!hasValue()) { |