SEDataRequested.h
1/* Distributed under the Apache License, Version 2.0.
2 See accompanying NOTICE file for details.*/
3
4#pragma once
5
6#include "cdm/PhysiologyEngine.h"
7#include "cdm/engine/SEEventManager.h"
8class DataTrack;
9
10class CDM_DECL SEDataRequested : public LoggerForward, public SEEventHandler
11{
12 friend class PBEngine;//friend the serialization class
13public:
14 struct Segment
15 {
16 int id;
17 double time_s;
18 std::vector<double> values;
19 };
20 explicit SEDataRequested();
21 virtual ~SEDataRequested();
22
25
26 virtual void Clear(); //clear memory
27
28 bool SerializeToString(std::string& output, eSerializationFormat m) const;
29 static bool SerializeToString(const std::vector<SEDataRequested*>& src, std::string& dst, eSerializationFormat m);
30
31 virtual int GetID() const;
32 virtual void SetID(int id);
33
34 virtual bool IsActive() const;// Set when an Error or Fatal has been loggged
35 virtual void SetIsActive(bool b);
36
37 virtual void ClearDataRequested();
38 virtual void PullDataRequested(int id, double currentTime_s, DataTrack& tracker);
39
40 virtual const std::vector<std::string>& GetHeaders() const;
41 virtual const std::vector<Segment>& GetSegments() const;
42
43 virtual bool KeepLogMessages() const { return m_KeepLogMessages; }
44 virtual void KeepLogMessages(bool b) { m_KeepLogMessages = b; }
45 virtual const std::vector<SEEventChange>& GetEventChanges() const;
46 virtual const LogMessages& GetLogMessages() const;
47
48 void ForwardDebug(const std::string& msg) override;
49 void ForwardInfo(const std::string& msg) override;
50 void ForwardWarning(const std::string& msg) override;
51 void ForwardError(const std::string& msg) override;
52 void ForwardFatal(const std::string& msg) override;
53
54 virtual bool KeepEventChanges() const { return m_KeepEventChanges; }
55 virtual void KeepEventChanges(bool b) { m_KeepEventChanges = b; }
56
57 void HandleEvent(eEvent type, bool active, const SEScalarTime* time = nullptr) override;
58
59protected:
60 int m_ID;
63 std::vector<SEEventChange> m_EventChanges;
66 std::vector<std::string> m_Headers;
67 std::vector<Segment> m_Segments;
69};
Definition: DataTrack.h:17
Definition: Logger.h:136
Definition: Logger.h:60
virtual void ForwardFatal(std::string const &)
Definition: Logger.h:67
virtual void ForwardDebug(std::string const &)
Definition: Logger.h:63
virtual void ForwardWarning(std::string const &)
Definition: Logger.h:65
virtual void ForwardError(std::string const &)
Definition: Logger.h:66
virtual void ForwardInfo(std::string const &)
Definition: Logger.h:64
Definition: PBEngine.h:31
Definition: PhysiologyEngine.h:68
Definition: SEDataRequested.h:11
virtual void KeepEventChanges(bool b)
Definition: SEDataRequested.h:55
SEDataRequested(const SEDataRequested &)=delete
virtual bool KeepLogMessages() const
Definition: SEDataRequested.h:43
std::vector< Segment > m_Segments
Definition: SEDataRequested.h:67
LogMessages m_LogMessages
Definition: SEDataRequested.h:65
std::vector< SEEventChange > m_EventChanges
Definition: SEDataRequested.h:63
std::vector< std::string > m_Headers
Definition: SEDataRequested.h:66
const PhysiologyEngine * m_Engine
Definition: SEDataRequested.h:68
SEDataRequested operator=(const SEDataRequested &)=delete
bool m_KeepEventChanges
Definition: SEDataRequested.h:62
virtual void KeepLogMessages(bool b)
Definition: SEDataRequested.h:44
bool m_KeepLogMessages
Definition: SEDataRequested.h:64
int m_ID
Definition: SEDataRequested.h:60
bool m_IsActive
Definition: SEDataRequested.h:61
virtual bool KeepEventChanges() const
Definition: SEDataRequested.h:54
Definition: SEEventManager.h:73
virtual void HandleEvent(eEvent e, bool active, const SEScalarTime *simTime=nullptr)=0
Definition: SEScalarTime.h:28
Definition: SEDataRequested.h:15
double time_s
Definition: SEDataRequested.h:17
std::vector< double > values
Definition: SEDataRequested.h:18
int id
Definition: SEDataRequested.h:16

Distributed under the Apache License, Version 2.0.

See accompanying NOTICE file for details.