ARTS 2.5.9 (git: 825fa5f2)
workspace_memory_handler.h
Go to the documentation of this file.
1/* Copyright (C) 2020 Simon Pfreundschuh <simon.pfreundschuh@chalmers.se>
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License as
5 published by the Free Software Foundation; either version 2 of the
6 License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
16 USA. */
17
24#ifndef __ARTS_WORKSPACE_MEMORY_HANDLER__
25#define __ARTS_WORKSPACE_MEMORY_HANDLER__
26#include "arts.h"
27#include <memory>
28#include <vector>
29
38 public:
40
45 std::shared_ptr<void> allocate(Index group_index) { return allocation_ptrs_[group_index](); }
46
52 std::shared_ptr<void> duplicate(Index group_index, const std::shared_ptr<void>& ptr) {
53 return duplication_ptrs_[group_index](ptr);
54 }
55
56 void initialize();
57
58 private:
59 std::vector<std::shared_ptr<void> (*)()> allocation_ptrs_;
60 std::vector<std::shared_ptr<void> (*)(const std::shared_ptr<void>&)> duplication_ptrs_;
61};
62#endif
The global header file for ARTS.
Handling of workspace memory.
std::shared_ptr< void > allocate(Index group_index)
Allocate workspace WSV of given group.
void initialize()
Initialization dispatch functions.
std::shared_ptr< void > duplicate(Index group_index, const std::shared_ptr< void > &ptr)
Duplicate workspace variable of given group.
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39