| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /** | ||
| 2 | * @file file_configuration.cpp | ||
| 3 | * @author Vincent Berenz | ||
| 4 | * @copyright Copyright (c) 2019, New York University and Max Planck | ||
| 5 | * Gesellschaft, License BSD-3-Clause | ||
| 6 | * @date 2019-12-09 | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include "package_template/file_configuration.hpp" | ||
| 10 | |||
| 11 | namespace package_template | ||
| 12 | { | ||
| 13 | 4 | File_configuration::File_configuration(std::string yaml_file) | |
| 14 | { | ||
| 15 | try | ||
| 16 | { | ||
| 17 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
|
4 | YAML::Node node = YAML::LoadFile(yaml_file); |
| 18 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | this->kp_ = node["kp"].as<double>(); |
| 19 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | this->kd_ = node["kd"].as<double>(); |
| 20 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | this->ki_ = node["ki"].as<double>(); |
| 21 | |||
| 22 | 3 | this->error_ = false; | |
| 23 | } | ||
| 24 | 2 | catch (const std::exception& e) | |
| 25 | { | ||
| 26 | 1 | this->error_ = true; | |
| 27 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | this->error_message_ = e.what(); |
| 28 | } | ||
| 29 | 4 | } | |
| 30 | |||
| 31 | 2 | double File_configuration::get_kp() const | |
| 32 | { | ||
| 33 | 2 | return this->kp_; | |
| 34 | } | ||
| 35 | |||
| 36 | 2 | double File_configuration::get_kd() const | |
| 37 | { | ||
| 38 | 2 | return this->kd_; | |
| 39 | } | ||
| 40 | |||
| 41 | 2 | double File_configuration::get_ki() const | |
| 42 | { | ||
| 43 | 2 | return this->ki_; | |
| 44 | } | ||
| 45 | |||
| 46 | 2 | bool File_configuration::has_error() const | |
| 47 | { | ||
| 48 | 2 | return this->error_; | |
| 49 | } | ||
| 50 | |||
| 51 | ✗ | std::string File_configuration::get_error() const | |
| 52 | { | ||
| 53 | ✗ | return this->error_message_; | |
| 54 | } | ||
| 55 | |||
| 56 | } // namespace package_template | ||
| 57 |