001 package org.bridj;
002
003 import org.bridj.ann.Constructor;
004
005 /**
006 * Base class for C structs.
007 * @author Olivier
008 */
009 @org.bridj.ann.Runtime(CRuntime.class)
010 public abstract class StructObject extends NativeObject {
011 protected StructIO io;
012
013 protected StructObject() {
014 super();
015 }
016 /**
017 * Identified constructor with an arbirary number of arguments
018 * @param voidArg always null, here to disambiguate some sub-constructors
019 * @param constructorId identifier of the constructor, has to match a {@link Constructor} annotation or be -1.
020 * @param args
021 */
022 protected StructObject(Void voidArg, int constructorId, Object... args) {
023 super(constructorId, args);
024 }
025 protected StructObject(Pointer<? extends StructObject> peer) {
026 super(peer);
027 }
028
029 /**
030 * Creates a String out of this struct using BridJ.describe(this) (see {@link BridJ#describe(NativeObject) }).
031 */
032 @Override
033 public String toString() {
034 return BridJ.describe(this);
035 }
036 }