| 46 | } |
| 47 | |
| 48 | std::string EvComment::ToXml() const { |
| 49 | try { |
| 50 | auto xml_file = CreateXmlFile("FileWriter"); |
| 51 | constexpr bool ho_active = false; |
| 52 | auto& root_node = CreateRootNode(*xml_file, ho_active); |
| 53 | ToTx(root_node); |
| 54 | if (pre_trigger_interval_.IsActive()) { |
| 55 | pre_trigger_interval_.ToXml(root_node, "pre_trigger_interval"); |
| 56 | } |
| 57 | if (post_trigger_interval_.IsActive()) { |
| 58 | post_trigger_interval_.ToXml(root_node, "post_trigger_interval"); |
| 59 | } |
| 60 | ToFormula(root_node); |
| 61 | if (timeout_.IsActive()) { |
| 62 | timeout_.ToXml(root_node, "timeout"); |
| 63 | } |
| 64 | ToCommonProp(root_node); |
| 65 | return xml_file->WriteString(true); |
| 66 | } catch (const std::exception& err) { |
| 67 | MDF_ERROR() << "Failed to create the EV comment. Error: " << err.what(); |
| 68 | } |
| 69 | return {}; |
| 70 | } |
| 71 | |
| 72 | void EvComment::FromXml(const std::string& xml_snippet) { |
| 73 | if (xml_snippet.empty()) { |
nothing calls this directly
no test coverage detected