Ejemplo n.º 1
0
def populateMessage(message):

    # Add Fields of varying data types to the Message
    value = 1

    message.add_field(libgmsec_python3.CharField("CHAR-FIELD", 'c'))
    message.add_field(libgmsec_python3.BooleanField("BOOL-FIELD-TRUE", True))
    message.add_field(libgmsec_python3.BooleanField("BOOL-FIELD-FALSE", False))
    message.add_field(libgmsec_python3.I8Field("I8-FIELD", value))
    message.add_field(libgmsec_python3.I16Field("I16-FIELD", value))
    message.add_field(libgmsec_python3.I32Field("I32-FIELD", value))
    message.add_field(libgmsec_python3.I64Field("I64-FIELD", value))
    message.add_field(libgmsec_python3.U8Field("U8-FIELD", value))
    message.add_field(libgmsec_python3.U16Field("U16-FIELD", value))
    message.add_field(libgmsec_python3.U32Field("U32-FIELD", value))
    message.add_field(libgmsec_python3.U64Field("U64-FIELD", value))
    message.add_field(
        libgmsec_python3.StringField("STRING-FIELD", "This is a test"))
    message.add_field(libgmsec_python3.F32Field("F32-FIELD", (1 + 1. / value)))
    message.add_field(libgmsec_python3.F64Field("F64-FIELD", (1 + 1. / value)))
    message.add_field(libgmsec_python3.BinaryField("BIN-FIELD", "JLMNOPQ", 7))
Ejemplo n.º 2
0
def populateMessage(message, value):

    # Note: Since C++ is a strongly-typed language, it is possible to use
    # type casting to add Field objects to a Message without having to
    # first create a Field object, then add it to the message.
    message.add_field(libgmsec_python3.CharField("CHAR-FIELD", 'c'))
    message.add_field(libgmsec_python3.BooleanField("BOOL-FIELD-TRUE", True))
    message.add_field(libgmsec_python3.BooleanField("BOOL-FIELD-FALSE", False))
    message.add_field(libgmsec_python3.I8Field("I8-FIELD", value % 128))
    message.add_field(libgmsec_python3.I16Field("I16-FIELD", value))
    message.add_field(libgmsec_python3.I32Field("I32-FIELD", value))
    message.add_field(libgmsec_python3.I64Field("I64-FIELD", value))
    message.add_field(libgmsec_python3.U8Field("U8-FIELD", value % 256))
    message.add_field(libgmsec_python3.U16Field("U16-FIELD", value))
    message.add_field(libgmsec_python3.U32Field("U32-FIELD", value))
    message.add_field(libgmsec_python3.U64Field("U64-FIELD", value))
    message.add_field(
        libgmsec_python3.StringField("STRING-FIELD", "This is a test"))
    message.add_field(libgmsec_python3.F32Field("F32-FIELD", (1 + 1. / value)))
    message.add_field(libgmsec_python3.F64Field("F64-FIELD", (1 + 1. / value)))
    message.add_field(libgmsec_python3.BinaryField("BIN-FIELD", "JLMNOPQ", 7))