175 |
|
|
176 |
template<class Primitive> struct TransJNIGenerator { |
template<class Primitive> struct TransJNIGenerator { |
177 |
int ind; |
int ind; |
178 |
|
Primitive typer; |
179 |
|
|
180 |
|
int nParents(Primitives::DependentPrimitiveTransform &t) { |
181 |
|
return Primitive::NDepends; |
182 |
|
} |
183 |
|
template<class T> int nParents(T &t) { return 1; } |
184 |
|
|
185 |
|
int nParams(Primitives::ParametrizedPrimitiveTransform &t) { |
186 |
|
return Primitive::NParams; |
187 |
|
} |
188 |
|
template<class T> int nParams(T &t) { return 0; } |
189 |
|
|
190 |
TransJNIGenerator(std::string className, std::string methodName) { |
TransJNIGenerator(std::string className, std::string methodName) { |
191 |
ind = index++; |
ind = index++; |
192 |
VOB_TRANSJAVASTREAM << "public int "<<methodName |
VOB_TRANSJAVASTREAM << "public int "<<methodName |
193 |
<<"(int d0 "; |
<<"(int d0 "; |
194 |
for(int i=1; i<nParents(Primitive()); i++) { |
for(int i=1; i<nParents(typer); i++) { |
195 |
VOB_TRANSJAVASTREAM << ", int d"<<i<<" "; |
VOB_TRANSJAVASTREAM << ", int d"<<i<<" "; |
196 |
} |
} |
197 |
for(int i=0; i<nParams(Primitive()); i++) { |
for(int i=0; i<nParams(typer); i++) { |
198 |
VOB_TRANSJAVASTREAM << ", float p"<<i<<" "; |
VOB_TRANSJAVASTREAM << ", float p"<<i<<" "; |
199 |
} |
} |
200 |
std::string passignCode = ""; |
std::string passignCode = ""; |
201 |
for(int i=0; i<nParams(Primitive()); i++) { |
for(int i=0; i<nParams(typer); i++) { |
202 |
passignCode += "floats[i+"; |
passignCode += "floats[i+"; |
203 |
} |
} |
204 |
VOB_TRANSJAVASTREAM << ") {\n" |
VOB_TRANSJAVASTREAM << ") {\n" |
205 |
"int i = nfloats;"; |
"int i = nfloats;"; |
|
} |
|
206 |
|
|
207 |
int nParents(Primitives::DependentPrimitiveTransform &t) { |
VOB_TRANSCSTREAM << " case "<<ind<<": \n" |
208 |
return Primitive::NDepends; |
<< "\t\tTRANSTYPE("<<className<<");break;\n"; |
|
} |
|
|
template<class T> int nParents(T &t) { return 1; } |
|
209 |
|
|
|
int nParams(Primitives::ParametrizedPrimitiveTransform &t) { |
|
|
return Primitive::NParams; |
|
210 |
} |
} |
|
template<class T> int nParams(T &t) { return 0; } |
|
|
|
|
211 |
}; |
}; |
212 |
|
|
213 |
} |
} |