World Ocean Simulation System (WOSS) library
woss-db-creator.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 2025 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - WOSS@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
23
34#ifndef WOSS_DB_CREATOR_H
35#define WOSS_DB_CREATOR_H
36
37
38#include <string>
39#include <memory>
40#include "woss-db.h"
41
42namespace woss {
43
56
57 public:
58
62 WossDbCreator() = default;
63
64 WossDbCreator(const WossDbCreator& copy) = default;
65
66 WossDbCreator(WossDbCreator&& tmp) = default;
67
68 virtual ~WossDbCreator() = default;
69
70 WossDbCreator& operator=( const WossDbCreator& copy ) = default;
71
72 //WossDbCreator& operator=( WossDbCreator&& tmp ) = default;
73
79 virtual std::unique_ptr<WossDb> createWossDb() const = 0;
80
88 virtual std::unique_ptr<WossDbCreator> clone() const = 0;
89
90
91 WossDbCreator& setDebug( bool flag ) { debug = flag; return *this; }
92
93 WossDbCreator& setWossDebug( bool flag ) { woss_db_debug = flag; return *this; }
94
95
96 WossDbCreator& setDbPathName( const std::string& name ) { pathname = name; return *this; }
97
98
99 bool isUsingDebug() const { return debug; }
100
101 bool isUsingWossDbDebug() const { return woss_db_debug; }
102
103 std::string getDbPathName() const { return pathname; }
104
105
106 protected:
107
111 bool debug = false;
112
116 bool woss_db_debug = false;
117
121 std::string pathname = "";
122
128 virtual bool initializeDb( WossDb& woss_db ) const = 0;
129
130 };
131
132
133}
134
135
136#endif /* WOSS_DB_CREATOR_H */
137
138
Abstract class that provides the interface of database creator ( Factory object )
Definition woss-db-creator.h:55
std::string getDbPathName() const
Definition woss-db-creator.h:103
virtual std::unique_ptr< WossDbCreator > clone() const =0
virtual std::unique_ptr< WossDb > createWossDb() const =0
bool woss_db_debug
Definition woss-db-creator.h:116
virtual ~WossDbCreator()=default
WossDbCreator()=default
WossDbCreator & setDbPathName(const std::string &name)
Definition woss-db-creator.h:96
bool isUsingDebug() const
Definition woss-db-creator.h:99
WossDbCreator & setWossDebug(bool flag)
Definition woss-db-creator.h:93
virtual bool initializeDb(WossDb &woss_db) const =0
Definition woss-db-creator.cpp:40
WossDbCreator & setDebug(bool flag)
Definition woss-db-creator.h:91
std::string pathname
Definition woss-db-creator.h:121
WossDbCreator & operator=(const WossDbCreator &copy)=default
WossDbCreator(const WossDbCreator &copy)=default
WossDbCreator(WossDbCreator &&tmp)=default
bool debug
Definition woss-db-creator.h:111
bool isUsingWossDbDebug() const
Definition woss-db-creator.h:101
Abstract class that provides the interface of databases.
Definition woss-db.h:79
Definition ac-toolbox-arr-asc-reader.h:44
Provides the interface for woss::WossDb class.