ARTS  2.3.1285(git:92a29ea9-dirty)
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 <vector>
28 
37  public:
39 
44  void *allocate(Index group_index) { return allocation_ptrs_[group_index](); }
45 
53  void deallocate(Index group_index, void *ptr) {
54  deallocation_ptrs_[group_index](ptr);
55  }
56 
62  void *duplicate(Index group_index, void *ptr) {
63  return duplication_ptrs_[group_index](ptr);
64  }
65 
66  void initialize();
67 
68  private:
69  std::vector<void *(*)()> allocation_ptrs_;
70  std::vector<void (*)(void *)> deallocation_ptrs_;
71  std::vector<void *(*)(void *)> duplication_ptrs_;
72 };
73 #endif
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
void initialize()
Initialization dispatch functions.
std::vector< void *(*)()> allocation_ptrs_
void * duplicate(Index group_index, void *ptr)
Duplicate workspace variable of given group.
The global header file for ARTS.
std::vector< void *(*)(void *)> duplication_ptrs_
void * allocate(Index group_index)
Allocate workspace WSV of given group.
void deallocate(Index group_index, void *ptr)
Getaway function to call the deallocation function for the WSV group with the given Index...
Handling of workspace memory.
std::vector< void(*)(void *)> deallocation_ptrs_