OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
PythonHeaderInterpreter.h
Go to the documentation of this file.
1#pragma once
2#include "OTCore/JSON.h"
3#include "EntityFile.h"
4#include "Connector.h"
5#include <vector>
7{
8public:
10
11 bool interprete(std::shared_ptr<EntityFile> pythonScript);
12 const std::list<ot::Connector>& getAllConnectors() const { return _allConnectors; };
13 const std::list<EntityPropertiesBase*>& getAllProperties()const { return _allProperties; };
14 const std::string& getErrorReport() const { return _report; };
15private:
16 std::list<ot::JsonDocument *> _allConnectorsAsJSON;
17 std::list<ot::JsonDocument*> _allPropertiesAsJSON;
18
19 std::list<EntityPropertiesBase*> _allProperties;
20 std::list<ot::Connector> _allConnectors;
21 std::map<ot::JsonDocument *, int> _jsonEntryToScriptLine;
22 std::string _report;
23
24 const std::string _entryTypeNameProperty = "property";
25 const std::string _entryTypeNameConnector = "port";
26
27 const std::string _connectorDefTypeIn = "in";
28 const std::string _connectorDefTypeOut = "out";
29 const std::string _connectorDefTypeInOptional = "inopt";
30 const std::string _connectorDefName = "name";
31
32 const std::string _defType = "type";
33 const std::string _defTitle = "label";
34
35 const std::string _propertyDefTypeSelection = "selection";
36 const std::string _propertyDefTypeString = "string";
37 const std::string _propertyDefTypeDouble = "double";
38 const std::string _propertyDefTypeInteger = "integer";
39 const std::string _propertyDefTypeBoolean = "boolean";
40
41 const std::string _propertyDefOptions = "options";
42 const std::string _propertyDefDefault = "default";
43
44 const std::string _propertyGroupName = "Script based";
45
46
47
48 const std::string extractType(const std::string& lineContent);
49 bool ExtractOTHeader(const std::string& scriptLine, const int scriptLineNumber);
50 bool CreateObjectsFromJSON();
51 bool CreateConnectorsFromJSON();
52 bool CreatePropertiesFromJSON();
53 ot::ConnectorType getConnectorType(ot::JsonDocument& jsonEntry, std::string& returnMessage);
54 EntityPropertiesBase* createPropertyEntity(ot::JsonDocument& jsonEntry, std::string& returnMessage);
55};
Entity that holds a binary representation of a file. Any type of file should be supported.
Definition PythonHeaderInterpreter.h:7
virtual ~PythonHeaderInterpreter()
Definition PythonHeaderInterpreter.cpp:6
const std::list< EntityPropertiesBase * > & getAllProperties() const
Definition PythonHeaderInterpreter.h:13
const std::string & getErrorReport() const
Definition PythonHeaderInterpreter.h:14
bool interprete(std::shared_ptr< EntityFile > pythonScript)
Definition PythonHeaderInterpreter.cpp:19
const std::list< ot::Connector > & getAllConnectors() const
Definition PythonHeaderInterpreter.h:12
JSON document.
Definition JSON.h:276
ConnectorType
Definition Connector.h:9