Changeset 178:b0f779e48a4e in finroc_plugins_data_types-java


Ignore:
Timestamp:
07.04.2020 11:14:54 (2 months ago)
Author:
Max Reichardt <max.reichardt@…>
Branch:
default
Phase:
public
Tags:
tip
Message:

Extends angle type adapter for list types of angles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • AngleTypeAdapter.java

    r164 r178  
    5959            return true; 
    6060        } 
     61        if (remoteType.getName().startsWith("List<") && remoteType.getName().endsWith(">")) { 
     62            String elementTypeName = remoteType.getName().substring(5,  remoteType.getName().length() - 1); 
     63            if (elementTypeName.startsWith("rrlib.math.Angle")) { 
     64                if (!elementTypeName.contains("<")) { 
     65                    adapterInfo.localType = Angle.TYPE.getListType(); 
     66                    adapterInfo.networkEncoding = Serialization.DataEncoding.BINARY; 
     67                    return true; 
     68                } 
     69            } 
     70        } 
    6171        return false; 
    6272    } 
     
    6474    @Override 
    6575    public void deserialize(BinaryInputStream stream, GenericObject object, RemoteType type, Info adapterInfo) throws Exception { 
     76        if (object.getType() == Angle.TYPE.getListType()) { 
     77            object.deserialize(stream, Serialization.DataEncoding.BINARY); 
     78            return; 
     79        } 
    6680        double value = stream.readDouble(); 
    6781        if (((Boolean)adapterInfo.customAdapterData1).booleanValue()) { 
     
    7387 
    7488    @Override 
    75     public void serialize(BinaryOutputStream stream, GenericObject object, RemoteType type, Info adapterInfo) { 
     89    public void serialize(BinaryOutputStream stream, GenericObject object, RemoteType type, Info adapterInfo) throws Exception { 
     90        if (object.getType() == Angle.TYPE.getListType()) { 
     91            object.serialize(stream, Serialization.DataEncoding.BINARY); 
     92            return; 
     93        } 
    7694        boolean deg = ((Boolean)adapterInfo.customAdapterData1).booleanValue(); 
    7795        boolean unsigned = ((Boolean)adapterInfo.customAdapterData2).booleanValue(); 
Note: See TracChangeset for help on using the changeset viewer.