certi-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-cvs] jcerti/src/hla/rti1516e/jlc BasicHLAinteger64LE...


From: CERTI CVS commits
Subject: [certi-cvs] jcerti/src/hla/rti1516e/jlc BasicHLAinteger64LE...
Date: Wed, 14 Dec 2011 00:28:53 +0000

CVSROOT:        /sources/certi
Module name:    jcerti
Changes by:     Eric NOULARD <erk>      11/12/14 00:28:53

Modified files:
        src/hla/rti1516e/jlc: BasicHLAinteger64LE.java 
                              BasicHLAinteger64BE.java 
                              BasicHLAfloat64LE.java 
                              BasicHLAfloat64BE.java 
Added files:
        src/hla/rti1516e/jlc: HLAASCIIstring.java HLAunicodeString.java 

Log message:
        Fix boundary in conformance with IEEE-1516-2010.2 document
        add HLAunicodeString type

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/BasicHLAinteger64LE.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/BasicHLAinteger64BE.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/BasicHLAfloat64LE.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/BasicHLAfloat64BE.java?cvsroot=certi&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/HLAASCIIstring.java?cvsroot=certi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/jcerti/src/hla/rti1516e/jlc/HLAunicodeString.java?cvsroot=certi&rev=1.1

Patches:
Index: BasicHLAinteger64LE.java
===================================================================
RCS file: /sources/certi/jcerti/src/hla/rti1516e/jlc/BasicHLAinteger64LE.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- BasicHLAinteger64LE.java    13 Dec 2011 23:53:33 -0000      1.2
+++ BasicHLAinteger64LE.java    14 Dec 2011 00:28:53 -0000      1.3
@@ -39,7 +39,7 @@
     
     @Override
     public int getOctetBoundary() {
-        return 4;
+        return 8;
     }
 
     @Override

Index: BasicHLAinteger64BE.java
===================================================================
RCS file: /sources/certi/jcerti/src/hla/rti1516e/jlc/BasicHLAinteger64BE.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- BasicHLAinteger64BE.java    13 Dec 2011 23:53:33 -0000      1.2
+++ BasicHLAinteger64BE.java    14 Dec 2011 00:28:53 -0000      1.3
@@ -39,7 +39,7 @@
     
     @Override
     public int getOctetBoundary() {
-        return 4;
+        return 8;
     }
 
     @Override

Index: BasicHLAfloat64LE.java
===================================================================
RCS file: /sources/certi/jcerti/src/hla/rti1516e/jlc/BasicHLAfloat64LE.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- BasicHLAfloat64LE.java      13 Dec 2011 23:53:34 -0000      1.2
+++ BasicHLAfloat64LE.java      14 Dec 2011 00:28:53 -0000      1.3
@@ -38,7 +38,7 @@
     
     @Override
     public int getOctetBoundary() {
-        return 4;
+        return 8;
     }
 
     @Override

Index: BasicHLAfloat64BE.java
===================================================================
RCS file: /sources/certi/jcerti/src/hla/rti1516e/jlc/BasicHLAfloat64BE.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- BasicHLAfloat64BE.java      13 Dec 2011 23:53:34 -0000      1.2
+++ BasicHLAfloat64BE.java      14 Dec 2011 00:28:53 -0000      1.3
@@ -38,7 +38,7 @@
     
     @Override
     public int getOctetBoundary() {
-        return 4;
+        return 8;
     }
 
     @Override

Index: HLAASCIIstring.java
===================================================================
RCS file: HLAASCIIstring.java
diff -N HLAASCIIstring.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ HLAASCIIstring.java 14 Dec 2011 00:28:53 -0000      1.1
@@ -0,0 +1,75 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2011 Eric Noulard
+//
+// This program is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// ----------------------------------------------------------------------------
+package hla.rti1516e.jlc;
+
+import hla.rti1516e.encoding.ByteWrapper;
+import hla.rti1516e.encoding.DecoderException;
+import hla.rti1516e.encoding.EncoderException;
+
+public class HLAASCIIstring extends DataElementBase implements
+        hla.rti1516e.encoding.HLAASCIIstring {
+
+    public HLAASCIIstring() {
+        // TODO Auto-generated constructor stub
+    }
+
+    @Override
+    public int getOctetBoundary() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public void encode(ByteWrapper byteWrapper) throws EncoderException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public int getEncodedLength() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public void decode(ByteWrapper byteWrapper) throws DecoderException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public void decode(byte[] bytes) throws DecoderException {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public String getValue() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setValue(String value) {
+        // TODO Auto-generated method stub
+
+    }
+
+}

Index: HLAunicodeString.java
===================================================================
RCS file: HLAunicodeString.java
diff -N HLAunicodeString.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ HLAunicodeString.java       14 Dec 2011 00:28:53 -0000      1.1
@@ -0,0 +1,92 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2011 Eric Noulard
+//
+// This program is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// ----------------------------------------------------------------------------
+package hla.rti1516e.jlc;
+
+import hla.rti1516e.encoding.ByteWrapper;
+import hla.rti1516e.encoding.DecoderException;
+import hla.rti1516e.encoding.EncoderException;
+
+public class HLAunicodeString extends DataElementBase implements
+        hla.rti1516e.encoding.HLAunicodeString {
+
+    private String value;
+    
+    public HLAunicodeString() {
+        value = "";
+    }
+
+    public HLAunicodeString(String s) {
+        value = (null!=s ? s : "");
+    }
+    
+    @Override
+    public int getOctetBoundary() {
+        return 4;
+    }
+
+    @Override
+    public void encode(ByteWrapper byteWrapper) throws EncoderException {
+       byteWrapper.align(getOctetBoundary());
+       int ls = value.length();
+       // put size of the string first
+       byteWrapper.putInt(ls);
+       int c;
+       for (int i=0; i<ls; ++i) {
+           c = (int) value.charAt(i);
+           byteWrapper.put((c >>> 8) & 0xFF);
+           byteWrapper.put((c >>> 0) & 0xFF);
+       }
+    }
+
+    @Override
+    public int getEncodedLength() {
+        return 4+2*value.length();
+    }
+
+    @Override
+    public void decode(ByteWrapper byteWrapper) throws DecoderException {
+        byteWrapper.align(getOctetBoundary());
+        int ls = byteWrapper.getInt();
+        char[] s = new char[ls];
+        int upper;
+        int lower;
+        for (int i=0;i<ls;++i) {
+            upper = byteWrapper.get();
+            lower = byteWrapper.get();
+            s[i] = (char)((upper << 8) + (lower << 0));
+        }
+    }
+
+    @Override
+    public void decode(byte[] bytes) throws DecoderException {
+        throw new DecoderException("Not Implemented");
+    }
+
+    @Override
+    public String getValue() {
+        return value;
+    }
+
+    @Override
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]