OMSimulatorLib The OMSimulator project is a FMI-based co-simulation environment.

Loading...
Searching...
No Matches
Scope.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
5 * c/o Linköpings universitet, Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
14 * ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the Open Source Modelica
17 * Consortium (OSMC) Public License (OSMC-PL) are obtained
18 * from OSMC, either from the above address,
19 * from the URLs: http://www.ida.liu.se/projects/OpenModelica or
20 * http://www.openmodelica.org, and in the OpenModelica distribution.
21 * GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
22 *
23 * This program is distributed WITHOUT ANY WARRANTY; without
24 * even the implied warranty of MERCHANTABILITY or FITNESS
25 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
26 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
27 *
28 * See the full OSMC Public License conditions for more details.
29 *
30 */
31
32#ifndef _OMS_SCOPE_H_
33#define _OMS_SCOPE_H_
34
35#include "ComRef.h"
36#include "Model.h"
37#include "OMSimulator/Types.h"
38
39#include <map>
40#include <string>
41#include <vector>
42
43 namespace oms
44{
45 class Scope
46 {
47 private:
48 Scope();
49 ~Scope();
50
51 // stop the compiler generating methods copying the object
52 Scope(Scope const&);
53 Scope& operator=(Scope const&);
54
55 public:
60 static Scope& GetInstance();
61
62 Model* newModel(const ComRef& cref);
63 oms_status_enu_t deleteModel(const ComRef& cref);
64 oms_status_enu_t renameModel(const ComRef& cref, const ComRef& newCref);
65 oms_status_enu_t exportModel(const ComRef& cref, const std::string& filename);
66 oms_status_enu_t importModel(const std::string& filename, char** cref);
67 oms_status_enu_t setTempDirectory(const std::string& newTempDir);
68 oms_status_enu_t setWorkingDirectory(const std::string& newWorkingDir);
69 oms_status_enu_t getElement(const ComRef& cref, oms::Element** element);
70 oms_status_enu_t getElements(const ComRef& cref, oms::Element*** elements);
71 Model* getModel(const ComRef& cref);
72
73 oms_status_enu_t loadSnapshot(const ComRef& cref, const char* snapshot, char** newCref);
74 oms_status_enu_t importSnapshot(const ComRef& cref, const char* snapshot, char** newCref);
75
76 const std::string& getTempDirectory() const {return GetInstance().tempDir;}
77 const std::string& getWorkingDirectory();
78
79 static oms_status_enu_t miniunz(const std::string& filename, const std::string& extractdir);
80
81 private:
82 std::vector<Model*> models;
83 std::map<ComRef, unsigned int> models_map;
84
85 std::string tempDir;
86 std::string workDir;
87 };
88}
89
90#endif
ComRef.h
Model.h
oms::ComRef
ComRef - component reference.
Definition ComRef.h:47
oms::Element
Element.
Definition Element.h:47
oms::Model
Definition Model.h:53
oms::Scope
Definition Scope.h:46
oms::Scope::getWorkingDirectory
const std::string & getWorkingDirectory()
Definition Scope.cpp:345
oms::Scope::setWorkingDirectory
oms_status_enu_t setWorkingDirectory(const std::string &newWorkingDir)
Definition Scope.cpp:314
oms::Scope::Scope
Scope(Scope const &)
not implemented
oms::Scope::getElement
oms_status_enu_t getElement(const ComRef &cref, oms::Element **element)
Definition Scope.cpp:360
oms::Scope::Scope
Scope()
Definition Scope.cpp:42
oms::Scope::exportModel
oms_status_enu_t exportModel(const ComRef &cref, const std::string &filename)
Definition Scope.cpp:135
oms::Scope::operator=
Scope & operator=(Scope const &)
not implemented
oms::Scope::~Scope
~Scope()
Definition Scope.cpp:54
oms::Scope::deleteModel
oms_status_enu_t deleteModel(const ComRef &cref)
Definition Scope.cpp:89
oms::Scope::miniunz
static oms_status_enu_t miniunz(const std::string &filename, const std::string &extractdir)
Definition Scope.cpp:144
oms::Scope::GetInstance
static Scope & GetInstance()
Definition Scope.cpp:62
oms::Scope::importSnapshot
oms_status_enu_t importSnapshot(const ComRef &cref, const char *snapshot, char **newCref)
Definition Scope.cpp:452
oms::Scope::workDir
std::string workDir
Definition Scope.h:86
oms::Scope::newModel
Model * newModel(const ComRef &cref)
Definition Scope.cpp:69
oms::Scope::loadSnapshot
oms_status_enu_t loadSnapshot(const ComRef &cref, const char *snapshot, char **newCref)
Definition Scope.cpp:418
oms::Scope::importModel
oms_status_enu_t importModel(const std::string &filename, char **cref)
Definition Scope.cpp:182
oms::Scope::models
std::vector< Model * > models
last element is always NULL
Definition Scope.h:82
oms::Scope::setTempDirectory
oms_status_enu_t setTempDirectory(const std::string &newTempDir)
Definition Scope.cpp:279
oms::Scope::models_map
std::map< ComRef, unsigned int > models_map
Definition Scope.h:83
oms::Scope::tempDir
std::string tempDir
Definition Scope.h:85
oms::Scope::getModel
Model * getModel(const ComRef &cref)
Definition Scope.cpp:409
oms::Scope::getElements
oms_status_enu_t getElements(const ComRef &cref, oms::Element ***elements)
Definition Scope.cpp:388
oms::Scope::renameModel
oms_status_enu_t renameModel(const ComRef &cref, const ComRef &newCref)
Definition Scope.cpp:108
oms::Scope::getTempDirectory
const std::string & getTempDirectory() const
Definition Scope.h:76
oms
Definition AlgLoop.h:45