Пример #1
0
def cdrMarshal(tc, data, endian=-1):
    """cdrMarshal(TypeCode, data [,endian]) -> binary string

Marshal data with the given type into a CDR encapsulation. The data
can later be converted back into Python objects with cdrUnmarshal().
The encapsulation is language, platform, and ORB independent.

If the endian boolean is provided, it represents the endianness to
marshal with: True for little endian; false for big endian. The
resulting string in this case is the raw marshalled form, not a CDR
encapsulation. To unmarshal it, the endianness must be known.

CORBA.ORB_init must be called before using this function.

Throws CORBA.BAD_PARAM if the data does not match the TypeCode or
CORBA.BAD_INV_ORDER if the ORB has not been initialised."""

    if orb is None:
        raise CORBA.BAD_INV_ORDER(BAD_INV_ORDER_ORBNotInitialised,
                                  CORBA.COMPLETED_NO)

    if not isinstance(tc, CORBA.TypeCode):
        raise TypeError("Argument 1 must be a TypeCode")

    return _omnipy.cdrMarshal(tc._d, data, endian)
Пример #2
0
def cdrMarshal(tc, data, endian=-1):
    """cdrMarshal(TypeCode, data [,endian]) -> binary string

Marshal data with the given type into a CDR encapsulation. The data
can later be converted back into Python objects with cdrUnmarshal().
The encapsulation is language, platform, and ORB independent.

If the endian boolean is provided, it represents the endianness to
marshal with: True for little endian; false for big endian. The
resulting string in this case is the raw marshalled form, not a CDR
encapsulation. To unmarshal it, the endianness must be known.

CORBA.ORB_init must be called before using this function.

Throws CORBA.BAD_PARAM if the data does not match the TypeCode or
CORBA.BAD_INV_ORDER if the ORB has not been initialised."""

    if orb is None:
        raise CORBA.BAD_INV_ORDER(BAD_INV_ORDER_ORBNotInitialised,
                                  CORBA.COMPLETED_NO)

    if not isinstance(tc, CORBA.TypeCode):
        raise TypeError("Argument 1 must be a TypeCode")

    return _omnipy.cdrMarshal(tc._d, data, endian)