Shiokaze Framework
A research-oriented fluid solver for computer graphics
shared_array_core2.h
Go to the documentation of this file.
1 /*
2 ** shared_array2.h
3 **
4 ** This is part of Shiokaze, a research-oriented fluid solver for computer graphics.
5 ** Created by Ryoichi Ando <rand@nii.ac.jp> on March 15, 2018.
6 **
7 ** Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ** this software and associated documentation files (the "Software"), to deal in
9 ** the Software without restriction, including without limitation the rights to use,
10 ** copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11 ** Software, and to permit persons to whom the Software is furnished to do so,
12 ** subject to the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included in all copies
15 ** or substantial portions of the Software.
16 **
17 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 ** CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 //
25 #ifndef SHKZ_SHARED_ARRAY_CORE2_H
26 #define SHKZ_SHARED_ARRAY_CORE2_H
27 //
28 #include <shiokaze/math/shape.h>
29 #include <functional>
30 //
32 //
34 class shared_array_core2 {
37 public:
54  static void * borrow_shared( const shape2 &shape, size_t class_hash, std::string core_name, std::function<void *(const shape2 &shape, std::string core_name)> alloc_func, std::function<void( void *ptr )> dealloc_func );
61  static void return_shared( void *array );
66  static size_t clear();
71  static size_t get_total_grid_count();
72 };
73 //
75 //
76 #endif
77 //
shape.h
shared_array_core2
Abstract storage class that enables sharing pre-allocated arrays.
Definition: shared_array_core2.h:36
shared_array_core2::borrow_shared
static void * borrow_shared(const shape2 &shape, size_t class_hash, std::string core_name, std::function< void *(const shape2 &shape, std::string core_name)> alloc_func, std::function< void(void *ptr)> dealloc_func)
Borrow a shared array.
SHKZ_BEGIN_NAMESPACE
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
shared_array_core2::return_shared
static void return_shared(void *array)
Return a borrowed array.
shape2
Structure that defines shape such as width, height.
Definition: shape.h:42
SHKZ_END_NAMESPACE
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
shared_array_core2::clear
static size_t clear()
Clear grid storage.
shared_array_core2::get_total_grid_count
static size_t get_total_grid_count()
Get the number of current shared arrays.