forked from SAP-archive/fedem-mdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FmExternalCtrlSys.H
84 lines (60 loc) · 2.39 KB
/
FmExternalCtrlSys.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// SPDX-FileCopyrightText: 2023 SAP SE
//
// SPDX-License-Identifier: Apache-2.0
//
// This file is part of FEDEM - https://openfedem.org
////////////////////////////////////////////////////////////////////////////////
#ifndef FM_EXTERNAL_CTRL_SYS_H
#define FM_EXTERNAL_CTRL_SYS_H
#include "vpmDB/FmIsMeasuredBase.H"
#include "vpmDB/FmEngine.H"
#include "FFaLib/FFaContainers/FFaReferenceList.H"
class FmExternalCtrlSys : public FmIsMeasuredBase
{
Fmd_DB_HEADER_INIT();
public:
FmExternalCtrlSys();
// --- Get variables ---
bool getEngines(std::vector<FmEngine*>& v) const;
FmEngine* getEngine(size_t idx) const { return myEngines.getPtr(idx); }
const std::string& getFilePath() const { return myFilePath.getValue(); }
const Strings& getFromWorkspace() const { return myFromWorkspace.getValue(); }
const Strings& getToWorkspace() const { return myToWorkspace.getValue(); }
virtual const char* getUITypeName() const {return "External Control System";}
virtual bool isListable() const { return true; }
void resetFlags() { inputFileHasChanged = false; fileError.clear(); }
bool inputFileChanged() const { return inputFileHasChanged; }
bool hasFileErrors() const { return !fileError.empty(); }
const std::string& getErrorString() const { return fileError; }
virtual void getEntities(std::vector<FmSensorChoice>& toFill, int);
// --- Set variables ---
void setEngine(FmEngine* ctrl, size_t location);
void setFilePath(const std::string& path);
void setFromWorkspace(const Strings& ws) { myFromWorkspace.setValue(ws); }
void setToWorkspace(const Strings& ws) { myToWorkspace.setValue(ws); }
// --- File IO ---
static bool readAndConnect(std::istream& is, std::ostream& os = std::cout);
virtual std::ostream& writeFMF(std::ostream& os = std::cout);
bool completeAfterParse();
virtual int printSolverEntry(FILE* fp);
// --- Copy ---
virtual bool clone(FmBase* obj, int depth);
protected:
// --- Destructor ---
virtual ~FmExternalCtrlSys();
// --- File IO ---
virtual bool cloneLocal(FmBase* obj, int depth);
private:
// --- Parse Simulink file ---
bool readSimulinkFile();
public:
FFaField<std::string> myFilePath;
private:
FFaField<Strings> myFromWorkspace;
FFaField<Strings> myToWorkspace;
FFaReferenceList<FmEngine> myEngines;
FFaField<FFaReferenceListBase*> myEnginesField;
std::string fileError;
bool inputFileHasChanged;
};
#endif