
package org.vishia.byteData.test ;

import org.vishia.byteData.*;

public class Mystruct_h
{



  public static class MyStruct2 extends ByteDataAccess
  {
    

    /**Index of the data element*/
    public static final int
      kIdxm = 0
      , kIdxn = 0 + 4
      , kIdxAfterLast = 0 + 4 + 4;
    ; /*xsl: all Data from struct in headerfile converted to position indices */

    
    
    

    
    /** Constructs the data management class*/
    public MyStruct2()
    { 
    }

    /** Constructs as a child inside another ByteDataAccess*/
    public MyStruct2(ByteDataAccess parent, int idxChildInParent)
    { try{ assignAtIndex(idxChildInParent, parent); }
      catch(IllegalArgumentException exc)
      { //it won't be have any exception because specifyLengthElement() inside this class is the only source for it.
      }
    }
    



    public int specifyLengthElementHead()
    { return kIdxAfterLast;  //NOTE all are head bytes, no dynamic!
    }

    protected void specifyEmptyDefaultData()
    {
      for(int ii=idxBegin; ii < idxEnd; ii++)
      { super.data[ii] = 0;
      }
    }

    protected int specifyLengthElement() throws IllegalArgumentException
    {
      return kIdxAfterLast;
    }

        
	    public void set_m(int val)
	    { //type of struct-attribut is int
	      setInt32(kIdxm, val);
	    }
	      
      public int get_m()
      { //type of struct-attribut is int
        return getInt32(kIdxm);
      }
        
	    public void set_n(int val)
	    { //type of struct-attribut is int
	      setInt32(kIdxn, val);
	    }
	      
      public int get_n()
      { //type of struct-attribut is int
        return getInt32(kIdxn);
      }
        
      /**Because the method has fix childs, the assignDataToFixChilds method is overridden to apply to all fix childs. */
      @Override protected void assignDataToFixChilds() throws IllegalArgumentException
      {
      
      }

      /**Because the method has fix childs, the setBigEndian method is overridden to apply the endian to all fix childs. */
      @Override public void setBigEndian(boolean val)
      { super.setBigEndian(val);
      
      }
      
  }




  public static class MyStruct extends ByteDataAccess
  {
    
    protected static final int kSizex = 10;
    
    protected static final int kSizey = 10;
    

    /**Index of the data element*/
    public static final int
      kIdxa = 0
      , kIdxb = 0 + 4
      , kIdxc = 0 + 4 + 2
      , kIdxx = 0 + 4 + 2 + 2
      , kIdxy = 0 + 4 + 2 + 2 + 2 * 10
      , kIdxf = 0 + 4 + 2 + 2 + 2 * 10 + 2 * 10
      , kIdxembeddedStruct = 0 + 4 + 2 + 2 + 2 * 10 + 2 * 10 + 4
      , kIdxAfterLast = 0 + 4 + 2 + 2 + 2 * 10 + 2 * 10 + 4 + MyStruct2.kIdxAfterLast;
    ; /*xsl: all Data from struct in headerfile converted to position indices */

    
    
    

    
    /** Constructs the data management class*/
    public MyStruct()
    { 
    }

    /** Constructs as a child inside another ByteDataAccess*/
    public MyStruct(ByteDataAccess parent, int idxChildInParent)
    { try{ assignAtIndex(idxChildInParent, parent); }
      catch(IllegalArgumentException exc)
      { //it won't be have any exception because specifyLengthElement() inside this class is the only source for it.
      }
    }
    



    public int specifyLengthElementHead()
    { return kIdxAfterLast;  //NOTE all are head bytes, no dynamic!
    }

    protected void specifyEmptyDefaultData()
    {
      for(int ii=idxBegin; ii < idxEnd; ii++)
      { super.data[ii] = 0;
      }
    }

    protected int specifyLengthElement() throws IllegalArgumentException
    {
      return kIdxAfterLast;
    }

        
	    public void set_a(int val)
	    { //type of struct-attribut is int32
	      setInt32(kIdxa, val);
	    }
	      
      public int get_a()
      { //type of struct-attribut is int32
        return getInt32(kIdxa);
      }
        
	    public void set_b(short val)
	    { //type of struct-attribut is int16
	      setInt16(kIdxb, val);
	    }
	      
      public short get_b()
      { //type of struct-attribut is int16
        return (short)getInt16(kIdxb);
      }
        
	    public void set_c(short val)
	    { //type of struct-attribut is int16
	      setInt16(kIdxc, val);
	    }
	      
      public short get_c()
      { //type of struct-attribut is int16
        return (short)getInt16(kIdxc);
      }
        
	    public void set_x(short val, int idx)
	    { //type of struct-attribut is int16
	      setInt16(kIdxx, idx, 10, val);
	    }
	      
      public short get_x(int idx)
      { //type of struct-attribut is int16
        return (short)getInt16(kIdxx, idx, 10);
      }
        
      public final static int size_x = 10;
          
	    public void set_y(short val, int idx)
	    { //type of struct-attribut is int16
	      setInt16(kIdxy, idx, 10, val);
	    }
	      
      public short get_y(int idx)
      { //type of struct-attribut is int16
        return (short)getInt16(kIdxy, idx, 10);
      }
        
      public final static int size_y = 10;
          
	    public void set_f(float val)
	    { //type of struct-attribut is float
	      setFloat(kIdxf, val);
	    }
	      
      public float get_f()
      { //type of struct-attribut is float
        return getFloat(kIdxf);
      }
        
    public final MyStruct2 embeddedStruct = new MyStruct2(); //(this, kIdxembeddedStruct);  //embedded structure
        
	      //note: method to set embeddedStruct, not able to generate.
	        
      //note: method to set embeddedStruct, not able to generate.
        
      /**Because the method has fix childs, the assignDataToFixChilds method is overridden to apply to all fix childs. */
      @Override protected void assignDataToFixChilds() throws IllegalArgumentException
      {
      
        //NOTE: use super.data etc to prevent false using of a local element data. super is ByteDataAccess.    
        embeddedStruct.assignData(super.data, super.idxEnd, super.idxBegin + kIdxembeddedStruct);  //embedded structure
        embeddedStruct.setBigEndian(super.bBigEndian);
      }

      /**Because the method has fix childs, the setBigEndian method is overridden to apply the endian to all fix childs. */
      @Override public void setBigEndian(boolean val)
      { super.setBigEndian(val);
      
        embeddedStruct.setBigEndian(val);  //embedded structure
          
      }
      
  }


}
