eWON JTK

com.ewon.ewonitf
Class IOValue

java.lang.Object
  extended by com.ewon.ewonitf.IOValue

public class IOValue
extends Object

IOValue is a class used to hold a tag value that is exchanged between the Java IOServer and the eWON core and the other way round.
This object needs to hold the tag value with one of the types recognised by the eWON (Float, Integer, DWord, Boolean).

Since:
javaetk 1.4

Field Summary
static int DATATYPE_BOOLEAN
          Match the eWON "Boolean" tag type.
static int DATATYPE_FLOAT32
          Match the eWON "Floating point" tag type.
static int DATATYPE_INT32
          Match the eWON "Integer" tag type.
static int DATATYPE_UINT32
          Match the eWON "DWord" tag type.
 
Constructor Summary
IOValue(int dataType)
          Creates an IOValue object.
This object holds an IO Value with a given datatype.
The data type is defined when the object is created and this type will define how the internal value is stored.
 
Method Summary
 boolean getBoolean()
          Internal: read the IOValue value as Boolean (it must contain that type - no conversion done).
 int getDataType()
           
 float getFloat32()
          Internal: read the IOValue value as Float32 (it must contain that type - no conversion done).
 int getInt32()
          Internal: read the IOValue value as Int32 (it must contain that type - no conversion done).
 long getUInt32()
          Internal: read the IOValue value as UInt32 (it must contain that type - no conversion done).
static boolean isDataTypeValid(int dataType)
          Validates a DataType value.
 void setBoolean(boolean value)
          Internal: Write an Boolean in the IOValue value (it must contain that type - no conversion done).
 void setFloat32(float value)
          Internal: Write an Float32 in the IOValue value (it must contain that type - no conversion done).
 void setInt32(int value)
          Internal: Write an Int32 in the IOValue value (it must contain that type - no conversion done).
 void setUInt32(long value)
          Internal: Write an UInt32 in the IOValue value (it must contain that type - no conversion done).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATATYPE_BOOLEAN

public static final int DATATYPE_BOOLEAN
Match the eWON "Boolean" tag type.

See Also:
Constant Field Values

DATATYPE_FLOAT32

public static final int DATATYPE_FLOAT32
Match the eWON "Floating point" tag type.

See Also:
Constant Field Values

DATATYPE_INT32

public static final int DATATYPE_INT32
Match the eWON "Integer" tag type.

See Also:
Constant Field Values

DATATYPE_UINT32

public static final int DATATYPE_UINT32
Match the eWON "DWord" tag type.

See Also:
Constant Field Values
Constructor Detail

IOValue

public IOValue(int dataType)
Creates an IOValue object.
This object holds an IO Value with a given datatype.
The data type is defined when the object is created and this type will define how the internal value is stored. Each time the value is set or got using one of the object's functions, the internal value will be converted to/from the internal storage, to the required type (possibly loosing some precision).
Important: You do not normally care about these conversion, the API will return an IOValue that you will pass to other API function, considering it as a black box.

Parameters:
dataType - One of DATATYPE_BOOLEAN, DATATYPE_FLOAT32, DATATYPE_INT32 and DATATYPE_UINT32..
Method Detail

isDataTypeValid

public static boolean isDataTypeValid(int dataType)
Validates a DataType value.

Parameters:
dataType - One of DATATYPE_BOOLEAN, DATATYPE_FLOAT32, DATATYPE_INT32 and DATATYPE_UINT32.
Returns:
true if the dataType is valid.

getDataType

public int getDataType()
Returns:
The current value of the object's dataType (as defined during creation).

getUInt32

public long getUInt32()
Internal: read the IOValue value as UInt32 (it must contain that type - no conversion done).

Returns:
IOValue value as long.

getInt32

public int getInt32()
Internal: read the IOValue value as Int32 (it must contain that type - no conversion done).

Returns:
IOValue value as int.

getFloat32

public float getFloat32()
Internal: read the IOValue value as Float32 (it must contain that type - no conversion done).

Returns:
IOValue value as float.

getBoolean

public boolean getBoolean()
Internal: read the IOValue value as Boolean (it must contain that type - no conversion done).

Returns:
IOValue value as boolean.

setUInt32

public void setUInt32(long value)
Internal: Write an UInt32 in the IOValue value (it must contain that type - no conversion done).

Parameters:
value - to write in IOValue internal storage.

setInt32

public void setInt32(int value)
Internal: Write an Int32 in the IOValue value (it must contain that type - no conversion done).

Parameters:
value - to write in IOValue internal storage.

setFloat32

public void setFloat32(float value)
Internal: Write an Float32 in the IOValue value (it must contain that type - no conversion done).

Parameters:
value - to write in IOValue internal storage.

setBoolean

public void setBoolean(boolean value)
Internal: Write an Boolean in the IOValue value (it must contain that type - no conversion done).

Parameters:
value - to write in IOValue internal storage.

eWON JTK

www.eWON.biz: Your Eyes Watching Over Net