summaryrefslogtreecommitdiffstats
path: root/Project/ControlElement.h
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2018-01-08 20:09:35 -0200
committerGitHub <noreply@github.com>2018-01-08 20:09:35 -0200
commit29af4e28898f44df444fef5534134c6b6000418d (patch)
tree13fd8f4449f2cfeed8a6185e96a6889f9529285d /Project/ControlElement.h
parent0c0280cfcf540f943fd2dbfdf7ac0304ea96a465 (diff)
parentc11a42ee83fcf535557d4f2cc259efae2da1b7ff (diff)
downloadPSP.git-29af4e28898f44df444fef5534134c6b6000418d.tar.gz
PSP.git-29af4e28898f44df444fef5534134c6b6000418d.tar.xz
PSP.git-29af4e28898f44df444fef5534134c6b6000418d.zip
Merge pull request #44 from Thales1330/org/file-handling-and-ctrl-init
Org file handling and ctrl init
Diffstat (limited to 'Project/ControlElement.h')
-rw-r--r--Project/ControlElement.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/Project/ControlElement.h b/Project/ControlElement.h
index dbff95e..51f8df3 100644
--- a/Project/ControlElement.h
+++ b/Project/ControlElement.h
@@ -58,6 +58,7 @@ class Node
void SetConnected(bool connected = true) { m_connected = connected; }
int GetID() const { return m_id; }
void SetID(int id) { m_id = id; }
+
protected:
int m_id = -1;
@@ -94,7 +95,7 @@ class ControlElement : public Element
std::vector<Node*> GetNodeList() const { return m_nodeList; }
virtual void DrawNodes() const;
virtual void ReplaceNode(Node* oldNode, Node* newNode);
-
+
/**
* @brief Update the OpenGL text in the element (if present).
* @return true if OpenGLText is ok, false otherwise.
@@ -103,13 +104,19 @@ class ControlElement : public Element
virtual bool IsSolved() const { return m_solved; }
virtual void SetSolved(bool solved = true) { m_solved = solved; }
virtual bool Solve(double* input, double timeStep);
- virtual bool Initialize() { return true; }
+ virtual bool Initialize();
virtual double GetOutput() const { return m_output; }
virtual void SetOutput(double output) { m_output = output; }
+
+ static ControlElement* GetControlElementFromID(std::vector<ControlElement*> elementList, int id);
+
protected:
std::vector<Node*> m_nodeList;
bool m_solved = false;
double m_output = 0.0;
+
+ void SaveControlNodes(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementNode);
+ bool OpenControlNodes(rapidxml::xml_node<>* elementNode);
};
#endif // CONTROLELEMENT_H