SEScenarioLog.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5class SEScenario;
6
7#include "cdm/properties/SEScalarTime.h"
8
9#include <map>
10#include <vector>
11#include <string>
12
13class CDM_DECL SEScenarioLog : public Loggable
14{
15public:
16 SEScenarioLog(Logger* logger);
17 virtual ~SEScenarioLog();
18
19 virtual void Clear();
20
21 virtual bool Convert(const std::string& logFilename, SEScenario& dst);
22
23 // If final simulation time is absent in log, we will use this additional time, default=2min
24 virtual void AbsentAdditionalTime(const SEScalarTime& time);
25
26 // Highly experimental and probably won't work, but easy to improve if you really need it
27 static bool GenerateScenarioFromLegacyLog(const std::string& logFilename, const std::string& stateFilename, double extraTime_s=0);
28
29protected:
30 void DetectEOL(const std::string& content);
31 bool Extract(const std::string& filename);
32 bool ExtractTagStrings(const std::string& tag, const std::string& content, std::vector<std::string>& tagStrs, bool braces=true);
33 bool ExtractTagStrings(const std::string& tag, const std::string& content, std::map<double, std::vector<std::string>>& tagStrs, bool braces=true);
34 bool GetActions(const std::string& content);
35 bool GetConditions(const std::string& content);
36 bool GetFinalSimTime(const std::string& content);
37 bool GetPatient(const std::string& content);
38 bool GetSerializeFromFile(const std::string& content);
39 bool GetSerializeFromString(const std::string& content);
40 bool IdentifyTagStringEnd(const std::string& content, size_t& endIdx);
41 bool ParseTime(const std::string& timeStr, double& time_s);
42
43 // Pulled directly from log
44 std::map<double, std::vector<std::string>> m_Actions;
45 std::vector<std::string> m_Conditions;
46 std::string m_EOL;
48 std::string m_Patient;
49 std::string m_StateFilename;
50 std::string m_State;
51
52 // Specified by user (or default)
54};
Definition: Logger.h:23
Definition: Logger.h:71
Definition: SEScalarTime.h:28
Definition: SEScenario.h:12
Definition: SEScenarioLog.h:14
std::vector< std::string > m_Conditions
Definition: SEScenarioLog.h:45
std::string m_StateFilename
Definition: SEScenarioLog.h:49
SEScalarTime m_AdditionalTime
Definition: SEScenarioLog.h:53
std::string m_State
Definition: SEScenarioLog.h:50
std::string m_Patient
Definition: SEScenarioLog.h:48
std::map< double, std::vector< std::string > > m_Actions
Definition: SEScenarioLog.h:44
std::string m_EOL
Definition: SEScenarioLog.h:46
double m_FinalSimTime_s
Definition: SEScenarioLog.h:47

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.