Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set values for a fixed size array #51

Closed
ivangfr opened this issue Mar 20, 2015 · 1 comment
Closed

Set values for a fixed size array #51

ivangfr opened this issue Mar 20, 2015 · 1 comment
Labels

Comments

@ivangfr
Copy link

ivangfr commented Mar 20, 2015

Hi,

I have a C struct like:

typedef struct type_MyStruct {
    int iMeasure;
    int position[3];
} MyStruct;

When I generate the java class I get something like:

public class MyStruct extends StructObject {
    ...

    @Field(0)
    public int iMeasure() {
        ...
    }

    @Field(0)
    public MyStruct iMeasure(int iMeasure) {
        ...
    }

    @Array({3}) 
    @Field(1) 
    public Pointer<Integer> position() {
        ...
    }

    ...
}

As you can see I don't have a method set for position like:

    @Field(1) 
    public MyStruct position(Pointer<Integer> position) {
        ...
    }

So, how can I set values for this array of 3 positions? For example:

MyStruct myStruct = new MyStruct();
myStruct.iMeasure(10);

???
myStruct.position()

Thanks

@ochafik
Copy link
Member

ochafik commented Mar 21, 2015

Hi @ivangfr,

Thanks for using BridJ!
You can set items of position with myStruct.position().set(index, value).

Cheers

@ochafik ochafik closed this as completed Mar 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants