/[libvob]/libvob/include/vob/jni/Generate.hxx
ViewVC logotype

Diff of /libvob/include/vob/jni/Generate.hxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by tjl, Mon Mar 10 11:15:13 2003 UTC revision 1.13 by tjl, Mon Mar 10 14:26:18 2003 UTC
# Line 175  namespace JNI { Line 175  namespace JNI {
175    
176      template<class Primitive> struct TransJNIGenerator {      template<class Primitive> struct TransJNIGenerator {
177          int ind;          int ind;
178          Primitive typer;          Primitives::HierarchicalTransform<Primitive> hier;
   
         int nParents(Primitives::DependentPrimitiveTransform &t) {  
             return Primitive::NDepends;  
         }  
         template<class T> int nParents(T &t) { return 1; }  
   
         int nParams(Primitives::ParametrizedPrimitiveTransform &t) {  
             return Primitive::NParams;  
         }  
         template<class T> int nParams(T &t) { return 0; }  
179    
180          TransJNIGenerator(std::string className, std::string methodName) {          TransJNIGenerator(std::string className, std::string methodName) {
181              ind = index++;              ind = index++;
182              VOB_TRANSJAVASTREAM << "public int "<<methodName              VOB_TRANSJAVASTREAM << "public int "<<methodName
183                          <<"(int d0 ";                          <<"(int d0 ";
184              for(int i=1; i<nParents(typer); i++) {              for(int i=1; i<hier.getNDepends(); i++) {
185                  VOB_TRANSJAVASTREAM << ", int d"<<i<<" ";                  VOB_TRANSJAVASTREAM << ", int d"<<i<<" ";
186              }              }
187              for(int i=0; i<nParams(typer); i++) {              for(int i=0; i<hier.getNParams(); i++) {
188                  VOB_TRANSJAVASTREAM << ", float p"<<i<<" ";                  VOB_TRANSJAVASTREAM << ", float p"<<i<<" ";
189              }              }
190              std::string passignCode = "";              std::ostringstream  passignCode;
191              for(int i=0; i<nParams(typer); i++) {              for(int i=0; i<hier.getNParams(); i++) {
192                  passignCode += "floats[i+";                  passignCode << "floats[i+"<<i
193                            <<"] = p"<<i<<";\n";
194              }              }
195              VOB_TRANSJAVASTREAM << ") {\n"              VOB_TRANSJAVASTREAM << ") {\n"
196                      "int i = nfloats;";                      "int i = nfloats; \n" <<
197                        "nfloats +="<<hier.getNParams()<<";\n";
198    
199                VOB_TRANSJAVASTREAM << passignCode.str();
200    
201                VOB_TRANSJAVASTREAM <<
202                        "int j = ninds; ninds += "<<
203                            (hier.getNDepends()+2)
204                            <<"; inds[j+0] = "<<ind<<";\n";
205    
206                for(int i=0; i<hier.getNDepends(); i++) {
207                    VOB_TRANSJAVASTREAM <<
208                        "inds[j+"<<(i+1)<<"] = d"<<i<<";\n";
209                }
210                VOB_TRANSJAVASTREAM <<
211                        "inds[j+"<<(hier.getNDepends()+1)<<
212                            "] = i;\n return j;";
213    
214                VOB_TRANSJAVASTREAM << "}\n";
215    
216              VOB_TRANSCSTREAM << " case "<<ind<<": \n"              VOB_TRANSCSTREAM << " case "<<ind<<": \n"
217                      << "\t\tTRANSTYPE("<<className<<");break;\n";                      << "\t\tTRANSTYPE("<<className<<");break;\n";

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26