Skip to main content
FRAMES NO FRAMES

Class IloCplex::Serializer

Definition file: ilcplex/ilocplexi.h
Map of IloCplex::SerializerIloCplex::SerializerIloCplex::Serializer

This class is a utility class to serialize data. When your application transfers data to a remote worker, this data should be serialized in a way that does not depend on host-specific characteristics, such as big-end or little-end byte-order, for example. This kind of serialization is achieved by this class.

To serialize data, first instantiate this class; then add data by means of one of the various add methods.

To access the serialized data, use the method getRawData.

To learn the length of serialized data, use the method getRawLength.

The serialization performed by this class is compatible with the de-serialization done by the class Deserializer as well as serializers and de-serializers created by the Callable Library (C API) routines CPXXserializercreate and CPXXdeserializercreate. For documentation of those routines, see the reference manual of the Callable Library (C API).

The memory required to serialize an element of type T is always sizeof(T).

See Also:

Method Summary
public voidadd(double const * d, CPXLONG cnt)
public voidadd(double d)
public voidadd(float const * f, CPXLONG cnt)
public voidadd(float f)
public voidadd(CPXLONG const * l, CPXLONG cnt)
public voidadd(CPXLONG l)
public voidadd(CPXINT const * i, CPXLONG cnt)
public voidadd(CPXINT i)
public voidadd(CPXSHORT const * s, CPXLONG cnt)
public voidadd(CPXSHORT s)
public voidadd(CPXBYTE const * b, CPXLONG cnt)
public voidadd(CPXBYTE b)
public void const *getRawData() const
public CPXLONGgetRawLength() const
public Serializer()
public ~Serializer()
Method Detail

Serializer

public Serializer()

Creates a new serializer.


~Serializer

public ~Serializer()

Destroys this deserializer. Any pointers returned by the method getRawData will be invalid after the destruction.


add

public void add(double const * d, CPXLONG cnt)

Serializes cnt IEEE double-precision floating-point numbers from the source specified by b.


add

public void add(double d)

Serializes a single IEEE double-precision floating-point number.


add

public void add(float const * f, CPXLONG cnt)

Serializes cnt IEEE single-precision floating-point numbers from the source specified by b.


add

public void add(float f)

Serializes a single IEEE single-precision floating-point number.


add

public void add(CPXLONG const * l, CPXLONG cnt)

Serializes cnt 64-bit, signed integers from the source specified by b.


add

public void add(CPXLONG l)

Serializes a single, 64-bit, signed integer.


add

public void add(CPXINT const * i, CPXLONG cnt)

Serializes cnt 32-bit, signed integers from the source specified by b.


add

public void add(CPXINT i)

Serializes a single, 32-bit, signed integer.


add

public void add(CPXSHORT const * s, CPXLONG cnt)

Serializes cnt 16-bit, signed integers from the source specified by b.


add

public void add(CPXSHORT s)

Serializes a single, 16-bit, signed integer.


add

public void add(CPXBYTE const * b, CPXLONG cnt)

Serializes cnt 8-bit, signed integers from the source specified by b.


add

public void add(CPXBYTE b)

Serializes a single, 8-bit, signed integer.


getRawData

public void const * getRawData() const

Accesses a pointer to the raw serialized data. The returned pointer is valid until the next call to any of the add methods or to the destructor.

See Also:

Returns:

A pointer to the memory that holds the serialized data.

getRawLength

public CPXLONG getRawLength() const

Accesses the length of the serialized data.

See Also:

Returns:

The number of bytes stored at the pointer returned by the method getRawData.