Minsky
saver.h
Go to the documentation of this file.
1
/*
2
@copyright Steve Keen 2021
3
@author Russell Standish
4
This file is part of Minsky.
5
6
Minsky is free software: you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
Minsky is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with Minsky. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef SAVER_H
21
#define SAVER_H
22
#include <xml_pack_base.h>
23
#include <fstream>
24
#include <string>
25
#include <thread>
26
27
namespace
schema3
28
{
29
class
Minsky;
30
}
31
32
namespace
minsky
33
{
34
extern
const
char
*
schemaURL
;
35
36
struct
Saver
37
{
38
std::string
fileName
;
39
std::ofstream
os
;
40
classdesc::xml_pack_t
packer
;
41
Saver
(
const
std::string&
fileName
);
42
void
save
(
const
schema3::Minsky
&);
43
};
44
45
struct
BackgroundSaver
:
public
Saver
,
public
std::thread
46
{
47
std::thread
thread
;
48
std::string
lastError
;
49
BackgroundSaver
(
const
std::string&
fileName
):
Saver
(
fileName
) {}
50
~BackgroundSaver
() {
killThread
();}
51
void
save
(
const
schema3::Minsky
&);
52
void
killThread
();
53
};
54
}
55
56
#endif
minsky::Saver
Definition:
saver.h:36
minsky::BackgroundSaver::killThread
void killThread()
Definition:
saver.cc:59
minsky::Saver::os
std::ofstream os
Definition:
saver.h:39
minsky::BackgroundSaver::BackgroundSaver
BackgroundSaver(const std::string &fileName)
Definition:
saver.h:49
minsky::BackgroundSaver::thread
std::thread thread
Definition:
saver.h:47
schema3
Definition:
publication.h:24
minsky::Saver::save
void save(const schema3::Minsky &)
Definition:
saver.cc:40
minsky
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
Definition:
constMap.h:22
minsky::Saver::fileName
std::string fileName
Definition:
saver.h:38
minsky::BackgroundSaver
Definition:
saver.h:45
minsky::schemaURL
const char * schemaURL
Definition:
saver.cc:26
minsky::Saver::Saver
Saver(const std::string &fileName)
Definition:
saver.cc:28
minsky::BackgroundSaver::~BackgroundSaver
~BackgroundSaver()
Definition:
saver.h:50
minsky::BackgroundSaver::lastError
std::string lastError
Definition:
saver.h:48
schema3::Minsky
Definition:
schema3.h:242
minsky::Saver::packer
classdesc::xml_pack_t packer
Definition:
saver.h:40
minsky::BackgroundSaver::save
void save(const schema3::Minsky &)
Definition:
saver.cc:68
engine
saver.h
Generated on Tue Mar 18 2025 13:00:34 for Minsky by
1.8.14