Computer Assisted Medical Intervention Tool Kit  version 5.2
 
Loading...
Searching...
No Matches
PersistenceManager.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6 *
7 * Visit http://camitk.imag.fr for more information
8 *
9 * This file is part of CamiTK.
10 *
11 * CamiTK is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * CamiTK is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * $CAMITK_LICENCE_END$
24 ****************************************************************************/
25
26#ifndef PERSISTENCE_MANAGER_H
27#define PERSISTENCE_MANAGER_H
28
29#include "Application.h"
31
32
33class QString;
34template<class T> class QList;
35class QVariant;
36class QObject;
37
38namespace camitk {
39
40class Component;
41class CamiTKFile;
42
44
45public:
46
52 static bool saveWorkspace(QString filepath);
53 static bool loadWorkspace(QString filepath);
54
83 static void updateVariantValueWhilePreservingType(QVariant& variant, QVariant& newValue, QString name = "");
84
85 static QVariant fromProperties(const QObject*);
86 static void loadProperties(QObject*, QVariant);
87
88protected:
89
98 static QVariant fromComponents(QList<Component*>, QDir rootPath);
99
103 static bool loadComponents(QVariant, QDir rootPath);
104
124 static QString variantToString(const QVariant& variant);
125
139 static QVariant stringToVariant(QString value);
140};
141
142} // namespace
143
144#endif //PERSISTENCE_MANAGER_H
145
A component is something that composed something and could also be a part of something.
Definition modeling/libraries/pml/Component.h:48
Definition PersistenceManager.h:34
Definition PersistenceManager.h:43
static bool loadComponents(QVariant, QDir rootPath)
Loads/Open the components from the QVariant and update the property values accordingly.
Definition PersistenceManager.cpp:197
static QVariant fromComponents(QList< Component * >, QDir rootPath)
Converts component's filename and properties to QVariant.
Definition PersistenceManager.cpp:178
static QVariant fromProperties(const QObject *)
Definition PersistenceManager.cpp:234
static QVariant stringToVariant(QString value)
returns a valid QVariant for specific types corresponding to a specific string representation
Definition PersistenceManager.cpp:420
static void updateVariantValueWhilePreservingType(QVariant &variant, QVariant &newValue, QString name="")
Update the variant value while trying to preserve its type.
Definition PersistenceManager.cpp:323
static bool saveWorkspace(QString filepath)
Save the whole Application workspace including components, settings (e.g.
Definition PersistenceManager.cpp:53
static bool loadWorkspace(QString filepath)
Definition PersistenceManager.cpp:115
static void loadProperties(QObject *, QVariant)
Definition PersistenceManager.cpp:287
static QString variantToString(const QVariant &variant)
returns a specific string representation of (limited list of) some specific QVariant types
Definition PersistenceManager.cpp:398
Definition Action.cpp:36