OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment.
Loading...
Searching...
No Matches
Snapshot.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_SNAPSHOT_H_
33#define _OMS_SNAPSHOT_H_
34
35#include "ComRef.h"
36#include "OMSFileSystem.h"
37#include "ssd/Tags.h"
38#include "OMSimulator/Types.h"
39
40#include <pugixml.hpp>
41#include <string>
42#include <vector>
43
44namespace oms
45{
47 {
48 public:
49 Snapshot(bool partial=false);
50 ~Snapshot();
51
52 oms_status_enu_t import(const char* snapshot);
53 oms_status_enu_t importResourceFile(const filesystem::path& filename, const filesystem::path& root);
54 oms_status_enu_t importResourceMemory(const filesystem::path& filename, const char* contents);
55 oms_status_enu_t importResourceNode(const filesystem::path& filename, const pugi::xml_node& node);
56
57 bool isPartialSnapshot() const;
58
59 pugi::xml_node newResourceNode(const filesystem::path& filename);
60 pugi::xml_node operator[](const filesystem::path& filename);
61
62 void getResources(std::vector<std::string>& resources) const;
63 pugi::xml_node getResourceNode(const filesystem::path& filename) const;
64
65 pugi::xml_node getTemplateResourceNodeSSD(const filesystem::path& filename, const ComRef& cref);
66 pugi::xml_node getTemplateResourceNodeSSV(const filesystem::path& filename, const std::string& cref);
67 pugi::xml_node getTemplateResourceNodeSSM(const filesystem::path& filename);
68 pugi::xml_node getTemplateResourceNodeSignalFilter(const filesystem::path& filename);
70 oms_status_enu_t exportPartialSnapshot(const ComRef& cref, Snapshot& partialSnapshot);
71 oms_status_enu_t importPartialSnapshot(const char* fullsnapshot);
72
73 void debugPrintNode(const filesystem::path& filename) const;
74 void debugPrintAll() const;
78
79 oms_status_enu_t deleteResourceNode(const filesystem::path& filename);
80
81 oms_status_enu_t writeDocument(char** contents);
82 oms_status_enu_t writeResourceNode(const filesystem::path& filename, const filesystem::path& path) const;
83
84 private:
85 oms_status_enu_t importPartialResourceNode(const filesystem::path& filename, const filesystem::path& nodename, const pugi::xml_node& node);
86
87 private:
88 // stop the compiler generating methods copying the object
89 Snapshot(Snapshot const& copy);
90 Snapshot& operator=(Snapshot const& copy);
91
92 private:
93 pugi::xml_document doc; // snapshot document
94 };
95}
96
97#endif
ComRef - component reference.
Definition ComRef.h:47
Definition Snapshot.h:47
pugi::xml_node getTemplateResourceNodeSSDVariants()
Definition Snapshot.cpp:231
void debugPrintNode(const filesystem::path &filename) const
Definition Snapshot.cpp:169
void debugPrintAll() const
Definition Snapshot.cpp:177
oms::ComRef getSignalFilterFilename() const
Definition Snapshot.cpp:250
oms::ComRef getSSDFilename() const
Definition Snapshot.cpp:240
oms_status_enu_t importPartialResourceNode(const filesystem::path &filename, const filesystem::path &nodename, const pugi::xml_node &node)
Definition Snapshot.cpp:115
pugi::xml_document doc
Definition Snapshot.h:93
oms_status_enu_t exportPartialSnapshot(const ComRef &cref, Snapshot &partialSnapshot)
Definition Snapshot.cpp:271
pugi::xml_node getTemplateResourceNodeSSM(const filesystem::path &filename)
Definition Snapshot.cpp:211
pugi::xml_node getTemplateResourceNodeSSV(const filesystem::path &filename, const std::string &cref)
Definition Snapshot.cpp:198
pugi::xml_node operator[](const filesystem::path &filename)
Definition Snapshot.cpp:158
pugi::xml_node newResourceNode(const filesystem::path &filename)
Definition Snapshot.cpp:52
oms_status_enu_t writeDocument(char **contents)
Definition Snapshot.cpp:412
Snapshot(Snapshot const &copy)
not implemented
void getResources(std::vector< std::string > &resources) const
Definition Snapshot.cpp:126
~Snapshot()
Definition Snapshot.cpp:48
oms::ComRef getRootCref() const
Definition Snapshot.cpp:260
oms_status_enu_t writeResourceNode(const filesystem::path &filename, const filesystem::path &path) const
Definition Snapshot.cpp:439
oms_status_enu_t importResourceNode(const filesystem::path &filename, const pugi::xml_node &node)
Definition Snapshot.cpp:105
pugi::xml_node getTemplateResourceNodeSSD(const filesystem::path &filename, const ComRef &cref)
Definition Snapshot.cpp:182
pugi::xml_node getResourceNode(const filesystem::path &filename) const
Definition Snapshot.cpp:133
Snapshot & operator=(Snapshot const &copy)
not implemented
oms_status_enu_t importResourceFile(const filesystem::path &filename, const filesystem::path &root)
Definition Snapshot.cpp:83
oms_status_enu_t importResourceMemory(const filesystem::path &filename, const char *contents)
Definition Snapshot.cpp:95
bool isPartialSnapshot() const
Definition Snapshot.cpp:77
pugi::xml_node getTemplateResourceNodeSignalFilter(const filesystem::path &filename)
Definition Snapshot.cpp:222
oms_status_enu_t importPartialSnapshot(const char *fullsnapshot)
Definition Snapshot.cpp:332
oms_status_enu_t deleteResourceNode(const filesystem::path &filename)
Definition Snapshot.cpp:145
Definition AlgLoop.h:45