Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First draft of struct/enum generation for 1.04
- Loading branch information
1 parent
ae72527
commit a8b80b9
Showing
348 changed files
with
14,473 additions
and
2,352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4,773 changes: 2,923 additions & 1,850 deletions
4,773
...stack-core/src/main/java/org/eclipse/milo/opcua/stack/core/types/DataTypeInitializer.java
Large diffs are not rendered by default.
Oops, something went wrong.
118 changes: 118 additions & 0 deletions
118
...core/src/main/java/org/eclipse/milo/opcua/stack/core/types/builtin/OptionSetUInteger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright (c) 2021 the Eclipse Milo Authors | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
package org.eclipse.milo.opcua.stack.core.types.builtin; | ||
|
||
import java.util.Collection; | ||
import java.util.Set; | ||
|
||
import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UNumber; | ||
|
||
public abstract class OptionSetUInteger<F extends Enum<F> & OptionSetUInteger.BitIndex> extends UNumber { | ||
|
||
protected final UNumber value; | ||
|
||
public OptionSetUInteger(UNumber value) { | ||
this.value = value; | ||
} | ||
|
||
public UNumber getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public final int intValue() { | ||
return value.intValue(); | ||
} | ||
|
||
@Override | ||
public final long longValue() { | ||
return value.longValue(); | ||
} | ||
|
||
@Override | ||
public final float floatValue() { | ||
return value.floatValue(); | ||
} | ||
|
||
@Override | ||
public final double doubleValue() { | ||
return value.doubleValue(); | ||
} | ||
|
||
/** | ||
* Returns the value of the bit at {@code field}'s index. | ||
* | ||
* @param field the field | ||
* @return {@code true} if the bit at {@code field}'s index is set. | ||
*/ | ||
public final boolean get(F field) { | ||
return get(field.getBitIndex()); | ||
} | ||
|
||
/** | ||
* Returns the value of the bit at {@code bitIndex}. | ||
* | ||
* @param bitIndex the bit index. | ||
* @return {@code true} if the bit at {@code bitIndex} is set. | ||
*/ | ||
public final boolean get(int bitIndex) { | ||
return ((longValue() >>> bitIndex) & 1) == 1; | ||
} | ||
|
||
/** | ||
* Check if all bit {@code fields} are set. | ||
* | ||
* @param fields the fields to check. | ||
* @return {@code true} if all bit {@code fields} are set. | ||
*/ | ||
@SafeVarargs | ||
public final boolean containsAll(F... fields) { | ||
boolean b = true; | ||
for (F f : fields) { | ||
b &= get(f); | ||
} | ||
return b; | ||
} | ||
|
||
/** | ||
* Check if all bit {@code fields} are set. | ||
* | ||
* @param fields the fields to check. | ||
* @return {@code true} if all bit {@code fields} are set. | ||
*/ | ||
public final boolean containsAll(Collection<F> fields) { | ||
boolean b = true; | ||
for (F f : fields) { | ||
b &= get(f); | ||
} | ||
return b; | ||
} | ||
|
||
/** | ||
* Get the {@link Set} of fields that have their bit set. | ||
* | ||
* @return the {@link Set} of fields that have their bit set. | ||
*/ | ||
public abstract Set<F> toSet(); | ||
|
||
/** | ||
* Identifiers a type that has a corresponding bit index. | ||
*/ | ||
public interface BitIndex { | ||
|
||
/** | ||
* @return the index of some bit that corresponds with this type. | ||
*/ | ||
int getBitIndex(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ore/src/main/java/org/eclipse/milo/opcua/stack/core/types/enumerated/ApplicationType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/main/java/org/eclipse/milo/opcua/stack/core/types/enumerated/AxisScaleEnumeration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...a/org/eclipse/milo/opcua/stack/core/types/enumerated/BrokerTransportQualityOfService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2021 the Eclipse Milo Authors | ||
* | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
package org.eclipse.milo.opcua.stack.core.types.enumerated; | ||
|
||
import org.eclipse.milo.opcua.stack.core.serialization.SerializationContext; | ||
import org.eclipse.milo.opcua.stack.core.serialization.UaDecoder; | ||
import org.eclipse.milo.opcua.stack.core.serialization.UaEncoder; | ||
import org.eclipse.milo.opcua.stack.core.serialization.UaEnumeration; | ||
import org.eclipse.milo.opcua.stack.core.serialization.codecs.GenericDataTypeCodec; | ||
import org.eclipse.milo.opcua.stack.core.types.builtin.ExpandedNodeId; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public enum BrokerTransportQualityOfService implements UaEnumeration { | ||
NotSpecified(0), | ||
|
||
BestEffort(1), | ||
|
||
AtLeastOnce(2), | ||
|
||
AtMostOnce(3), | ||
|
||
ExactlyOnce(4); | ||
|
||
private final int value; | ||
|
||
BrokerTransportQualityOfService(int value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public int getValue() { | ||
return value; | ||
} | ||
|
||
@Nullable | ||
public static BrokerTransportQualityOfService from(int value) { | ||
switch (value) { | ||
case 0: | ||
return NotSpecified; | ||
case 1: | ||
return BestEffort; | ||
case 2: | ||
return AtLeastOnce; | ||
case 3: | ||
return AtMostOnce; | ||
case 4: | ||
return ExactlyOnce; | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
public static ExpandedNodeId getTypeId() { | ||
return ExpandedNodeId.parse("nsu=http://opcfoundation.org/UA/;i=15008"); | ||
} | ||
|
||
public static class Codec extends GenericDataTypeCodec<BrokerTransportQualityOfService> { | ||
@Override | ||
public Class<BrokerTransportQualityOfService> getType() { | ||
return BrokerTransportQualityOfService.class; | ||
} | ||
|
||
@Override | ||
public BrokerTransportQualityOfService decode(SerializationContext context, UaDecoder decoder) { | ||
return decoder.readEnum(null, BrokerTransportQualityOfService.class); | ||
} | ||
|
||
@Override | ||
public void encode(SerializationContext context, UaEncoder encoder, | ||
BrokerTransportQualityOfService value) { | ||
encoder.writeEnum(null, value); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ore/src/main/java/org/eclipse/milo/opcua/stack/core/types/enumerated/BrowseDirection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...re/src/main/java/org/eclipse/milo/opcua/stack/core/types/enumerated/BrowseResultMask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/src/main/java/org/eclipse/milo/opcua/stack/core/types/enumerated/DataChangeTrigger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.