| 1 |
/* |
| 2 |
* Advanced Simulation Library <http://asl.org.il> |
| 3 |
* |
| 4 |
* Copyright 2015 Avtech Scientific <http://avtechscientific.com> |
| 5 |
* |
| 6 |
* |
| 7 |
* This file is part of Advanced Simulation Library (ASL). |
| 8 |
* |
| 9 |
* ASL is free software: you can redistribute it and/or modify it |
| 10 |
* under the terms of the GNU Affero General Public License as |
| 11 |
* published by the Free Software Foundation, version 3 of the License. |
| 12 |
* |
| 13 |
* ASL is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Affero General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Affero General Public License |
| 19 |
* along with ASL. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
* |
| 21 |
*/ |
| 22 |
|
| 23 |
|
| 24 |
#ifndef ACLEXPRESSIONCONTAINER_H |
| 25 |
#define ACLEXPRESSIONCONTAINER_H |
| 26 |
|
| 27 |
#include <vector> |
| 28 |
#include <memory> |
| 29 |
//#include <CL/cl.hpp> |
| 30 |
// Supply "cl.hpp" with ASL, since it is not present in OpenCL 2.0 |
| 31 |
// Remove the file after switching to OpenCL 2.1 |
| 32 |
#include "acl/cl.hpp" |
| 33 |
|
| 34 |
|
| 35 |
namespace acl |
| 36 |
{ |
| 37 |
|
| 38 |
typedef std::shared_ptr<cl::CommandQueue> CommandQueue; |
| 39 |
|
| 40 |
class ElementBase; |
| 41 |
typedef std::shared_ptr<ElementBase> Element; |
| 42 |
|
| 43 |
class ExpressionContainer |
| 44 |
{ |
| 45 |
protected: |
| 46 |
unsigned int size; //< initialized with 0, is overidden by first addExpression() |
| 47 |
CommandQueue queue; |
| 48 |
bool regenerateKernelSource; |
| 49 |
public: |
| 50 |
std::vector<Element> expression; |
| 51 |
protected: |
| 52 |
std::vector<Element> arguments; |
| 53 |
std::vector<Element> localDeclarations; |
| 54 |
void filterDeclarations(); |
| 55 |
public: |
| 56 |
ExpressionContainer(); |
| 57 |
void addExpression(Element expression_); |
| 58 |
unsigned int getSize(); |
| 59 |
inline const CommandQueue getQueue () const; |
| 60 |
}; |
| 61 |
|
| 62 |
|
| 63 |
//------------------------------ Imlementation -------------------- |
| 64 |
|
| 65 |
inline const CommandQueue ExpressionContainer::getQueue () const |
| 66 |
{ |
| 67 |
return queue; |
| 68 |
} |
| 69 |
|
| 70 |
} // namespace acl |
| 71 |
|
| 72 |
#endif // ACLEXPRESSIONCONTAINER_H |