24 #ifndef ACLPRIVATEARRAY_H
25 #define ACLPRIVATEARRAY_H
27 #include "../aclElementBase.h"
28 #include "../../aslUtilities.h"
29 #include "../aclUtilities.h"
42 template <
typename T>
class PrivateArray:
public ElementBase
46 static const string prefix;
47 static unsigned int id;
50 explicit PrivateArray(
const vector<T> & initVector_);
51 virtual string str(
const KernelConfiguration & kernelConfig)
const;
52 virtual string getName()
const;
53 virtual string getAddressSpaceQualifier()
const;
54 virtual string getTypeSignature(
const KernelConfiguration & kernelConfig)
const;
55 virtual string getLocalDeclaration(
const KernelConfiguration & kernelConfig)
const;
56 virtual void addToKernelSource(vector<Element> & arguments,
57 vector<Element> & localDeclarations)
const;
58 virtual void setAsArgument(
cl::Kernel & kernel,
unsigned int argumentIndex)
const;
62 template <
typename T> PrivateArray<T>::PrivateArray(
const vector<T> & initVector_):
63 ElementBase(true, initVector_.size(),
typeToTypeID<T>()),
64 initVector(initVector_)
71 template <
typename T>
string PrivateArray<T>::str(
const KernelConfiguration & kernelConfig)
const
73 if (kernelConfig.vectorWidth > 1)
75 errorMessage(
"PrivateArray should not be used in a SIMD Kernel");
79 return name +
"[" +
INDEX +
"]";
103 string s = typeToStr<T>() +
" " + name +
"[" +
asl::numToStr(size) +
"] = {";
105 for (
unsigned int i = 0; i < size; ++i)
106 s +=
numToStr(initVector[i]) +
", ";
109 s.erase(s.size() - 2);
117 vector<Element> & localDeclarations)
const
124 unsigned int argumentIndex)
const
131 #endif // ACLPRIVATEARRAY_H