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-2026, 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 AGPL VERSION 3 LICENSE OR
11 * THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.8.
12 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
13 * RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GNU AGPL
14 * VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
15 *
16 * The OpenModelica software and the OSMC (Open Source Modelica Consortium)
17 * Public License (OSMC-PL) are obtained from OSMC, either from the above
18 * address, from the URLs:
19 * http://www.openmodelica.org or
20 * https://github.com/OpenModelica/ or
21 * http://www.ida.liu.se/projects/OpenModelica,
22 * and in the OpenModelica distribution.
23 *
24 * GNU AGPL version 3 is obtained from:
25 * https://www.gnu.org/licenses/licenses.html#GPL
26 *
27 * This program is distributed WITHOUT ANY WARRANTY; without
28 * even the implied warranty of MERCHANTABILITY or FITNESS
29 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
30 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
31 *
32 * See the full OSMC Public License conditions for more details.
33 *
34 */
35
36#ifndef _OMS_SNAPSHOT_H_
37#define _OMS_SNAPSHOT_H_
38
39#include "ComRef.h"
40#include "OMSFileSystem.h"
41#include "ssd/Tags.h"
42#include "OMSimulator/Types.h"
43
44#include <pugixml.hpp>
45#include <string>
46#include <vector>
47
48 namespace oms
49{
50 class Snapshot
51 {
52 public:
53 Snapshot(bool partial=false);
54 ~Snapshot();
55
56 oms_status_enu_t import(const char* snapshot);
57 oms_status_enu_t importResourceFile(const filesystem::path& filename, const filesystem::path& root);
58 oms_status_enu_t importResourceMemory(const filesystem::path& filename, const char* contents);
59 oms_status_enu_t importResourceNode(const filesystem::path& filename, const pugi::xml_node& node);
60
61 bool isPartialSnapshot() const;
62
63 pugi::xml_node newResourceNode(const filesystem::path& filename);
64 pugi::xml_node operator[](const filesystem::path& filename);
65
66 void getResources(std::vector<std::string>& resources) const;
67 pugi::xml_node getResourceNode(const filesystem::path& filename) const;
68
69 pugi::xml_node getTemplateResourceNodeSSD(const filesystem::path& filename, const ComRef& cref);
70 pugi::xml_node getTemplateResourceNodeSSV(const filesystem::path& filename, const std::string& cref);
71 pugi::xml_node getTemplateResourceNodeSSM(const filesystem::path& filename);
72 pugi::xml_node getTemplateResourceNodeSignalFilter(const filesystem::path& filename);
73 pugi::xml_node getTemplateResourceNodeSSDVariants();
74 oms_status_enu_t exportPartialSnapshot(const ComRef& cref, Snapshot& partialSnapshot);
75 oms_status_enu_t importPartialSnapshot(const char* fullsnapshot);
76
77 void debugPrintNode(const filesystem::path& filename) const;
78 void debugPrintAll() const;
79 oms::ComRef getRootCref() const;
80 oms::ComRef getSSDFilename() const;
81 oms::ComRef getSignalFilterFilename() const;
82
83 oms_status_enu_t deleteResourceNode(const filesystem::path& filename);
84
85 oms_status_enu_t writeDocument(char** contents);
86 oms_status_enu_t writeResourceNode(const filesystem::path& filename, const filesystem::path& path) const;
87
88 private:
89 oms_status_enu_t importPartialResourceNode(const filesystem::path& filename, const filesystem::path& nodename, const pugi::xml_node& node);
90
91 private:
92 // stop the compiler generating methods copying the object
93 Snapshot(Snapshot const& copy);
94 Snapshot& operator=(Snapshot const& copy);
95
96 private:
97 pugi::xml_document doc; // snapshot document
98 };
99}
100
101#endif
ComRef.h
OMSFileSystem.h
Tags.h
oms::ComRef
ComRef - component reference.
Definition ComRef.h:51
oms::Snapshot
Definition Snapshot.h:51
oms::Snapshot::getTemplateResourceNodeSSDVariants
pugi::xml_node getTemplateResourceNodeSSDVariants()
Definition Snapshot.cpp:235
oms::Snapshot::debugPrintNode
void debugPrintNode(const filesystem::path &filename) const
Definition Snapshot.cpp:173
oms::Snapshot::debugPrintAll
void debugPrintAll() const
Definition Snapshot.cpp:181
oms::Snapshot::getSignalFilterFilename
oms::ComRef getSignalFilterFilename() const
Definition Snapshot.cpp:254
oms::Snapshot::getSSDFilename
oms::ComRef getSSDFilename() const
Definition Snapshot.cpp:244
oms::Snapshot::importPartialResourceNode
oms_status_enu_t importPartialResourceNode(const filesystem::path &filename, const filesystem::path &nodename, const pugi::xml_node &node)
Definition Snapshot.cpp:119
oms::Snapshot::doc
pugi::xml_document doc
Definition Snapshot.h:97
oms::Snapshot::exportPartialSnapshot
oms_status_enu_t exportPartialSnapshot(const ComRef &cref, Snapshot &partialSnapshot)
Definition Snapshot.cpp:275
oms::Snapshot::getTemplateResourceNodeSSM
pugi::xml_node getTemplateResourceNodeSSM(const filesystem::path &filename)
Definition Snapshot.cpp:215
oms::Snapshot::getTemplateResourceNodeSSV
pugi::xml_node getTemplateResourceNodeSSV(const filesystem::path &filename, const std::string &cref)
Definition Snapshot.cpp:202
oms::Snapshot::operator[]
pugi::xml_node operator[](const filesystem::path &filename)
Definition Snapshot.cpp:162
oms::Snapshot::newResourceNode
pugi::xml_node newResourceNode(const filesystem::path &filename)
Definition Snapshot.cpp:56
oms::Snapshot::writeDocument
oms_status_enu_t writeDocument(char **contents)
Definition Snapshot.cpp:416
oms::Snapshot::Snapshot
Snapshot(Snapshot const &copy)
not implemented
oms::Snapshot::getResources
void getResources(std::vector< std::string > &resources) const
Definition Snapshot.cpp:130
oms::Snapshot::~Snapshot
~Snapshot()
Definition Snapshot.cpp:52
oms::Snapshot::getRootCref
oms::ComRef getRootCref() const
Definition Snapshot.cpp:264
oms::Snapshot::writeResourceNode
oms_status_enu_t writeResourceNode(const filesystem::path &filename, const filesystem::path &path) const
Definition Snapshot.cpp:443
oms::Snapshot::importResourceNode
oms_status_enu_t importResourceNode(const filesystem::path &filename, const pugi::xml_node &node)
Definition Snapshot.cpp:109
oms::Snapshot::getTemplateResourceNodeSSD
pugi::xml_node getTemplateResourceNodeSSD(const filesystem::path &filename, const ComRef &cref)
Definition Snapshot.cpp:186
oms::Snapshot::getResourceNode
pugi::xml_node getResourceNode(const filesystem::path &filename) const
Definition Snapshot.cpp:137
oms::Snapshot::operator=
Snapshot & operator=(Snapshot const &copy)
not implemented
oms::Snapshot::importResourceFile
oms_status_enu_t importResourceFile(const filesystem::path &filename, const filesystem::path &root)
Definition Snapshot.cpp:87
oms::Snapshot::importResourceMemory
oms_status_enu_t importResourceMemory(const filesystem::path &filename, const char *contents)
Definition Snapshot.cpp:99
oms::Snapshot::isPartialSnapshot
bool isPartialSnapshot() const
Definition Snapshot.cpp:81
oms::Snapshot::getTemplateResourceNodeSignalFilter
pugi::xml_node getTemplateResourceNodeSignalFilter(const filesystem::path &filename)
Definition Snapshot.cpp:226
oms::Snapshot::importPartialSnapshot
oms_status_enu_t importPartialSnapshot(const char *fullsnapshot)
Definition Snapshot.cpp:336
oms::Snapshot::deleteResourceNode
oms_status_enu_t deleteResourceNode(const filesystem::path &filename)
Definition Snapshot.cpp:149
oms
Definition AlgLoop.h:49