Changeset 30:fcdb91905e62 in rrlib_serialization-java


Ignore:
Timestamp:
12.09.2017 10:21:27 (22 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adapts to changes in rrlib_rtti

Location:
rtti
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rtti/DataType.java

    r26 r30  
    4949        super(name != null ? name : javaClass.getSimpleName()); 
    5050        this.javaClass = javaClass; 
    51         typeTraits = IS_DATA_TYPE | 
     51        typeTraits = CLASSIFICATION_OTHER_DATA_TYPE | 
    5252                     (Serialization.isBinarySerializable(javaClass) ? IS_BINARY_SERIALIZABLE : 0) | 
    5353                     (Serialization.isStringSerializable(javaClass) ? IS_STRING_SERIALIZABLE : 0) | 
     
    8080        super("List<" + e.getName() + ">"); 
    8181        this.elementType = e; 
    82         this.typeTraits = (e.typeTraits & (IS_BINARY_SERIALIZABLE | IS_STRING_SERIALIZABLE | IS_XML_SERIALIZABLE) | IS_DATA_TYPE | IS_LIST_TYPE); 
     82        this.typeTraits = (e.typeTraits & (IS_BINARY_SERIALIZABLE | IS_STRING_SERIALIZABLE | IS_XML_SERIALIZABLE) | CLASSIFICATION_LIST); 
    8383    } 
    8484 
     
    8787    public Object createInstance() { 
    8888        Object result = null; 
    89         if (javaClass == null && (typeTraits & IS_LIST_TYPE) != 0) { 
     89        if (javaClass == null && (getTypeClassification() == CLASSIFICATION_LIST)) { 
    9090            return new PortDataListImpl(getElementType()); 
    9191        } 
  • rtti/DataTypeBase.java

    r28 r30  
    5151public class DataTypeBase { 
    5252 
     53    /** Type classification */ 
     54    public enum Classification { 
     55        RPC_TYPE, 
     56        ARRAY, 
     57        LIST, 
     58        PAIR, 
     59        TUPLE, 
     60        INTEGRAL, 
     61        OTHER_DATA_TYPE 
     62    } 
     63 
    5364    /** Relevant type traits across runtime environments (equals C++ traits) */ 
    5465    public static final int 
     
    5667    IS_STRING_SERIALIZABLE = 1 << 9, 
    5768    IS_XML_SERIALIZABLE = 1 << 10, 
    58     IS_ENUM = 1 << 11, 
    59     IS_DATA_TYPE = 1 << 12, 
    60     IS_RPC_TYPE = 1 << 13, 
    61     IS_ARRAY = 1 << 14, 
    62     // the traits below are only set in C++ 
    63     HAS_UNDERLYING_TYPE = 1 << 15, 
    64     IS_CAST_TO_UNDERLYING_TYPE_IMPLICIT = 1 << 16, 
    65     IS_REINTERPRET_CAST_FROM_UNDERLYING_TYPE_VALID = 1 << 17, 
    66     IS_CAST_FROM_UNDERLYING_TYPE_IMPLICIT = 1 << 18, 
    67     IS_UNDERLYING_TYPE_BINARY_SERIALIZATION_DIFFERENT = 1 << 19, 
    68     SUPPORTS_BITWISE_COPY = 1 << 20, 
    69     IS_INTEGRAL = 1 << 21, 
    70     IS_LIST_TYPE = 1 << 22, 
    71     HAS_TRIVIAL_DESTRUCTOR = 1 << 23; 
     69    IS_ENUM = 1 << 11,  // not part of Classification enum for legacy compatibility 
     70 
     71    // Classification bits (enum) 
     72    CLASSIFICATION_BITS = (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15), 
     73    CLASSIFICATION_ARRAY = 0 << 12, 
     74    CLASSIFICATION_LIST = 1 << 12, 
     75    CLASSIFICATION_PAIR = 2 << 12, 
     76    CLASSIFICATION_TUPLE = 3 << 12, 
     77    CLASSIFICATION_ENUM_BASED_FLAGS = 4 << 12, 
     78    CLASSIFICATION_AUTO_NAMED = CLASSIFICATION_ENUM_BASED_FLAGS, 
     79    CLASSIFICATION_INTEGRAL = 12 << 12, 
     80    CLASSIFICATION_OTHER_DATA_TYPE = 13 << 12, 
     81    CLASSIFICATION_NULL_TYPE = 14 << 12, 
     82    CLASSIFICATION_RPC_TYPE = 15 << 12, 
     83 
     84    // The traits below are only set in C++ 
     85    HAS_UNDERLYING_TYPE = 1 << 16, 
     86    IS_CAST_TO_UNDERLYING_TYPE_IMPLICIT = 1 << 17, 
     87    IS_REINTERPRET_CAST_FROM_UNDERLYING_TYPE_VALID = 1 << 18, 
     88    IS_CAST_FROM_UNDERLYING_TYPE_IMPLICIT = 1 << 19, 
     89    IS_UNDERLYING_TYPE_BINARY_SERIALIZATION_DIFFERENT = 1 << 20, 
     90    SUPPORTS_BITWISE_COPY = 1 << 21, 
     91    HAS_TRIVIAL_DESTRUCTOR = 1 << 22; 
     92 
    7293 
    7394    /** Register with all registered data types */ 
     
    119140    protected int typeTraits; 
    120141 
    121     ///** Is this a remote type? */ 
    122     //protected boolean remoteType = false; 
     142    static { 
     143        NULL_TYPE.typeTraits |= CLASSIFICATION_NULL_TYPE; 
     144    } 
    123145 
    124146    public DataTypeBase(String name) { 
     
    191213 
    192214    /** 
     215     * @return Type classification 
     216     */ 
     217    public int getTypeClassification() { 
     218        return typeTraits & CLASSIFICATION_BITS; 
     219    } 
     220 
     221    /** 
    193222     * @return Bit vector of type traits 
    194223     */ 
     
    323352            return true; 
    324353        } 
    325         if ((typeTraits & dataType.typeTraits & IS_LIST_TYPE) != 0) { 
     354        if (getTypeClassification() == CLASSIFICATION_LIST) { 
    326355            return getElementType() != null && dataType.getElementType() != null && getElementType().isConvertibleTo(dataType.getElementType()); 
    327356        } 
Note: See TracChangeset for help on using the changeset viewer.