MulticoreBSP for C  Version 1.2
mcbsp.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 by Albert-Jan N. Yzelman
3  *
4  * This file is part of MulticoreBSP in C --
5  * a port of the original Java-based MulticoreBSP.
6  *
7  * MulticoreBSP for C is distributed as part of the original
8  * MulticoreBSP and is free software: you can redistribute
9  * it and/or modify it under the terms of the GNU Lesser
10  * General Public License as published by the Free Software
11  * Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  * MulticoreBSP is distributed in the hope that it will be
14  * useful, but WITHOUT ANY WARRANTY; without even the
15  * implied warranty of MERCHANTABILITY or FITNESS FOR A
16  * PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General
20  * Public License along with MulticoreBSP. If not, see
21  * <http://www.gnu.org/licenses/>.
22  */
23 
37 #ifndef _HPP_MCBSP
38 #define _HPP_MCBSP
39 
40 extern "C" {
41  #include "mcbsp.h"
42 }
43 
44 #ifndef SIZE_MAX
45 
49  #define SIZE_MAX ((size_t)-1)
50 #endif
51 
56 namespace mcbsp {
57 
83  class BSP_program {
84 
85  private:
86 
88  size_t P;
89 
90  protected:
91 
97 
99  virtual void spmd() = 0;
100 
118  virtual BSP_program * newInstance() = 0;
119 
139  virtual void destroyInstance( BSP_program * const instance );
140 
141  public:
142 
158  void begin( const MCBSP_PROCESSOR_INDEX_DATATYPE P = bsp_nprocs() );
159 
161  virtual ~BSP_program();
162  };
163 
164 }
165 
166 #endif
167