Skip to content

Commit

Permalink
size as method
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jul 23, 2023
1 parent e03a61a commit e185ca2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void copy(boolean [] array) {

public native void setValue(int index, boolean value);
public native void resize(int size);
public native int getSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void copy(char [] array) {

public native void setValue(int index, char value);
public native void resize(int size);
public native int getSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void copy(double [] array) {

public native void setValue(int index, double value);
public native void resize(int size);
public native int getSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void copy(float [] array) {

public native void setValue(int index, float value);
public native void resize(int size);
public native int getSize();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ public void copy(int[] array) {

public native void setValue(int index, int value);
public native void resize(int size);
public native int getSize();
}
25 changes: 15 additions & 10 deletions jParser/base/src/main/resources/IDLHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#endif

class BoolArray {
public:
private:
bool * data;
int size;

public:
BoolArray(int size) { data = NULL; resize(size); }
~BoolArray() { if(data != NULL) { deleteData(); } }
void resize(int newSize) {
Expand All @@ -31,13 +31,14 @@ class BoolArray {
bool getValue(int index) { return data[index]; }
void setValue(int index, bool value) { data[index] = value; }
void* getPointer() { return (void*)data; }
int getSize() { return size; }
};

class IntArray {
public:
private:
int * data;
int size;

public:
IntArray(int size) { data = NULL; resize(size); }
~IntArray() { if(data != NULL) { deleteData(); } }
void resize(int newSize) {
Expand All @@ -58,13 +59,14 @@ class IntArray {
int getValue(int index) { return data[index]; }
void setValue(int index, int value) { data[index] = value; }
void* getPointer() { return (void*)data; }
int getSize() { return size; }
};

class FloatArray {
public:
private:
float * data;
int size;

public:
FloatArray(int size) { data = NULL; resize(size); }
~FloatArray() { if(data != NULL) { deleteData(); } }
void resize(int newSize) {
Expand All @@ -85,13 +87,14 @@ class FloatArray {
float getValue(int index) { return data[index]; }
void setValue(int index, float value) { data[index] = value; }
void* getPointer() { return (void*)data; }
int getSize() { return size; }
};

class DoubleArray {
public:
private:
double * data;
int size;

public:
DoubleArray(int size) { data = NULL; resize(size); }
~DoubleArray() { if(data != NULL) { deleteData(); } }
void resize(int newSize) {
Expand All @@ -112,13 +115,14 @@ class DoubleArray {
double getValue(int index) { return data[index]; }
void setValue(int index, double value) { data[index] = value; }
void* getPointer() { return (void*)data; }
int getSize() { return size; }
};

class CharArray {
public:
private:
char * data;
int size;

public:
CharArray(int size) { data = NULL; resize(size); }
~CharArray() { if(data != NULL) { deleteData(); } }
void resize(int newSize) {
Expand All @@ -139,4 +143,5 @@ class CharArray {
char getValue(int index) { return data[index]; }
void setValue(int index, char value) { data[index] = value; }
void* getPointer() { return (void*)data; }
int getSize() { return size; }
};
15 changes: 5 additions & 10 deletions jParser/base/src/main/resources/IDLHelper.idl
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
interface BoolArray {
attribute long size;

void BoolArray(long size);
void resize(long size);
boolean getValue(long index);
void setValue(long index, boolean value);
any getPointer();
long getSize();
};

interface IntArray {
attribute long size;

void IntArray(long size);
void resize(long size);
long getValue(long index);
void setValue(long index, long value);
any getPointer();
long getSize();
};

interface FloatArray {
attribute long size;

void FloatArray(long size);
void resize(long size);
float getValue(long index);
void setValue(long index, float value);
any getPointer();
long getSize();
};

interface DoubleArray {
attribute long size;

void DoubleArray(long size);
void resize(long size);
double getValue(long index);
void setValue(long index, double value);
any getPointer();
long getSize();
};

interface CharArray {
attribute long size;

void CharArray(long size);
void resize(long size);
byte getValue(long index);
void setValue(long index, byte value);
any getPointer();
long getSize();
};
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public CppCodeParserV2(String classpath, String jniDir) {
public CppCodeParserV2(IDLReader idlReader, String classpath, String jniDir) {
super(HEADER_CMD, idlReader);
cppGenerator = new NativeCPPGenerator(classpath, jniDir);
enableAttributeParsing = false;
}

public CppCodeParserV2(CppGenerator cppGenerator) {
Expand All @@ -138,7 +137,6 @@ public CppCodeParserV2(CppGenerator cppGenerator, IDLReader idlReader) {
public CppCodeParserV2(CppGenerator cppGenerator, IDLReader idlReader, String basePackage) {
super(basePackage, HEADER_CMD, idlReader);
this.cppGenerator = cppGenerator;
enableAttributeParsing = false;
}

@Override
Expand Down

0 comments on commit e185ca2

Please sign in to comment.