Ejemplo n.º 1
0
 def testFrontendAllocationStruct(self):
     frontend_scanner_allocation = struct_property(
         id_="FRONTEND::scanner_allocation",
         name="frontend_scanner_allocation",
         structdef=fe_types.frontend_scanner_allocation,
         configurationkind=("allocation", ),
         mode="writeonly",
         description=
         """Frontend Interfaces v2.0 scanner allocation structure""")
     self.assertEquals(
         frontend_scanner_allocation.
         fields['FRONTEND::scanner_allocation::min_freq'][1].type_,
         'double')
     self.assertEquals(
         frontend_scanner_allocation.
         fields['FRONTEND::scanner_allocation::max_freq'][1].type_,
         'double')
     self.assertEquals(
         frontend_scanner_allocation.
         fields['FRONTEND::scanner_allocation::mode'][1].type_, 'string')
     self.assertEquals(
         frontend_scanner_allocation.
         fields['FRONTEND::scanner_allocation::control_mode'][1].type_,
         'string')
     self.assertEquals(
         frontend_scanner_allocation.
         fields['FRONTEND::scanner_allocation::control_limit'][1].type_,
         'double')
Ejemplo n.º 2
0
class TestPythonPropsRange_base(CF__POA.Resource, Component,
                                ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    my_octet_name = simple_property(id_="my_octet",
                                    name="my_octet_name",
                                    type_="octet",
                                    defvalue=1,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))

    my_short_name = simple_property(id_="my_short",
                                    name="my_short_name",
                                    type_="short",
                                    defvalue=2,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))

    my_ushort_name = simple_property(id_="my_ushort",
                                     name="my_ushort_name",
                                     type_="ushort",
                                     defvalue=3,
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))

    my_long_name = simple_property(id_="my_long",
                                   name="my_long_name",
                                   type_="long",
                                   defvalue=4,
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))

    my_ulong_name = simple_property(id_="my_ulong",
                                    name="my_ulong_name",
                                    type_="ulong",
                                    defvalue=5,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))

    my_longlong_name = simple_property(id_="my_longlong",
                                       name="my_longlong_name",
                                       type_="longlong",
                                       defvalue=6,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))

    my_ulonglong_name = simple_property(id_="my_ulonglong",
                                        name="my_ulonglong_name",
                                        type_="ulonglong",
                                        defvalue=7,
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))

    seq_octet_name = simpleseq_property(id_="seq_octet",
                                        name="seq_octet_name",
                                        type_="octet",
                                        defvalue=[
                                            1,
                                            2,
                                        ],
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))

    seq_short_name = simpleseq_property(id_="seq_short",
                                        name="seq_short_name",
                                        type_="short",
                                        defvalue=[
                                            1,
                                            2,
                                        ],
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))

    seq_ushort_name = simpleseq_property(id_="seq_ushort",
                                         name="seq_ushort_name",
                                         type_="ushort",
                                         defvalue=[
                                             1,
                                             2,
                                         ],
                                         mode="readwrite",
                                         action="external",
                                         kinds=("configure", ))

    seq_long_name = simpleseq_property(id_="seq_long",
                                       name="seq_long_name",
                                       type_="long",
                                       defvalue=[
                                           1,
                                           2,
                                       ],
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))

    seq_ulong_name = simpleseq_property(id_="seq_ulong",
                                        name="seq_ulong_name",
                                        type_="ulong",
                                        defvalue=[
                                            1,
                                            2,
                                        ],
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))

    seq_longlong_name = simpleseq_property(id_="seq_longlong",
                                           name="seq_longlong_name",
                                           type_="longlong",
                                           defvalue=[
                                               1,
                                               2,
                                           ],
                                           mode="readwrite",
                                           action="external",
                                           kinds=("configure", ))

    seq_ulonglong_name = simpleseq_property(id_="seq_ulonglong",
                                            name="seq_ulonglong_name",
                                            type_="ulonglong",
                                            defvalue=[
                                                1,
                                                2,
                                            ],
                                            mode="readwrite",
                                            action="external",
                                            kinds=("configure", ))

    seq_char_name = simpleseq_property(id_="seq_char",
                                       name="seq_char_name",
                                       type_="char",
                                       defvalue=[
                                           'a',
                                           'b',
                                       ],
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))

    class MyStructName(object):
        struct_octet_name = simple_property(id_="struct_octet",
                                            name="struct_octet_name",
                                            type_="octet",
                                            defvalue=1)

        struct_short_name = simple_property(id_="struct_short",
                                            name="struct_short_name",
                                            type_="short",
                                            defvalue=2)

        struct_ushort_name = simple_property(id_="struct_ushort",
                                             name="struct_ushort_name",
                                             type_="ushort",
                                             defvalue=3)

        struct_long_name = simple_property(id_="struct_long",
                                           name="struct_long_name",
                                           type_="long",
                                           defvalue=4)

        struct_ulong_name = simple_property(id_="struct_ulong",
                                            name="struct_ulong_name",
                                            type_="ulong",
                                            defvalue=5)

        struct_longlong_name = simple_property(id_="struct_longlong",
                                               name="struct_longlong_name",
                                               type_="longlong",
                                               defvalue=6)

        struct_ulonglong_name = simple_property(id_="struct_ulonglong",
                                                name="struct_ulonglong_name",
                                                type_="ulonglong",
                                                defvalue=7)

        struct_seq_octet_name = simpleseq_property(
            id_="struct_seq_octet",
            name="struct_seq_octet_name",
            type_="octet",
            defvalue=[
                1,
                2,
            ])

        struct_seq_short_name = simpleseq_property(
            id_="struct_seq_short",
            name="struct_seq_short_name",
            type_="short",
            defvalue=[
                1,
                2,
            ])

        struct_seq_ushort_name = simpleseq_property(
            id_="struct_seq_ushort",
            name="struct_seq_ushort_name",
            type_="ushort",
            defvalue=[
                1,
                2,
            ])

        struct_seq_long_name = simpleseq_property(id_="struct_seq_long",
                                                  name="struct_seq_long_name",
                                                  type_="long",
                                                  defvalue=[
                                                      1,
                                                      2,
                                                  ])

        struct_seq_ulong_name = simpleseq_property(
            id_="struct_seq_ulong",
            name="struct_seq_ulong_name",
            type_="ulong",
            defvalue=[
                1,
                2,
            ])

        struct_seq_longlong_name = simpleseq_property(
            id_="struct_seq_longlong",
            name="struct_seq_longlong_name",
            type_="longlong",
            defvalue=[
                1,
                2,
            ])

        struct_seq_ulonglong_name = simpleseq_property(
            id_="struct_seq_ulonglong",
            name="struct_seq_ulonglong_name",
            type_="ulonglong",
            defvalue=[
                1,
                2,
            ])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property or type(
                        classattr) == simpleseq_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["struct_octet_name"] = self.struct_octet_name
            d["struct_short_name"] = self.struct_short_name
            d["struct_ushort_name"] = self.struct_ushort_name
            d["struct_long_name"] = self.struct_long_name
            d["struct_ulong_name"] = self.struct_ulong_name
            d["struct_longlong_name"] = self.struct_longlong_name
            d["struct_ulonglong_name"] = self.struct_ulonglong_name
            d["struct_seq_octet_name"] = self.struct_seq_octet_name
            d["struct_seq_short_name"] = self.struct_seq_short_name
            d["struct_seq_ushort_name"] = self.struct_seq_ushort_name
            d["struct_seq_long_name"] = self.struct_seq_long_name
            d["struct_seq_ulong_name"] = self.struct_seq_ulong_name
            d["struct_seq_longlong_name"] = self.struct_seq_longlong_name
            d["struct_seq_ulonglong_name"] = self.struct_seq_ulonglong_name
            return str(d)

        def getId(self):
            return "my_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [
                ("struct_octet_name", self.struct_octet_name),
                ("struct_short_name", self.struct_short_name),
                ("struct_ushort_name", self.struct_ushort_name),
                ("struct_long_name", self.struct_long_name),
                ("struct_ulong_name", self.struct_ulong_name),
                ("struct_longlong_name", self.struct_longlong_name),
                ("struct_ulonglong_name", self.struct_ulonglong_name),
                ("struct_seq_octet_name", self.struct_seq_octet_name),
                ("struct_seq_short_name", self.struct_seq_short_name),
                ("struct_seq_ushort_name", self.struct_seq_ushort_name),
                ("struct_seq_long_name", self.struct_seq_long_name),
                ("struct_seq_ulong_name", self.struct_seq_ulong_name),
                ("struct_seq_longlong_name", self.struct_seq_longlong_name),
                ("struct_seq_ulonglong_name", self.struct_seq_ulonglong_name)
            ]

    my_struct_name = struct_property(id_="my_struct",
                                     name="my_struct_name",
                                     structdef=MyStructName,
                                     configurationkind=("configure", ),
                                     mode="readwrite")

    class SsStructName(object):
        ss_octet_name = simple_property(id_="ss_octet",
                                        name="ss_octet_name",
                                        type_="octet")

        ss_short_name = simple_property(id_="ss_short",
                                        name="ss_short_name",
                                        type_="short")

        ss_ushort_name = simple_property(id_="ss_ushort",
                                         name="ss_ushort_name",
                                         type_="ushort")

        ss_long_name = simple_property(id_="ss_long",
                                       name="ss_long_name",
                                       type_="long")

        ss_ulong_name = simple_property(id_="ss_ulong",
                                        name="ss_ulong_name",
                                        type_="ulong")

        ss_longlong_name = simple_property(id_="ss_longlong",
                                           name="ss_longlong_name",
                                           type_="longlong")

        ss_ulonglong_name = simple_property(id_="ss_ulonglong",
                                            name="ss_ulonglong_name",
                                            type_="ulonglong")

        ss_seq_octet_name = simpleseq_property(id_="ss_seq_octet",
                                               name="ss_seq_octet_name",
                                               type_="octet")

        ss_seq_short_name = simpleseq_property(id_="ss_seq_short",
                                               name="ss_seq_short_name",
                                               type_="short")

        ss_seq_ushort_name = simpleseq_property(id_="ss_seq_ushort",
                                                name="ss_seq_ushort_name",
                                                type_="ushort")

        ss_seq_long_name = simpleseq_property(id_="ss_seq_long",
                                              name="ss_seq_long_name",
                                              type_="long")

        ss_seq_ulong_name = simpleseq_property(id_="ss_seq_ulong",
                                               name="ss_seq_ulong_name",
                                               type_="ulong")

        ss_seq_longlong_name = simpleseq_property(id_="ss_seq_longlong",
                                                  name="ss_seq_longlong_name",
                                                  type_="longlong")

        ss_seq_ulonglong_name = simpleseq_property(
            id_="ss_seq_ulonglong",
            name="ss_seq_ulonglong_name",
            type_="ulonglong")

        def __init__(self,
                     ss_octet_name=0,
                     ss_short_name=0,
                     ss_ushort_name=0,
                     ss_long_name=0,
                     ss_ulong_name=0,
                     ss_longlong_name=0,
                     ss_ulonglong_name=0,
                     ss_seq_octet_name=0,
                     ss_seq_short_name=0,
                     ss_seq_ushort_name=0,
                     ss_seq_long_name=0,
                     ss_seq_ulong_name=0,
                     ss_seq_longlong_name=0,
                     ss_seq_ulonglong_name=0):
            self.ss_octet_name = ss_octet_name
            self.ss_short_name = ss_short_name
            self.ss_ushort_name = ss_ushort_name
            self.ss_long_name = ss_long_name
            self.ss_ulong_name = ss_ulong_name
            self.ss_longlong_name = ss_longlong_name
            self.ss_ulonglong_name = ss_ulonglong_name
            self.ss_seq_octet_name = ss_seq_octet_name
            self.ss_seq_short_name = ss_seq_short_name
            self.ss_seq_ushort_name = ss_seq_ushort_name
            self.ss_seq_long_name = ss_seq_long_name
            self.ss_seq_ulong_name = ss_seq_ulong_name
            self.ss_seq_longlong_name = ss_seq_longlong_name
            self.ss_seq_ulonglong_name = ss_seq_ulonglong_name

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["ss_octet_name"] = self.ss_octet_name
            d["ss_short_name"] = self.ss_short_name
            d["ss_ushort_name"] = self.ss_ushort_name
            d["ss_long_name"] = self.ss_long_name
            d["ss_ulong_name"] = self.ss_ulong_name
            d["ss_longlong_name"] = self.ss_longlong_name
            d["ss_ulonglong_name"] = self.ss_ulonglong_name
            d["ss_seq_octet_name"] = self.ss_seq_octet_name
            d["ss_seq_short_name"] = self.ss_seq_short_name
            d["ss_seq_ushort_name"] = self.ss_seq_ushort_name
            d["ss_seq_long_name"] = self.ss_seq_long_name
            d["ss_seq_ulong_name"] = self.ss_seq_ulong_name
            d["ss_seq_longlong_name"] = self.ss_seq_longlong_name
            d["ss_seq_ulonglong_name"] = self.ss_seq_ulonglong_name
            return str(d)

        def getId(self):
            return "ss_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("ss_octet_name", self.ss_octet_name),
                    ("ss_short_name", self.ss_short_name),
                    ("ss_ushort_name", self.ss_ushort_name),
                    ("ss_long_name", self.ss_long_name),
                    ("ss_ulong_name", self.ss_ulong_name),
                    ("ss_longlong_name", self.ss_longlong_name),
                    ("ss_ulonglong_name", self.ss_ulonglong_name),
                    ("ss_seq_octet_name", self.ss_seq_octet_name),
                    ("ss_seq_short_name", self.ss_seq_short_name),
                    ("ss_seq_ushort_name", self.ss_seq_ushort_name),
                    ("ss_seq_long_name", self.ss_seq_long_name),
                    ("ss_seq_ulong_name", self.ss_seq_ulong_name),
                    ("ss_seq_longlong_name", self.ss_seq_longlong_name),
                    ("ss_seq_ulonglong_name", self.ss_seq_ulonglong_name)]

    my_structseq_name = structseq_property(
        id_="my_structseq",
        name="my_structseq_name",
        structdef=SsStructName,
        defvalue=[
            SsStructName(0, 1, 2, 3, 4, 5, 6, [1, 2], [3, 4], [5, 6], [7, 8],
                         [9, 10], [11, 12], [13, 14]),
            SsStructName(7, 8, 9, 10, 11, 12, 13, [15, 16], [17, 18], [19, 20],
                         [21, 22], [23, 24], [25, 26], [27, 28])
        ],
        configurationkind=("configure", ),
        mode="readwrite")
class AllPropertyTypesComponent_base(CF__POA.Resource, Component,
                                     ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    simpleString = simple_property(id_="simpleString",
                                   name="simpleString",
                                   type_="string",
                                   defvalue="simpleStringTest",
                                   mode="readwrite",
                                   action="external",
                                   kinds=("property", ))

    simpleBool = simple_property(id_="simpleBool",
                                 name="simpleBool",
                                 type_="boolean",
                                 defvalue=True,
                                 mode="readwrite",
                                 action="external",
                                 kinds=("property", ))

    simpleDouble = simple_property(id_="simpleDouble",
                                   name="simpleDouble",
                                   type_="double",
                                   defvalue=123.456,
                                   mode="readwrite",
                                   action="external",
                                   kinds=("property", ))

    simpleShort = simple_property(id_="simpleShort",
                                  name="simpleShort",
                                  type_="short",
                                  defvalue=123,
                                  mode="readwrite",
                                  action="external",
                                  kinds=("property", ))

    readOnlyString = simple_property(id_="readOnlyString",
                                     name="readOnlyString",
                                     type_="string",
                                     defvalue="doNotChangeMe",
                                     mode="readonly",
                                     action="external",
                                     kinds=("property", ))

    simpleSeqString = simpleseq_property(id_="simpleSeqString",
                                         name="simpleSeqString",
                                         type_="string",
                                         defvalue=[
                                             "simpleSeqStringTest1",
                                             "simpleSeqStringTest2",
                                             "simpleSeqStringTest3"
                                         ],
                                         mode="readwrite",
                                         action="external",
                                         kinds=("property", ))

    simpleSeqBool = simpleseq_property(id_="simpleSeqBool",
                                       name="simpleSeqBool",
                                       type_="boolean",
                                       defvalue=[True, False, True],
                                       mode="readwrite",
                                       action="external",
                                       kinds=("property", ))

    simpleSeqDouble = simpleseq_property(
        id_="simpleSeqDouble",
        name="simpleSeqDouble",
        type_="double",
        defvalue=[234.56700000000001, 345.678, 456.78899999999999],
        mode="readwrite",
        action="external",
        kinds=("property", ))

    simpleSeqShort = simpleseq_property(id_="simpleSeqShort",
                                        name="simpleSeqShort",
                                        type_="short",
                                        defvalue=[234, 345, 456],
                                        mode="readwrite",
                                        action="external",
                                        kinds=("property", ))

    class StructString(object):
        structSimpleString = simple_property(id_="structSimpleString",
                                             name="structSimpleString",
                                             type_="string",
                                             defvalue="structSimpleStringTest")

        structSimpleSeqString = simpleseq_property(
            id_="structSimpleSeqString",
            name="structSimpleSeqString",
            type_="string",
            defvalue=[
                "structSeqSimpleStringTest1", "structSeqSimpleStringTest2",
                "structSeqSimpleStringTest3"
            ])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSimpleString"] = self.structSimpleString
            d["structSimpleSeqString"] = self.structSimpleSeqString
            return str(d)

        @classmethod
        def getId(cls):
            return "structString"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSimpleString", self.structSimpleString),
                    ("structSimpleSeqString", self.structSimpleSeqString)]

    structString = struct_property(id_="structString",
                                   name="structString",
                                   structdef=StructString,
                                   configurationkind=("property", ),
                                   mode="readwrite")

    class StructBool(object):
        structSimpleBool = simple_property(id_="structSimpleBool",
                                           name="structSimpleBool",
                                           type_="boolean",
                                           defvalue=False)

        structSimpleSeqBool = simpleseq_property(id_="structSimpleSeqBool",
                                                 name="structSimpleSeqBool",
                                                 type_="boolean",
                                                 defvalue=[False, True, False])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSimpleBool"] = self.structSimpleBool
            d["structSimpleSeqBool"] = self.structSimpleSeqBool
            return str(d)

        @classmethod
        def getId(cls):
            return "structBool"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSimpleBool", self.structSimpleBool),
                    ("structSimpleSeqBool", self.structSimpleSeqBool)]

    structBool = struct_property(id_="structBool",
                                 name="structBool",
                                 structdef=StructBool,
                                 configurationkind=("property", ),
                                 mode="readwrite")

    class StructDouble(object):
        structSimpleDouble = simple_property(id_="structSimpleDouble",
                                             name="structSimpleDouble",
                                             type_="double",
                                             defvalue=987.654)

        structSimpleSeqDouble = simpleseq_property(
            id_="structSimpleSeqDouble",
            name="structSimpleSeqDouble",
            type_="double",
            defvalue=[
                876.54300000000001, 765.43200000000002, 654.32100000000003
            ])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSimpleDouble"] = self.structSimpleDouble
            d["structSimpleSeqDouble"] = self.structSimpleSeqDouble
            return str(d)

        @classmethod
        def getId(cls):
            return "structDouble"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSimpleDouble", self.structSimpleDouble),
                    ("structSimpleSeqDouble", self.structSimpleSeqDouble)]

    structDouble = struct_property(id_="structDouble",
                                   name="structDouble",
                                   structdef=StructDouble,
                                   configurationkind=("property", ),
                                   mode="readwrite")

    class StructShort(object):
        structSimpleShort = simple_property(id_="structSimpleShort",
                                            name="structSimpleShort",
                                            type_="short",
                                            defvalue=987)

        structSimpleSeqShort = simpleseq_property(id_="structSimpleSeqShort",
                                                  name="structSimpleSeqShort",
                                                  type_="short",
                                                  defvalue=[876, 765, 654])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSimpleShort"] = self.structSimpleShort
            d["structSimpleSeqShort"] = self.structSimpleSeqShort
            return str(d)

        @classmethod
        def getId(cls):
            return "structShort"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSimpleShort", self.structSimpleShort),
                    ("structSimpleSeqShort", self.structSimpleSeqShort)]

    structShort = struct_property(id_="structShort",
                                  name="structShort",
                                  structdef=StructShort,
                                  configurationkind=("property", ),
                                  mode="readwrite")

    class StructSeqStructString(object):
        structSeqStructSimpleString = simple_property(
            id_="structSeqStructSimpleString",
            name="structSeqStructSimpleString",
            type_="string",
            defvalue="structSeqStructSimpleStringTest")

        structSeqStructSimpleSeqString = simpleseq_property(
            id_="structSeqStructSimpleSeqString",
            name="structSeqStructSimpleSeqString",
            type_="string",
            defvalue=[
                "structSeqStructSimpleStringTest1",
                "structSeqStructSimpleStringTest2",
                "structSeqStructSimpleStringTest3"
            ])

        def __init__(
            self,
            structSeqStructSimpleString="structSeqStructSimpleStringTest",
            structSeqStructSimpleSeqString=[
                "structSeqStructSimpleStringTest1",
                "structSeqStructSimpleStringTest2",
                "structSeqStructSimpleStringTest3"
            ]):
            self.structSeqStructSimpleString = structSeqStructSimpleString
            self.structSeqStructSimpleSeqString = structSeqStructSimpleSeqString

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSeqStructSimpleString"] = self.structSeqStructSimpleString
            d["structSeqStructSimpleSeqString"] = self.structSeqStructSimpleSeqString
            return str(d)

        @classmethod
        def getId(cls):
            return "structSeqStructString"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSeqStructSimpleString",
                     self.structSeqStructSimpleString),
                    ("structSeqStructSimpleSeqString",
                     self.structSeqStructSimpleSeqString)]

    structSeqString = structseq_property(
        id_="structSeqString",
        name="structSeqString",
        structdef=StructSeqStructString,
        defvalue=[
            StructSeqStructString(
                structSeqStructSimpleString="structSeqStructSimpleStringTest",
                structSeqStructSimpleSeqString=[
                    "structSeqStructSimpleStringTest1",
                    "structSeqStructSimpleStringTest2",
                    "structSeqStructSimpleStringTest3"
                ])
        ],
        configurationkind=("property", ),
        mode="readwrite")

    class StructSeqStructBool(object):
        structSeqStructSimpleBool = simple_property(
            id_="structSeqStructSimpleBool",
            name="structSeqStructSimpleBool",
            type_="boolean",
            defvalue=True)

        structSeqStructSimpleSeqBool = simpleseq_property(
            id_="structSeqStructSimpleSeqBool",
            name="structSeqStructSimpleSeqBool",
            type_="boolean",
            defvalue=[True, True, False])

        def __init__(self,
                     structSeqStructSimpleBool=True,
                     structSeqStructSimpleSeqBool=[True, True, False]):
            self.structSeqStructSimpleBool = structSeqStructSimpleBool
            self.structSeqStructSimpleSeqBool = structSeqStructSimpleSeqBool

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSeqStructSimpleBool"] = self.structSeqStructSimpleBool
            d["structSeqStructSimpleSeqBool"] = self.structSeqStructSimpleSeqBool
            return str(d)

        @classmethod
        def getId(cls):
            return "structSeqStructBool"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSeqStructSimpleBool",
                     self.structSeqStructSimpleBool),
                    ("structSeqStructSimpleSeqBool",
                     self.structSeqStructSimpleSeqBool)]

    structSeqBool = structseq_property(
        id_="structSeqBool",
        name="structSeqBool",
        structdef=StructSeqStructBool,
        defvalue=[
            StructSeqStructBool(
                structSeqStructSimpleBool=True,
                structSeqStructSimpleSeqBool=[True, True, False])
        ],
        configurationkind=("property", ),
        mode="readwrite")

    class StructSeqStructDouble(object):
        structSeqStructSimpleDouble = simple_property(
            id_="structSeqStructSimpleDouble",
            name="structSeqStructSimpleDouble",
            type_="double",
            defvalue=12.34)

        structSeqStructSimpleSeqDouble = simpleseq_property(
            id_="structSeqStructSimpleSeqDouble",
            name="structSeqStructSimpleSeqDouble",
            type_="double",
            defvalue=[
                23.449999999999999, 34.560000000000002, 45.670000000000002
            ])

        def __init__(self,
                     structSeqStructSimpleDouble=12.34,
                     structSeqStructSimpleSeqDouble=[
                         23.449999999999999, 34.560000000000002,
                         45.670000000000002
                     ]):
            self.structSeqStructSimpleDouble = structSeqStructSimpleDouble
            self.structSeqStructSimpleSeqDouble = structSeqStructSimpleSeqDouble

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSeqStructSimpleDouble"] = self.structSeqStructSimpleDouble
            d["structSeqStructSimpleSeqDouble"] = self.structSeqStructSimpleSeqDouble
            return str(d)

        @classmethod
        def getId(cls):
            return "structSeqStructDouble"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSeqStructSimpleDouble",
                     self.structSeqStructSimpleDouble),
                    ("structSeqStructSimpleSeqDouble",
                     self.structSeqStructSimpleSeqDouble)]

    structSeqDouble = structseq_property(
        id_="structSeqDouble",
        name="structSeqDouble",
        structdef=StructSeqStructDouble,
        defvalue=[
            StructSeqStructDouble(structSeqStructSimpleDouble=12.34,
                                  structSeqStructSimpleSeqDouble=[
                                      23.449999999999999, 34.560000000000002,
                                      45.670000000000002
                                  ])
        ],
        configurationkind=("property", ),
        mode="readwrite")

    class StructSeqStructShort(object):
        structSeqStructSimpleShort = simple_property(
            id_="structSeqStructSimpleShort",
            name="structSeqStructSimpleShort",
            type_="short",
            defvalue=12)

        structSeqStructSimpleSeqShort = simpleseq_property(
            id_="structSeqStructSimpleSeqShort",
            name="structSeqStructSimpleSeqShort",
            type_="short",
            defvalue=[23, 34, 45])

        def __init__(self,
                     structSeqStructSimpleShort=12,
                     structSeqStructSimpleSeqShort=[23, 34, 45]):
            self.structSeqStructSimpleShort = structSeqStructSimpleShort
            self.structSeqStructSimpleSeqShort = structSeqStructSimpleSeqShort

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSeqStructSimpleShort"] = self.structSeqStructSimpleShort
            d["structSeqStructSimpleSeqShort"] = self.structSeqStructSimpleSeqShort
            return str(d)

        @classmethod
        def getId(cls):
            return "structSeqStructShort"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("structSeqStructSimpleShort",
                     self.structSeqStructSimpleShort),
                    ("structSeqStructSimpleSeqShort",
                     self.structSeqStructSimpleSeqShort)]

    structSeqShort = structseq_property(
        id_="structSeqShort",
        name="structSeqShort",
        structdef=StructSeqStructShort,
        defvalue=[
            StructSeqStructShort(structSeqStructSimpleShort=12,
                                 structSeqStructSimpleSeqShort=[23, 34, 45])
        ],
        configurationkind=("property", ),
        mode="readwrite")
Ejemplo n.º 4
0
class TestPythonPropsRange_base(CF__POA.Resource, Resource):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self.threadControlLock = threading.RLock()
        self.process_thread = None
        # self.auto_start is deprecated and is only kept for API compatability
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False

    def initialize(self):
        Resource.initialize(self)

        # Instantiate the default implementations for all ports on this component

    def start(self):
        self.threadControlLock.acquire()
        try:
            Resource.start(self)
            if self.process_thread == None:
                self.process_thread = ProcessThread(target=self.process,
                                                    pause=self.PAUSE)
                self.process_thread.start()
        finally:
            self.threadControlLock.release()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        self.threadControlLock.acquire()
        try:
            process_thread = self.process_thread
            self.process_thread = None

            if process_thread != None:
                process_thread.stop()
                process_thread.join(self.TIMEOUT)
                if process_thread.isAlive():
                    raise CF.Resource.StopError(
                        CF.CF_NOTSET, "Processing thread did not die")
            Resource.stop(self)
        finally:
            self.threadControlLock.release()

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        self.threadControlLock.acquire()
        try:
            Resource.releaseObject(self)
        finally:
            self.threadControlLock.release()

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    my_octet_name = simple_property(id_="my_octet",
                                    name="my_octet_name",
                                    type_="octet",
                                    defvalue=1,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_short_name = simple_property(id_="my_short",
                                    name="my_short_name",
                                    type_="short",
                                    defvalue=2,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_ushort_name = simple_property(id_="my_ushort",
                                     name="my_ushort_name",
                                     type_="ushort",
                                     defvalue=3,
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    my_long_name = simple_property(id_="my_long",
                                   name="my_long_name",
                                   type_="long",
                                   defvalue=4,
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    my_ulong_name = simple_property(id_="my_ulong",
                                    name="my_ulong_name",
                                    type_="ulong",
                                    defvalue=5,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_longlong_name = simple_property(id_="my_longlong",
                                       name="my_longlong_name",
                                       type_="longlong",
                                       defvalue=6,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    my_ulonglong_name = simple_property(id_="my_ulonglong",
                                        name="my_ulonglong_name",
                                        type_="ulonglong",
                                        defvalue=7,
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    seq_octet_name = simpleseq_property(id_="seq_octet",
                                        name="seq_octet_name",
                                        type_="octet",
                                        defvalue="\x01\x02",
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    seq_short_name = simpleseq_property(id_="seq_short",
                                        name="seq_short_name",
                                        type_="short",
                                        defvalue=(1, 2),
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    seq_ushort_name = simpleseq_property(id_="seq_ushort",
                                         name="seq_ushort_name",
                                         type_="ushort",
                                         defvalue=(1, 2),
                                         mode="readwrite",
                                         action="external",
                                         kinds=("configure", ))
    seq_long_name = simpleseq_property(id_="seq_long",
                                       name="seq_long_name",
                                       type_="long",
                                       defvalue=(1, 2),
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    seq_ulong_name = simpleseq_property(id_="seq_ulong",
                                        name="seq_ulong_name",
                                        type_="ulong",
                                        defvalue=(1, 2),
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    seq_longlong_name = simpleseq_property(id_="seq_longlong",
                                           name="seq_longlong_name",
                                           type_="longlong",
                                           defvalue=(1, 2),
                                           mode="readwrite",
                                           action="external",
                                           kinds=("configure", ))
    seq_ulonglong_name = simpleseq_property(id_="seq_ulonglong",
                                            name="seq_ulonglong_name",
                                            type_="ulonglong",
                                            defvalue=(1, 2),
                                            mode="readwrite",
                                            action="external",
                                            kinds=("configure", ))
    seq_char_name = simpleseq_property(id_="seq_char",
                                       name="seq_char_name",
                                       type_="char",
                                       defvalue="ab",
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))

    class MyStructName(object):
        struct_octet_name = simple_property(
            id_="struct_octet",
            name="struct_octet_name",
            type_="octet",
            defvalue=1,
        )
        struct_short_name = simple_property(
            id_="struct_short",
            name="struct_short_name",
            type_="short",
            defvalue=2,
        )
        struct_ushort_name = simple_property(
            id_="struct_ushort",
            name="struct_ushort_name",
            type_="ushort",
            defvalue=3,
        )
        struct_long_name = simple_property(
            id_="struct_long",
            name="struct_long_name",
            type_="long",
            defvalue=4,
        )
        struct_ulong_name = simple_property(
            id_="struct_ulong",
            name="struct_ulong_name",
            type_="ulong",
            defvalue=5,
        )
        struct_longlong_name = simple_property(
            id_="struct_longlong",
            name="struct_longlong_name",
            type_="longlong",
            defvalue=6,
        )
        struct_ulonglong_name = simple_property(
            id_="struct_ulonglong",
            name="struct_ulonglong_name",
            type_="ulonglong",
            defvalue=7,
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["struct_octet_name"] = self.struct_octet_name
            d["struct_short_name"] = self.struct_short_name
            d["struct_ushort_name"] = self.struct_ushort_name
            d["struct_long_name"] = self.struct_long_name
            d["struct_ulong_name"] = self.struct_ulong_name
            d["struct_longlong_name"] = self.struct_longlong_name
            d["struct_ulonglong_name"] = self.struct_ulonglong_name
            return str(d)

        def getId(self):
            return "my_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("struct_octet_name", self.struct_octet_name),
                    ("struct_short_name", self.struct_short_name),
                    ("struct_ushort_name", self.struct_ushort_name),
                    ("struct_long_name", self.struct_long_name),
                    ("struct_ulong_name", self.struct_ulong_name),
                    ("struct_longlong_name", self.struct_longlong_name),
                    ("struct_ulonglong_name", self.struct_ulonglong_name)]

    my_struct_name = struct_property(id_="my_struct",
                                     name="my_struct_name",
                                     structdef=MyStructName,
                                     configurationkind=("configure", ),
                                     mode="readwrite")

    class SsStructName(object):
        ss_octet_name = simple_property(
            id_="ss_octet",
            name="ss_octet_name",
            type_="octet",
        )
        ss_short_name = simple_property(
            id_="ss_short",
            name="ss_short_name",
            type_="short",
        )
        ss_ushort_name = simple_property(
            id_="ss_ushort",
            name="ss_ushort_name",
            type_="ushort",
        )
        ss_long_name = simple_property(
            id_="ss_long",
            name="ss_long_name",
            type_="long",
        )
        ss_ulong_name = simple_property(
            id_="ss_ulong",
            name="ss_ulong_name",
            type_="ulong",
        )
        ss_longlong_name = simple_property(
            id_="ss_longlong",
            name="ss_longlong_name",
            type_="longlong",
        )
        ss_ulonglong_name = simple_property(
            id_="ss_ulonglong",
            name="ss_ulonglong_name",
            type_="ulonglong",
        )

        def __init__(self,
                     ss_octet_name=0,
                     ss_short_name=0,
                     ss_ushort_name=0,
                     ss_long_name=0,
                     ss_ulong_name=0,
                     ss_longlong_name=0,
                     ss_ulonglong_name=0):
            self.ss_octet_name = ss_octet_name
            self.ss_short_name = ss_short_name
            self.ss_ushort_name = ss_ushort_name
            self.ss_long_name = ss_long_name
            self.ss_ulong_name = ss_ulong_name
            self.ss_longlong_name = ss_longlong_name
            self.ss_ulonglong_name = ss_ulonglong_name

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["ss_octet_name"] = self.ss_octet_name
            d["ss_short_name"] = self.ss_short_name
            d["ss_ushort_name"] = self.ss_ushort_name
            d["ss_long_name"] = self.ss_long_name
            d["ss_ulong_name"] = self.ss_ulong_name
            d["ss_longlong_name"] = self.ss_longlong_name
            d["ss_ulonglong_name"] = self.ss_ulonglong_name
            return str(d)

        def getId(self):
            return "ss_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("ss_octet_name", self.ss_octet_name),
                    ("ss_short_name", self.ss_short_name),
                    ("ss_ushort_name", self.ss_ushort_name),
                    ("ss_long_name", self.ss_long_name),
                    ("ss_ulong_name", self.ss_ulong_name),
                    ("ss_longlong_name", self.ss_longlong_name),
                    ("ss_ulonglong_name", self.ss_ulonglong_name)]

    my_structseq_name = structseq_property(
        id_="my_structseq",
        name="my_structseq_name",
        structdef=SsStructName,
        defvalue=[
            SsStructName(0, 1, 2, 3, 4, 5, 6),
            SsStructName(7, 8, 9, 10, 11, 12, 13)
        ],
        configurationkind=("configure", ),
        mode="readwrite")
Ejemplo n.º 5
0
class TestPythonProps (CF__POA.Resource, Resource):
    """Python component for testing properties"""

    prop1 = simple_property(id_="DCE:b8f43ac8-26b5-40b3-9102-d127b84f9e4b",
                            name="string_prop",
                            type_="string",
                            action="external",
                            kinds=("configure",))

    prop2 = simpleseq_property(id_="DCE:10b3364d-f035-4639-8e7f-02ac4706f5c7[]",
                               name="stringseq_prop",
                               type_="string",
                               action="external",
                               kinds=("configure",))

    prop3 = simple_property(id_="test_float",
                            name="test_float",
                            type_="float",
                            action="external",
                            kinds=("configure",),
                            defvalue=1.234)

    prop4 = simple_property(id_="test_double",
                            name="test_double",
                            type_="double",
                            action="external",
                            kinds=("configure",),
                            defvalue=1.234)

    class SomeStruct(object):
        field1 = simple_property(id_="item1",
                type_="string",
                defvalue="value1")
        field2 = simple_property(id_="item2",
                type_="long",
                defvalue=100)
        field3 = simple_property(id_="item3",
                type_="double",
                defvalue=3.14156)
        field4 = simple_property(id_="item4",
                type_="float",
                defvalue=1.234)

    struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f", 
                            name="struct_test", 
                            structdef=SomeStruct)

    class MulticastAddress(object):
        ip_address = simple_property(id_="ip_address", type_="string")
        port = simple_property(id_="port", type_="ushort")

        def __init__(self, ip_address="", port=0):
            self.ip_address = ip_address
            self.port = port


    multicasts = structseq_property(id_="DCE:897a5489-f680-46a8-a698-e36fd8bbae80[]",
                                    name="multicasts",
                                    structdef=MulticastAddress,
                                    defvalue=[MulticastAddress("127.0.0.1", 6800), MulticastAddress("127.0.0.1", 42000)])

    def __init__(self, identifier, execparams):
        Resource.__init__(self, identifier, execparams)

    def runTest(self, test, props):
        if test == 0:
            # Inject values directly into property storage to allow testing of
            # bad conditions (invalid values)
            for dt in props:
                try:
                    self._props[dt.id] = from_any(dt.value)
                except KeyError:
                    pass
        return []
Ejemplo n.º 6
0
class PropertyComponent_base(CF__POA.Resource, Resource):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self.process_thread = None
        # self.auto_start is deprecated and is only kept for API compatability
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False

    def initialize(self):
        Resource.initialize(self)

        # Instantiate the default implementations for all ports on this component

        self.port_propEvent = PropertyEventSupplier(self)

    def start(self):
        Resource.start(self)
        if self.process_thread == None:
            self.process_thread = ProcessThread(target=self.process,
                                                pause=self.PAUSE)
            self.process_thread.start()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        # Technically not thread-safe but close enough for now
        process_thread = self.process_thread
        self.process_thread = None

        if process_thread != None:
            process_thread.stop()
            process_thread.join(self.TIMEOUT)
            if process_thread.isAlive():
                raise CF.Resource.StopError(CF.CF_NOTSET,
                                            "Processing thread did not die")
        Resource.stop(self)

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Resource.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    def compareSRI(self, a, b):
        if a.hversion != b.hversion:
            return False
        if a.xstart != b.xstart:
            return False
        if a.xdelta != b.xdelta:
            return False
        if a.xunits != b.xunits:
            return False
        if a.subsize != b.subsize:
            return False
        if a.ystart != b.ystart:
            return False
        if a.ydelta != b.ydelta:
            return False
        if a.yunits != b.yunits:
            return False
        if a.mode != b.mode:
            return False
        if a.streamID != b.streamID:
            return False
        if a.blocking != b.blocking:
            return False
        if len(a.keywords) != len(b.keywords):
            return False
        for keyA, keyB in zip(a.keywords, b.keywords):
            if keyA.value._t != keyB.value._t:
                return False
            if keyA.value._v != keyB.value._v:
                return False
        return True

    port_propEvent = usesport(
        name="propEvent",
        repid="IDL:omg.org/CosEventChannelAdmin/EventChannel:1.0",
        type_="responses",
    )

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    simplePropStr = simple_property(id_="simplePropStr",
                                    type_="string",
                                    defvalue="Hello",
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", "event"))
    simplePropBoolean = simple_property(id_="simplePropBoolean",
                                        type_="boolean",
                                        defvalue=True,
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    simplePropUlong = simple_property(id_="simplePropUlong",
                                      type_="ulong",
                                      defvalue=1,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    simplePropObjRef = simple_property(id_="simplePropObjRef",
                                       type_="objref",
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    simplePropShort = simple_property(id_="simplePropShort",
                                      type_="short",
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    simplePropFloat = simple_property(id_="simplePropFloat",
                                      type_="float",
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    simplePropOctet = simple_property(id_="simplePropOctet",
                                      type_="octet",
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    simplePropChar = simple_property(id_="simplePropChar",
                                     type_="char",
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    simplePropUShort = simple_property(id_="simplePropUShort",
                                       type_="ushort",
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    simplePropDouble = simple_property(id_="simplePropDouble",
                                       type_="double",
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    simplePropLong = simple_property(id_="simplePropLong",
                                     type_="long",
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    simplePropLongLong = simple_property(id_="simplePropLongLong",
                                         type_="longlong",
                                         mode="readwrite",
                                         action="external",
                                         kinds=("configure", ))
    simplePropUlonglong = simple_property(id_="simplePropUlonglong",
                                          type_="ulonglong",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure", ))
    simpleEnum = simple_property(id_="simpleEnum",
                                 type_="string",
                                 defvalue="hello",
                                 mode="readwrite",
                                 action="external",
                                 kinds=("configure", ))
    simpleReadOnly = simple_property(id_="simpleReadOnly",
                                     type_="string",
                                     defvalue="READ ONLY VALUE",
                                     mode="readonly",
                                     action="external",
                                     kinds=("configure", ))
    seqPropStr = simpleseq_property(id_="seqPropStr",
                                    type_="string",
                                    defvalue=("test", "test1", "test3"),
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    seqPropBoolean = simpleseq_property(id_="seqPropBoolean",
                                        type_="boolean",
                                        defvalue=None,
                                        mode="readwrite",
                                        action="external",
                                        kinds=("configure", ))
    seqPropULong = simpleseq_property(id_="seqPropULong",
                                      type_="ulong",
                                      defvalue=None,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    seqPropObjRef = simpleseq_property(id_="seqPropObjRef",
                                       type_="objref",
                                       defvalue=None,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    seqPropShort = simpleseq_property(id_="seqPropShort",
                                      type_="short",
                                      defvalue=None,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    seqPropFloat = simpleseq_property(id_="seqPropFloat",
                                      type_="float",
                                      defvalue=None,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    seqPropOctet = simpleseq_property(id_="seqPropOctet",
                                      type_="octet",
                                      defvalue=None,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    seqPropChar = simpleseq_property(id_="seqPropChar",
                                     type_="char",
                                     defvalue=None,
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    seqPropUShort = simpleseq_property(id_="seqPropUShort",
                                       type_="ushort",
                                       defvalue=None,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    seqPropDouble = simpleseq_property(id_="seqPropDouble",
                                       type_="double",
                                       defvalue=None,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    seqPropLong = simpleseq_property(id_="seqPropLong",
                                     type_="long",
                                     defvalue=None,
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    seqPropLongLong = simpleseq_property(id_="seqPropLongLong",
                                         type_="longlong",
                                         defvalue=None,
                                         mode="readwrite",
                                         action="external",
                                         kinds=("configure", ))
    seqPropulonglong = simpleseq_property(id_="seqPropulonglong",
                                          type_="ulonglong",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure", ))

    class StructProp(object):
        structSimpleStr = simple_property(
            id_="structSimpleStr",
            type_="string",
        )
        structSimpleBoolean = simple_property(
            id_="structSimpleBoolean",
            type_="boolean",
        )
        structSimpleulong = simple_property(
            id_="structSimpleulong",
            type_="ulong",
        )
        structSimpleObjRef = simple_property(
            id_="structSimpleObjRef",
            type_="objref",
        )
        structSimpleShort = simple_property(
            id_="structSimpleShort",
            type_="short",
        )
        structSimpleFloat = simple_property(
            id_="structSimpleFloat",
            type_="float",
        )
        structSimpleOctet = simple_property(
            id_="structSimpleOctet",
            type_="octet",
        )
        structSimpleChar = simple_property(
            id_="structSimpleChar",
            type_="char",
        )
        structSimpleushort = simple_property(
            id_="structSimpleushort",
            type_="ushort",
        )
        structSimpledouble = simple_property(
            id_="structSimpledouble",
            type_="double",
        )
        structSimplelong = simple_property(
            id_="structSimplelong",
            type_="long",
        )
        structSimplelonglong = simple_property(
            id_="structSimplelonglong",
            type_="longlong",
        )
        structSimpleulonglong = simple_property(
            id_="structSimpleulonglong",
            type_="ulonglong",
        )
        structSimpleEnum = simple_property(
            id_="structSimpleEnum",
            type_="double",
            defvalue=1.5,
        )

        def __init__(self):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSimpleStr"] = self.structSimpleStr
            d["structSimpleBoolean"] = self.structSimpleBoolean
            d["structSimpleulong"] = self.structSimpleulong
            d["structSimpleObjRef"] = self.structSimpleObjRef
            d["structSimpleShort"] = self.structSimpleShort
            d["structSimpleFloat"] = self.structSimpleFloat
            d["structSimpleOctet"] = self.structSimpleOctet
            d["structSimpleChar"] = self.structSimpleChar
            d["structSimpleushort"] = self.structSimpleushort
            d["structSimpledouble"] = self.structSimpledouble
            d["structSimplelong"] = self.structSimplelong
            d["structSimplelonglong"] = self.structSimplelonglong
            d["structSimpleulonglong"] = self.structSimpleulonglong
            d["structSimpleEnum"] = self.structSimpleEnum
            return str(d)

        def getId(self):
            return "structProp"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("structSimpleStr", self.structSimpleStr),
                    ("structSimpleBoolean", self.structSimpleBoolean),
                    ("structSimpleulong", self.structSimpleulong),
                    ("structSimpleObjRef", self.structSimpleObjRef),
                    ("structSimpleShort", self.structSimpleShort),
                    ("structSimpleFloat", self.structSimpleFloat),
                    ("structSimpleOctet", self.structSimpleOctet),
                    ("structSimpleChar", self.structSimpleChar),
                    ("structSimpleushort", self.structSimpleushort),
                    ("structSimpledouble", self.structSimpledouble),
                    ("structSimplelong", self.structSimplelong),
                    ("structSimplelonglong", self.structSimplelonglong),
                    ("structSimpleulonglong", self.structSimpleulonglong),
                    ("structSimpleEnum", self.structSimpleEnum)]

    structProp = struct_property(id_="structProp",
                                 structdef=StructProp,
                                 configurationkind=("configure", ),
                                 mode="readwrite")

    class StructSeq(object):
        structSeqSimple = simple_property(
            id_="structSeqSimple",
            type_="string",
        )
        structSeqSimpleBoolean = simple_property(
            id_="structSeqSimpleBoolean",
            type_="boolean",
        )
        structSeqSimpleUlong = simple_property(
            id_="structSeqSimpleUlong",
            type_="ulong",
        )
        structSeqSimpleObjecRef = simple_property(
            id_="structSeqSimpleObjecRef",
            type_="objref",
        )
        structSeqSimpleShort = simple_property(
            id_="structSeqSimpleShort",
            type_="short",
        )
        structSeqFloat = simple_property(
            id_="structSeqFloat",
            type_="float",
        )
        structSeqSimpleOctet = simple_property(
            id_="structSeqSimpleOctet",
            type_="octet",
        )
        structSeqSimpleChar = simple_property(
            id_="structSeqSimpleChar",
            type_="char",
        )
        structSeqSimpleushort = simple_property(
            id_="structSeqSimpleushort",
            type_="ushort",
        )
        structSeqSimpleDouble = simple_property(
            id_="structSeqSimpleDouble",
            type_="double",
        )
        structSeqSimpleLong = simple_property(
            id_="structSeqSimpleLong",
            type_="long",
        )
        structSeqSimpleLongLong = simple_property(
            id_="structSeqSimpleLongLong",
            type_="longlong",
        )
        structSeqSimpleULongLong = simple_property(
            id_="structSeqSimpleULongLong",
            type_="ulonglong",
        )
        structSeqSimpleEnum = simple_property(
            id_="structSeqSimpleEnum",
            type_="string",
            defvalue="3",
        )

        def __init__(self,
                     structSeqSimple="",
                     structSeqSimpleBoolean=False,
                     structSeqSimpleUlong=0,
                     structSeqSimpleObjecRef="",
                     structSeqSimpleShort=0,
                     structSeqFloat=0,
                     structSeqSimpleOctet=0,
                     structSeqSimpleChar="",
                     structSeqSimpleushort=0,
                     structSeqSimpleDouble=0,
                     structSeqSimpleLong=0,
                     structSeqSimpleLongLong=0,
                     structSeqSimpleULongLong=0,
                     structSeqSimpleEnum=""):
            self.structSeqSimple = structSeqSimple
            self.structSeqSimpleBoolean = structSeqSimpleBoolean
            self.structSeqSimpleUlong = structSeqSimpleUlong
            self.structSeqSimpleObjecRef = structSeqSimpleObjecRef
            self.structSeqSimpleShort = structSeqSimpleShort
            self.structSeqFloat = structSeqFloat
            self.structSeqSimpleOctet = structSeqSimpleOctet
            self.structSeqSimpleChar = structSeqSimpleChar
            self.structSeqSimpleushort = structSeqSimpleushort
            self.structSeqSimpleDouble = structSeqSimpleDouble
            self.structSeqSimpleLong = structSeqSimpleLong
            self.structSeqSimpleLongLong = structSeqSimpleLongLong
            self.structSeqSimpleULongLong = structSeqSimpleULongLong
            self.structSeqSimpleEnum = structSeqSimpleEnum

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["structSeqSimple"] = self.structSeqSimple
            d["structSeqSimpleBoolean"] = self.structSeqSimpleBoolean
            d["structSeqSimpleUlong"] = self.structSeqSimpleUlong
            d["structSeqSimpleObjecRef"] = self.structSeqSimpleObjecRef
            d["structSeqSimpleShort"] = self.structSeqSimpleShort
            d["structSeqFloat"] = self.structSeqFloat
            d["structSeqSimpleOctet"] = self.structSeqSimpleOctet
            d["structSeqSimpleChar"] = self.structSeqSimpleChar
            d["structSeqSimpleushort"] = self.structSeqSimpleushort
            d["structSeqSimpleDouble"] = self.structSeqSimpleDouble
            d["structSeqSimpleLong"] = self.structSeqSimpleLong
            d["structSeqSimpleLongLong"] = self.structSeqSimpleLongLong
            d["structSeqSimpleULongLong"] = self.structSeqSimpleULongLong
            d["structSeqSimpleEnum"] = self.structSeqSimpleEnum
            return str(d)

        def getId(self):
            return "structSeqStruct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("structSeqSimple", self.structSeqSimple),
                    ("structSeqSimpleBoolean", self.structSeqSimpleBoolean),
                    ("structSeqSimpleUlong", self.structSeqSimpleUlong),
                    ("structSeqSimpleObjecRef", self.structSeqSimpleObjecRef),
                    ("structSeqSimpleShort", self.structSeqSimpleShort),
                    ("structSeqFloat", self.structSeqFloat),
                    ("structSeqSimpleOctet", self.structSeqSimpleOctet),
                    ("structSeqSimpleChar", self.structSeqSimpleChar),
                    ("structSeqSimpleushort", self.structSeqSimpleushort),
                    ("structSeqSimpleDouble", self.structSeqSimpleDouble),
                    ("structSeqSimpleLong", self.structSeqSimpleLong),
                    ("structSeqSimpleLongLong", self.structSeqSimpleLongLong),
                    ("structSeqSimpleULongLong",
                     self.structSeqSimpleULongLong),
                    ("structSeqSimpleEnum", self.structSeqSimpleEnum)]

    structSeq = structseq_property(id_="structSeq",
                                   structdef=StructSeq,
                                   defvalue=[],
                                   configurationkind=("configure", ),
                                   mode="readwrite")
Ejemplo n.º 7
0
class BasicTestDevice(CF__POA.AggregateExecutableDevice, ExecutableDevice,
                      AggregateDevice):
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)
        self._props["memCapacity"] = 100000000
        self._props["BogoMipsCapacity"] = 100000000
        self._props["nicCapacity"] = 100.0
        self._props["fakeCapacity"] = 3
        self._props["execparams"] = " ".join(
            ["%s %s" % x for x in execparams.items()])

    def initialize(self):
        # change the no_default_prop to be not None to ensure that the device manager
        # doesn't configure properties with no value (i.e. test_NoConfigureNilDeviceProperties)
        self._props["no_default_prop"] = "not_none"

    def execute(self, name, options, parameters):
        retval = ExecutableDevice.execute(self, name, options, parameters)
        for option in options:
            if option.id == 'STACK_SIZE':
                self._props['check_STACK_SIZE'] = option.value._v
            elif option.id == 'PRIORITY':
                self._props['check_PRIORITY'] = option.value._v
        return retval

    # See BasicChildDevice for an example of manually dealing with allocate/deallocate
    def allocate_fakeCapacity(self, value):
        if self._props["fakeCapacity"] < value:
            return False
        self._props["fakeCapacity"] = self._props["fakeCapacity"] - value
        return True

    def allocate_nicCapacity(self, value):
        if self._props["nicCapacity"] < value:
            return False
        self._props["nicCapacity"] = self._props["nicCapacity"] - value
        return True

    def allocate_memCapacity(self, value):
        if self._props["memCapacity"] < value:
            return False
        self._props["memCapacity"] = self._props["memCapacity"] - value
        return True

    def allocate_BogoMipsCapacity(self, value):
        if self._props["BogoMipsCapacity"] < value:
            return False
        self._props[
            "BogoMipsCapacity"] = self._props["BogoMipsCapacity"] - value
        return True

    def deallocate_fakeCapacity(self, value):
        self._props["fakeCapacity"] = self._props["fakeCapacity"] + value

    def deallocate_nicCapacity(self, value):
        self._props["nicCapacity"] = self._props["nicCapacity"] + value

    def deallocate_memCapacity(self, value):
        self._props["memCapacity"] = self._props["memCapacity"] + value

    def deallocate_BogoMipsCapacity(self, value):
        self._props[
            "BogoMipsCapacity"] = self._props["BogoMipsCapacity"] + value

    def allocate_allocStruct(self, value):
        if value > self.allocStruct:
            return False

        self.allocStruct -= value
        return True

    def deallocate_allocStruct(self, value):
        self.allocStruct += value

    def allocate_passwordStruct(self, value):
        if value == self.passwordStruct:
            return True
        else:
            self._log.error("Wrong allocation property value")

    def updateUsageState(self):
        # Update usage state
        if self._props["memCapacity"] == 0 and self._props[
                "BogoMipsCapacity"] == 0:
            self._usageState = CF.Device.BUSY
        elif self._props["memCapacity"] == 100000000 and self._props[
                "BogoMipsCapacity"] == 100000000:
            self._usageState = CF.Device.IDLE
        else:
            self._usageState = CF.Device.ACTIVE

    class SomeStruct(object):
        field1 = simple_property(id_="item1",
                                 type_="string",
                                 defvalue="value1")
        field2 = simple_property(id_="item2", type_="long", defvalue=100)
        field3 = simple_property(id_="item3", type_="double", defvalue=3.14156)

    struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f",
                             name="struct_test",
                             structdef=SomeStruct)

    class PasswordStruct(object):
        password = simple_property(id_="password",
                                   type_="string",
                                   defvalue="abracadabra")

        def __eq__(self, other):
            return self.password == other.password

    passwordStruct = struct_property(
        id_="DCE:a5a6ab83-d2a8-4350-ac4d-05b40ee93838",
        name="passwordStruct",
        configurationkind=("allocation"),
        structdef=PasswordStruct)

    class AllocStruct(object):
        long_capacity = simple_property(id_="long_capacity",
                                        type_="long",
                                        defvalue=100)
        float_capacity = simple_property(id_="float_capacity",
                                         type_="float",
                                         defvalue=1.0)
        struct_simple_seq = simpleseq_property(id_="struct_simple_seq",
                                               type_="short",
                                               defvalue=[50, 500])

        def __gt__(self, other):
            return (self.long_capacity > other.long_capacity
                    or self.float_capacity > other.float_capacity)

        def __iadd__(self, other):
            self.long_capacity += other.long_capacity
            self.float_capacity += other.float_capacity
            self.struct_simple_seq[0] += other.struct_simple_seq[0]
            self.struct_simple_seq[1] += other.struct_simple_seq[1]
            return self

        def __isub__(self, other):
            self.long_capacity -= other.long_capacity
            self.float_capacity -= other.float_capacity
            self.struct_simple_seq[0] -= other.struct_simple_seq[0]
            self.struct_simple_seq[1] -= other.struct_simple_seq[1]
            return self

    allocStruct = struct_property(
        id_="DCE:001fad60-b4b3-4ed2-94cb-40e1d956bf4f",
        name="allocStruct",
        configurationkind=("configure", "allocation"),
        structdef=AllocStruct)

    structseq = structseq_property(
        id_="DCE:e836f007-5821-4671-b05a-e0ff5147fe86",
        name="structseq_test",
        structdef=SomeStruct,
        defvalue=[])

    hex_props = simpleseq_property(id_="hex_props",
                                   name="hex_props",
                                   type_='short',
                                   defvalue=(0x01, 0x02))
class comp_prop_special_char_base(CF__POA.Resource, Component,
                                  ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    class MyBase(object):
        my_element = simple_property(id_="my:element",
                                     type_="string",
                                     defvalue="foo")

        my_stuff = simple_property(id_="my.stuff",
                                   type_="string",
                                   defvalue="bar")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["my_element"] = self.my_element
            d["my_stuff"] = self.my_stuff
            return str(d)

        @classmethod
        def getId(cls):
            return "my:base"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("my_element", self.my_element),
                    ("my_stuff", self.my_stuff)]

    my_base = struct_property(id_="my:base",
                              structdef=MyBase,
                              configurationkind=("property", ),
                              mode="readwrite")

    class MyStr(object):
        my_seq_my_str_my_prop = simple_property(id_="my_seq:my_str:my_prop",
                                                type_="string",
                                                defvalue="qwe")

        def __init__(self, my_seq_my_str_my_prop="qwe"):
            self.my_seq_my_str_my_prop = my_seq_my_str_my_prop

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["my_seq_my_str_my_prop"] = self.my_seq_my_str_my_prop
            return str(d)

        @classmethod
        def getId(cls):
            return "my:str"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("my_seq_my_str_my_prop", self.my_seq_my_str_my_prop)]

    my_seq = structseq_property(id_="my:seq",
                                structdef=MyStr,
                                defvalue=[],
                                configurationkind=("property", ),
                                mode="readwrite")
                               description="""This specifies the device kind"""
                               )
 device_model = simple_property(id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
                                name="device_model",
                                type_="string",
                                defvalue="RX_DIGITIZER simulator",
                                mode="readonly",
                                action="eq",
                                kinds=("allocation","configure"),
                                description=""" This specifies the specific device"""
                                )
 
 frontend_tuner_allocation = struct_property(id_="FRONTEND::tuner_allocation",
                                             name="frontend_tuner_allocation",
                                             structdef=FrontendTunerAllocation,
                                             configurationkind=("allocation",),
                                             mode="readwrite",
                                             description="""Frontend Interfaces v2.0 main allocation structure"""
                                             )
 frontend_listener_allocation = struct_property(id_="FRONTEND::listener_allocation",
                                                name="frontend_listener_allocation",
                                                structdef=FrontendListenerAllocation,
                                                configurationkind=("allocation",),
                                                mode="readwrite",
                                                description="""Allocates a listener (subscriber) based off a previous allocation """
                                                )
 class SimTunerAllocation(object):
     action = simple_property(id_="SIM::tuner_allocation::action",
                              name="action",
                              type_="string",
                              defvalue="NONE",
Ejemplo n.º 10
0
class CommandWrapperSubProcess_i(CF__POA.Resource, Resource):
    """This component simply ensures that all other components in the waveform get started and
    stopped together."""

    # The signal to send and the number of seconds (max) to wait
    # for the process to actually exit before trying the next signals.
    # None means wait until the process dies (which we have to do to
    # avoid creating zombie processes
    STOP_SIGNALS = ((signal.SIGINT, 1), (signal.SIGTERM, 5), (signal.SIGKILL,
                                                              None))

    def __init__(self, identifier, execparams):
        loggerName = execparams['NAME_BINDING'].replace('/', '.')
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self._pid = None
        self.execparams = " ".join(["%s %s" % x for x in execparams.items()])
        command = "python"
        args = [
            command,
            "components/CommandWrapperSubProcess/executables/FirstChild.py"
        ]
        sp = subprocess.Popen(args, executable=command, cwd=os.getcwd())

    #####################################
    # Implement the Resource interface
    def start(self):
        pass

    def stop(self):
        pass

    ######################################
    # Implement specific property setters/getters
    def get_commandAlive(self):
        if self._pid != None:
            try:
                os.kill(self._pid, 0)
                if os.waitpid(self._pid, os.WNOHANG) == (0, 0):
                    return True
                else:
                    return False
            except OSError:
                pass
        return False

    command = simple_property(\
        id_='DCE:a4e7b230-1d17-4a86-aeff-ddc6ea3df26e',
        type_="string",
        name="command",
        defvalue="/bin/echo")

    commandAlive = simple_property(\
        id_='DCE:95f19cb8-679e-48fb-bece-dc199ef45f20',
        type_="boolean",
        name="commandAlive",
        defvalue=False,
        mode="readonly",
        fget=get_commandAlive)

    someprop = simple_property(\
        id_='DCE:fa8c5924-845c-484a-81df-7941f2c5baa9',
        type_="long",
        name="someprop",
        defvalue=10)

    someprop2 = simple_property(\
        id_='DCE:cf623573-a09d-4fb1-a2ae-24b0b507115d',
        type_="double",
        name="someprop2",
        defvalue=50.0)

    someprop3 = simple_property(\
        id_='DCE:6ad84383-49cf-4017-b7ca-0ec4c4917952',
        type_="double",
        name="someprop3")

    execparams = simple_property(\
        id_='DCE:85d133fd-1658-4e4d-b3ff-1443cd44c0e2',
        type_="string",
        name="execparams")

    execparam1 = simple_property(\
        id_='EXEC_PARAM_1',
        type_="string",
        name="Parameter 1",
        defvalue="Test1",
        kinds=("execparam"))

    execparam2 = simple_property(\
        id_='EXEC_PARAM_2',
        type_="long",
        name="Parameter 2",
        defvalue=2,
        kinds=("execparam"))

    execparam3 = simple_property(\
        id_='EXEC_PARAM_3',
        type_="float",
        name="Parameter 3",
        defvalue=3.125,
        kinds=("execparam"),
        mode="readonly")

    someobjref = simple_property(\
        id_='SOMEOBJREF',
        type_="objref",
        name="Object Ref",
        defvalue=None,
        kinds=("execparam"),
        mode="writeonly")

    someobjref = simpleseq_property(\
        id_='DCE:5d8bfe8d-bc25-4f26-8144-248bc343aa53',
        type_="string",
        name="args",
        defvalue=("Hello World",))

    somelonglongprop = simple_property(\
        id_='DCE:a7de97ee-1e78-45e9-8e2b-204c141656fc',
        type_="longlong",
        name="somelonglongprop",
        defvalue=12345678901)

    somelonglongprop2 = simple_property(\
        id_='DCE:9ec6e2ff-6a4f-4452-8f38-4df47d6eebc1',
        type_="longlong",
        name="somelonglongprop2",
        defvalue=12345678901)

    class SomeStruct(object):
        field1 = simple_property(id_="item1",
                                 type_="string",
                                 defvalue="value1")
        field2 = simple_property(id_="item2", type_="long", defvalue=100)
        field3 = simple_property(id_="item3", type_="double", defvalue=3.14156)

    struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f",
                             name="struct_test",
                             structdef=SomeStruct)
Ejemplo n.º 11
0
class PropertyApi_base(CF__POA.Resource, Component, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component
        self.port_dataFloat_in = bulkio.InFloatPort(
            "dataFloat_in", maxsize=self.DEFAULT_QUEUE_SIZE)
        self.port_dataFloat_in._portLog = self._baseLog.getChildLogger(
            'dataFloat_in', 'ports')
        self.port_dataFloat_out = bulkio.OutFloatPort("dataFloat_out")
        self.port_dataFloat_out._portLog = self._baseLog.getChildLogger(
            'dataFloat_out', 'ports')

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._baseLog.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    port_dataFloat_in = providesport(name="dataFloat_in",
                                     repid="IDL:BULKIO/dataFloat:1.0",
                                     type_="data")

    port_dataFloat_out = usesport(name="dataFloat_out",
                                  repid="IDL:BULKIO/dataFloat:1.0",
                                  type_="data")

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    simp_seq_c = simpleseq_property(id_="simp_seq_c",
                                    name="simp_seq_c",
                                    type_="string",
                                    defvalue=["c_1", "c_2"],
                                    mode="readwrite",
                                    action="external",
                                    kinds=("property", ))

    simp_seq_d = simpleseq_property(id_="simp_seq_d",
                                    name="simp_seq_d",
                                    type_="string",
                                    defvalue=["d_1", "d_2"],
                                    mode="readwrite",
                                    action="external",
                                    kinds=("property", ))

    class StructA(object):
        simple_a = simple_property(id_="struct_a::simple_a",
                                   name="simple_a",
                                   type_="string",
                                   defvalue="simp_a")

        simpseq_a1 = simpleseq_property(id_="struct_a::simpseq_a1",
                                        name="simpseq_a1",
                                        type_="string",
                                        defvalue=["a1_1", "a2_2"])

        simpseq_a2 = simpleseq_property(id_="struct_a::simpseq_a2",
                                        name="simpseq_a2",
                                        type_="string",
                                        defvalue=[])

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["simple_a"] = self.simple_a
            d["simpseq_a1"] = self.simpseq_a1
            d["simpseq_a2"] = self.simpseq_a2
            return str(d)

        @classmethod
        def getId(cls):
            return "struct_a"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("simple_a", self.simple_a),
                    ("simpseq_a1", self.simpseq_a1),
                    ("simpseq_a2", self.simpseq_a2)]

    struct_a = struct_property(id_="struct_a",
                               name="struct_a",
                               structdef=StructA,
                               configurationkind=("property", ),
                               mode="readwrite")

    class StructB(object):
        simple_b = simple_property(id_="struct_seq_b::simple_b",
                                   name="simple_b",
                                   type_="string",
                                   defvalue="simp_b")

        simp_seq_b1 = simpleseq_property(id_="struct_seq_b::simp_seq_b1",
                                         name="simp_seq_b1",
                                         type_="string",
                                         defvalue=[])

        simp_seq_b2 = simpleseq_property(id_="struct_seq_b::simp_seq_b2",
                                         name="simp_seq_b2",
                                         type_="string",
                                         defvalue=["b2_1", "b2_2"])

        def __init__(self,
                     simple_b="simp_b",
                     simp_seq_b1=[],
                     simp_seq_b2=["b2_1", "b2_2"]):
            self.simple_b = simple_b
            self.simp_seq_b1 = simp_seq_b1
            self.simp_seq_b2 = simp_seq_b2

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["simple_b"] = self.simple_b
            d["simp_seq_b1"] = self.simp_seq_b1
            d["simp_seq_b2"] = self.simp_seq_b2
            return str(d)

        @classmethod
        def getId(cls):
            return "struct_seq_b::struct_b"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("simple_b", self.simple_b),
                    ("simp_seq_b1", self.simp_seq_b1),
                    ("simp_seq_b2", self.simp_seq_b2)]

    struct_seq_b = structseq_property(id_="struct_seq_b",
                                      name="struct_seq_b",
                                      structdef=StructB,
                                      defvalue=[
                                          StructB(simple_b="simp_b",
                                                  simp_seq_b1=[""],
                                                  simp_seq_b2=["b2_1", "b2_2"])
                                      ],
                                      configurationkind=("property", ),
                                      mode="readwrite")

    class StructE(object):
        simple_e = simple_property(id_="struct_seq_e::simple_e",
                                   name="simple_e",
                                   type_="string",
                                   defvalue="simp_e")

        simpseq_e1 = simpleseq_property(id_="struct_seq_e::simpseq_e1",
                                        name="simpseq_e1",
                                        type_="string",
                                        defvalue=["e1_1", "e1_2"])

        simpseq_e2 = simpleseq_property(id_="struct_seq_e::simpseq_e2",
                                        name="simpseq_e2",
                                        type_="string",
                                        defvalue=[])

        def __init__(self,
                     simple_e="simp_e",
                     simpseq_e1=["e1_1", "e1_2"],
                     simpseq_e2=[]):
            self.simple_e = simple_e
            self.simpseq_e1 = simpseq_e1
            self.simpseq_e2 = simpseq_e2

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["simple_e"] = self.simple_e
            d["simpseq_e1"] = self.simpseq_e1
            d["simpseq_e2"] = self.simpseq_e2
            return str(d)

        @classmethod
        def getId(cls):
            return "struct_seq_e::struct_e"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("simple_e", self.simple_e),
                    ("simpseq_e1", self.simpseq_e1),
                    ("simpseq_e2", self.simpseq_e2)]

    struct_seq_e = structseq_property(id_="struct_seq_e",
                                      name="struct_seq_e",
                                      structdef=StructE,
                                      defvalue=[
                                          StructE(simple_e="simp_e",
                                                  simpseq_e1=["e1_1", "e1_2"],
                                                  simpseq_e2=[""]),
                                          StructE(simple_e="simp_e",
                                                  simpseq_e1=["e1_1", "e1_2"],
                                                  simpseq_e2=[""])
                                      ],
                                      configurationkind=("property", ),
                                      mode="readwrite")
class TestPythonOptionalProps_base(CF__POA.Resource, Component,
                                   ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    def runTest(self, testid, properties):
        if testid == 0:
            return self.testOptional(properties)
        return []

    def testOptional(self, props):
        # Return optional properties that are currently set
        retProps = []
        for prop in props:
            if not prop:
                retProps.append(prop)
        return retProps

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    class MyStructName(object):
        struct_octet_name = simple_property(id_="struct_octet",
                                            name="struct_octet_name",
                                            type_="octet",
                                            optional=True)

        struct_short_name = simple_property(id_="struct_short",
                                            name="struct_short_name",
                                            type_="short",
                                            optional=True)

        struct_ushort_name = simple_property(id_="struct_ushort",
                                             name="struct_ushort_name",
                                             type_="ushort",
                                             optional=True)

        struct_long_name = simple_property(id_="struct_long",
                                           name="struct_long_name",
                                           type_="long",
                                           optional=True)

        struct_ulong_name = simple_property(id_="struct_ulong",
                                            name="struct_ulong_name",
                                            type_="ulong",
                                            optional=True)

        struct_longlong_name = simple_property(id_="struct_longlong",
                                               name="struct_longlong_name",
                                               type_="longlong",
                                               optional=True)

        struct_ulonglong_name = simple_property(id_="struct_ulonglong",
                                                name="struct_ulonglong_name",
                                                type_="ulonglong",
                                                optional=True)

        struct_string_name = simple_property(id_="struct_string",
                                             name="struct_string_name",
                                             type_="string",
                                             optional=True)

        struct_seq_octet_name = simpleseq_property(
            id_="struct_seq_octet",
            name="struct_seq_octet_name",
            type_="octet",
            optional=True)

        struct_seq_short_name = simpleseq_property(
            id_="struct_seq_short",
            name="struct_seq_short_name",
            type_="short",
            optional=True)

        struct_seq_ushort_name = simpleseq_property(
            id_="struct_seq_ushort",
            name="struct_seq_ushort_name",
            type_="ushort",
            optional=True)

        struct_seq_long_name = simpleseq_property(id_="struct_seq_long",
                                                  name="struct_seq_long_name",
                                                  type_="long",
                                                  optional=True)

        struct_seq_ulong_name = simpleseq_property(
            id_="struct_seq_ulong",
            name="struct_seq_ulong_name",
            type_="ulong",
            optional=True)

        struct_seq_longlong_name = simpleseq_property(
            id_="struct_seq_longlong",
            name="struct_seq_longlong_name",
            type_="longlong",
            optional=True)

        struct_seq_ulonglong_name = simpleseq_property(
            id_="struct_seq_ulonglong",
            name="struct_seq_ulonglong_name",
            type_="ulonglong",
            optional=True)

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property or type(
                        classattr) == simpleseq_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["struct_octet_name"] = self.struct_octet_name
            d["struct_short_name"] = self.struct_short_name
            d["struct_ushort_name"] = self.struct_ushort_name
            d["struct_long_name"] = self.struct_long_name
            d["struct_ulong_name"] = self.struct_ulong_name
            d["struct_longlong_name"] = self.struct_longlong_name
            d["struct_ulonglong_name"] = self.struct_ulonglong_name
            d["struct_string_name"] = self.struct_string_name
            d["struct_seq_octet_name"] = self.struct_seq_octet_name
            d["struct_seq_short_name"] = self.struct_seq_short_name
            d["struct_seq_ushort_name"] = self.struct_seq_ushort_name
            d["struct_seq_long_name"] = self.struct_seq_long_name
            d["struct_seq_ulong_name"] = self.struct_seq_ulong_name
            d["struct_seq_longlong_name"] = self.struct_seq_longlong_name
            d["struct_seq_ulonglong_name"] = self.struct_seq_ulonglong_name
            return str(d)

        def getId(self):
            return "my_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [
                ("struct_octet_name", self.struct_octet_name),
                ("struct_short_name", self.struct_short_name),
                ("struct_ushort_name", self.struct_ushort_name),
                ("struct_long_name", self.struct_long_name),
                ("struct_ulong_name", self.struct_ulong_name),
                ("struct_longlong_name", self.struct_longlong_name),
                ("struct_ulonglong_name", self.struct_ulonglong_name),
                ("struct_string_name", self.struct_string_name),
                ("struct_seq_octet_name", self.struct_seq_octet_name),
                ("struct_seq_short_name", self.struct_seq_short_name),
                ("struct_seq_ushort_name", self.struct_seq_ushort_name),
                ("struct_seq_long_name", self.struct_seq_long_name),
                ("struct_seq_ulong_name", self.struct_seq_ulong_name),
                ("struct_seq_longlong_name", self.struct_seq_longlong_name),
                ("struct_seq_ulonglong_name", self.struct_seq_ulonglong_name)
            ]

    my_struct_name = struct_property(id_="my_struct",
                                     name="my_struct_name",
                                     structdef=MyStructName,
                                     configurationkind=("configure", ),
                                     mode="readwrite")
class BasicAlwaysBusyDevice(CF__POA.AggregateExecutableDevice, ExecutableDevice, AggregateDevice):

  def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
    ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams, PROPERTIES)
    AggregateDevice.__init__(self)
    
    
  def initialize(self):
    ExecutableDevice.initialize(self)
    self._props["memCapacity"] = 100000000
    self._props["BogoMipsCapacity"] = 100000000
    self._props["nicCapacity"] = 100.0
    self._props["fakeCapacity"] = 3
    #self._props["execparams"] = " ".join(["%s %s" % x for x in execparams.items()])
    self._usageState = CF.Device.BUSY
    

  def execute(self, name, options, parameters):
    retval = ExecutableDevice.execute(self, name, options, parameters)
    for option in options:
        if option.id == 'STACK_SIZE':
            self._props['check_STACK_SIZE'] = option.value._v
        elif option.id == 'PRIORITY':
            self._props['check_PRIORITY'] = option.value._v
    return retval
  # See BasicChildDevice for an example of manually dealing with allocate/deallocate
  def allocate_fakeCapacity(self, value):
    self._props["fakeCapacity"] = self._props["fakeCapacity"] - value
    return True

  def allocate_nicCapacity(self, value):
    self._props["nicCapacity"] = self._props["nicCapacity"] - value
    return True

  def allocate_memCapacity(self, value):
    self._props["memCapacity"] = self._props["memCapacity"] - value
    return True

  def allocate_BogoMipsCapacity(self, value):
    self._props["BogoMipsCapacity"] = self._props["BogoMipsCapacity"] - value
    return True

  def deallocate_fakeCapacity(self, value):
    self._props["fakeCapacity"] = self._props["fakeCapacity"] + value

  def deallocate_nicCapacity(self, value):
    self._props["nicCapacity"] = self._props["nicCapacity"] + value

  def deallocate_memCapacity(self, value):
    self._props["memCapacity"] = self._props["memCapacity"] + value

  def deallocate_BogoMipsCapacity(self, value):
    self._props["BogoMipsCapacity"] = self._props["BogoMipsCapacity"] + value

  def updateUsageState(self):
    # Update usage state
    self._usageState = CF.Device.BUSY
    

  class SomeStruct(object):
      field1 = simple_property(id_="item1",
                                type_="string",
                                defvalue="value1")
      field2 = simple_property(id_="item2",
                                type_="long",
                                defvalue=100)
      field3 = simple_property(id_="item3",
                                type_="double",
                                defvalue=3.14156)

  struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f", 
                           name="struct_test", 
                           structdef=SomeStruct)
Ejemplo n.º 14
0
class Sandbox_base(CF__POA.Resource, Resource):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self.threadControlLock = threading.RLock()
        self.process_thread = None
        # self.auto_start is deprecated and is only kept for API compatability
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False

    def initialize(self):
        Resource.initialize(self)

        # Instantiate the default implementations for all ports on this component

    def start(self):
        self.threadControlLock.acquire()
        try:
            Resource.start(self)
            if self.process_thread == None:
                self.process_thread = ProcessThread(target=self.process,
                                                    pause=self.PAUSE)
                self.process_thread.start()
        finally:
            self.threadControlLock.release()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        self.threadControlLock.acquire()
        try:
            process_thread = self.process_thread
            self.process_thread = None

            if process_thread != None:
                process_thread.stop()
                process_thread.join(self.TIMEOUT)
                if process_thread.isAlive():
                    raise CF.Resource.StopError(
                        CF.CF_NOTSET, "Processing thread did not die")
            Resource.stop(self)
        finally:
            self.threadControlLock.release()

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        self.threadControlLock.acquire()
        try:
            Resource.releaseObject(self)
        finally:
            self.threadControlLock.release()

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    my_bool_true = simple_property(id_="my_bool_true",
                                   type_="boolean",
                                   defvalue=True,
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    my_bool_false = simple_property(id_="my_bool_false",
                                    type_="boolean",
                                    defvalue=False,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_bool_empty = simple_property(id_="my_bool_empty",
                                    type_="boolean",
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_long = simple_property(id_="my_long",
                              type_="long",
                              defvalue=10,
                              mode="readwrite",
                              action="external",
                              kinds=("configure", ))
    my_long_empty = simple_property(id_="my_long_empty",
                                    type_="long",
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    my_str = simple_property(id_="my_str",
                             type_="string",
                             defvalue="Hello World!",
                             mode="readwrite",
                             action="external",
                             kinds=("configure", ))
    my_str_empty = simple_property(id_="my_str_empty",
                                   type_="string",
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    my_long_enum = simple_property(id_="my_long_enum",
                                   type_="long",
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    my_str_enum = simple_property(id_="my_str_enum",
                                  type_="string",
                                  mode="readwrite",
                                  action="external",
                                  kinds=("configure", ))
    my_bool_enum = simple_property(id_="my_bool_enum",
                                   type_="boolean",
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    escape__simple = simple_property(id_="escape::simple",
                                     type_="long",
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    readonly_simp = simple_property(id_="readonly_simp",
                                    type_="string",
                                    defvalue="Read only simple prop",
                                    mode="readonly",
                                    action="external",
                                    kinds=("configure", ))
    my_seq_bool = simpleseq_property(id_="my_seq_bool",
                                     type_="boolean",
                                     defvalue=(True, False),
                                     mode="readwrite",
                                     action="external",
                                     kinds=("configure", ))
    my_seq_str = simpleseq_property(id_="my_seq_str",
                                    type_="string",
                                    defvalue=("one", "", "three"),
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    readonly_seq = simpleseq_property(id_="readonly_seq",
                                      type_="string",
                                      defvalue=("read only",
                                                "sequence property"),
                                      mode="readonly",
                                      action="external",
                                      kinds=("configure", ))

    class MyStruct(object):
        bool_true = simple_property(
            id_="bool_true",
            type_="boolean",
            defvalue=True,
        )
        bool_false = simple_property(
            id_="bool_false",
            type_="boolean",
            defvalue=False,
        )
        bool_empty = simple_property(
            id_="bool_empty",
            type_="boolean",
        )
        long_s = simple_property(
            id_="long_s",
            type_="long",
        )
        str_s = simple_property(
            id_="str_s",
            type_="string",
        )
        enum_bool = simple_property(
            id_="enum_bool",
            type_="boolean",
        )
        enum_str = simple_property(
            id_="enum_str",
            type_="string",
        )
        enum_long = simple_property(
            id_="enum_long",
            type_="long",
        )
        es__3 = simple_property(
            id_="es::3",
            type_="long",
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["bool_true"] = self.bool_true
            d["bool_false"] = self.bool_false
            d["bool_empty"] = self.bool_empty
            d["long_s"] = self.long_s
            d["str_s"] = self.str_s
            d["enum_bool"] = self.enum_bool
            d["enum_str"] = self.enum_str
            d["enum_long"] = self.enum_long
            d["es__3"] = self.es__3
            return str(d)

        def getId(self):
            return "my_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("bool_true", self.bool_true),
                    ("bool_false", self.bool_false),
                    ("bool_empty", self.bool_empty), ("long_s", self.long_s),
                    ("str_s", self.str_s), ("enum_bool", self.enum_bool),
                    ("enum_str", self.enum_str), ("enum_long", self.enum_long),
                    ("es__3", self.es__3)]

    my_struct = struct_property(id_="my_struct",
                                structdef=MyStruct,
                                configurationkind=("configure", ),
                                mode="readwrite")

    class EscapeStruct(object):
        es__1 = simple_property(
            id_="es::1",
            type_="long",
        )
        es__2 = simple_property(
            id_="es::2",
            type_="long",
        )
        normal = simple_property(
            id_="normal",
            type_="long",
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["es__1"] = self.es__1
            d["es__2"] = self.es__2
            d["normal"] = self.normal
            return str(d)

        def getId(self):
            return "escape::struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("es__1", self.es__1), ("es__2", self.es__2),
                    ("normal", self.normal)]

    escape__struct = struct_property(id_="escape::struct",
                                     structdef=EscapeStruct,
                                     configurationkind=("configure", ),
                                     mode="readwrite")

    class ReadonlyStruct(object):
        readonly_struct_simp = simple_property(
            id_="readonly_struct_simp",
            type_="string",
            defvalue="read only struct property",
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["readonly_struct_simp"] = self.readonly_struct_simp
            return str(d)

        def getId(self):
            return "readonly_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("readonly_struct_simp", self.readonly_struct_simp)]

    readonly_struct = struct_property(id_="readonly_struct",
                                      structdef=ReadonlyStruct,
                                      configurationkind=("configure", ),
                                      mode="readonly")

    class StructGood(object):
        simp__bad = simple_property(
            id_="simp::bad",
            type_="long",
        )
        simp_bool = simple_property(
            id_="simp_bool",
            type_="boolean",
        )

        def __init__(self, simp__bad=0, simp_bool=False):
            self.simp__bad = simp__bad
            self.simp_bool = simp_bool

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["simp__bad"] = self.simp__bad
            d["simp_bool"] = self.simp_bool
            return str(d)

        def getId(self):
            return "struct_good"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("simp__bad", self.simp__bad),
                    ("simp_bool", self.simp_bool)]

    my_struct_seq = structseq_property(
        id_="my_struct_seq",
        structdef=StructGood,
        defvalue=[StructGood(0, False),
                  StructGood(0, False)],
        configurationkind=("configure", ),
        mode="readwrite")

    class EsSs(object):
        val__1 = simple_property(
            id_="val::1",
            type_="long",
        )
        val_2 = simple_property(
            id_="val_2",
            type_="string",
        )

        def __init__(self, val__1=0, val_2=""):
            self.val__1 = val__1
            self.val_2 = val_2

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["val__1"] = self.val__1
            d["val_2"] = self.val_2
            return str(d)

        def getId(self):
            return "es::ss"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("val__1", self.val__1), ("val_2", self.val_2)]

    escape__structseq = structseq_property(id_="escape::structseq",
                                           structdef=EsSs,
                                           defvalue=[EsSs(0, ""),
                                                     EsSs(0, "")],
                                           configurationkind=("configure", ),
                                           mode="readwrite")

    class ReadonlySs(object):
        readonly_s = simple_property(
            id_="readonly_s",
            type_="string",
        )

        def __init__(self, readonly_s=""):
            self.readonly_s = readonly_s

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["readonly_s"] = self.readonly_s
            return str(d)

        def getId(self):
            return "readonly_ss"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("readonly_s", self.readonly_s)]

    readonly_structseq = structseq_property(
        id_="readonly_structseq",
        structdef=ReadonlySs,
        defvalue=[ReadonlySs("read only"),
                  ReadonlySs("struct seq property")],
        configurationkind=("configure", ),
        mode="readonly")
class TestAllPropTypes_base(CF__POA.Resource, Resource):
        # These values can be altered in the __init__ of your derived class

        PAUSE = 0.0125 # The amount of time to sleep if process return NOOP
        TIMEOUT = 5.0 # The amount of time to wait for the process thread to die when stop() is called
        DEFAULT_QUEUE_SIZE = 100 # The number of BulkIO packets that can be in the queue before pushPacket will block
        
        def __init__(self, identifier, execparams):
            loggerName = (execparams['NAME_BINDING'].replace('/', '.')).rsplit("_", 1)[0]
            Resource.__init__(self, identifier, execparams, loggerName=loggerName)
            self.threadControlLock = threading.RLock()
            self.process_thread = None
            # self.auto_start is deprecated and is only kept for API compatability
            # with 1.7.X and 1.8.0 components.  This variable may be removed
            # in future releases
            self.auto_start = False
            
        def initialize(self):
            Resource.initialize(self)
            
            # Instantiate the default implementations for all ports on this component


        def start(self):
            self.threadControlLock.acquire()
            try:
                Resource.start(self)
                if self.process_thread == None:
                    self.process_thread = ProcessThread(target=self.process, pause=self.PAUSE)
                    self.process_thread.start()
            finally:
                self.threadControlLock.release()

        def process(self):
            """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
            raise NotImplementedError

        def stop(self):
            self.threadControlLock.acquire()
            try:
                process_thread = self.process_thread
                self.process_thread = None

                if process_thread != None:
                    process_thread.stop()
                    process_thread.join(self.TIMEOUT)
                    if process_thread.isAlive():
                        raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")
                Resource.stop(self)
            finally:
                self.threadControlLock.release()

        def releaseObject(self):
            try:
                self.stop()
            except Exception:
                self._log.exception("Error stopping")
            self.threadControlLock.acquire()
            try:
                Resource.releaseObject(self)
            finally:
                self.threadControlLock.release()

        ######################################################################
        # PORTS
        # 
        # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file, 
        # or via the IDE.
                

        ######################################################################
        # PROPERTIES
        # 
        # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
        # or by using the IDE.       
        simple_string = simple_property(id_="simple_string",
                                          type_="string",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_boolean = simple_property(id_="simple_boolean",
                                          type_="boolean",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_ulong = simple_property(id_="simple_ulong",
                                          type_="ulong",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
#        simple_objref = simple_property(id_="simple_objref",
#                                          type_="objref",
#                                          mode="readwrite",
#                                          action="external",
#                                          kinds=("configure",)
#                                          )       
        simple_short = simple_property(id_="simple_short",
                                          type_="short",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_float = simple_property(id_="simple_float",
                                          type_="float",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_octet = simple_property(id_="simple_octet",
                                          type_="octet",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_char = simple_property(id_="simple_char",
                                          type_="char",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_ushort = simple_property(id_="simple_ushort",
                                          type_="ushort",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_double = simple_property(id_="simple_double",
                                          type_="double",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_long = simple_property(id_="simple_long",
                                          type_="long",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_longlong = simple_property(id_="simple_longlong",
                                          type_="longlong",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )       
        simple_ulonglong = simple_property(id_="simple_ulonglong",
                                          type_="ulonglong",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_string = simpleseq_property(id_="simple_sequence_string",  
                                          type_="string",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_boolean = simpleseq_property(id_="simple_sequence_boolean",  
                                          type_="boolean",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_ulong = simpleseq_property(id_="simple_sequence_ulong",  
                                          type_="ulong",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
#        simple_sequence_objref = simpleseq_property(id_="simple_sequence_objref",  
#                                          type_="objref",
#                                          defvalue=None,
#                                          mode="readwrite",
#                                          action="external",
#                                          kinds=("configure",)
#                                          ) 
        simple_sequence_short = simpleseq_property(id_="simple_sequence_short",  
                                          type_="short",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_float = simpleseq_property(id_="simple_sequence_float",  
                                          type_="float",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_octet = simpleseq_property(id_="simple_sequence_octet",  
                                          type_="octet",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_char = simpleseq_property(id_="simple_sequence_char",  
                                          type_="char",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_ushort = simpleseq_property(id_="simple_sequence_ushort",  
                                          type_="ushort",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_double = simpleseq_property(id_="simple_sequence_double",  
                                          type_="double",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_long = simpleseq_property(id_="simple_sequence_long",  
                                          type_="long",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_longlong = simpleseq_property(id_="simple_sequence_longlong",  
                                          type_="longlong",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        simple_sequence_ulonglong = simpleseq_property(id_="simple_sequence_ulonglong",  
                                          type_="ulonglong",
                                          defvalue=None,
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )
        class StructVars(object):
            struct_string = simple_property(id_="struct_string",
                                          type_="string",
                                          )
            struct_boolean = simple_property(id_="struct_boolean",
                                          type_="boolean",
                                          )
            struct_ulong = simple_property(id_="struct_ulong",
                                          type_="ulong",
                                          )
#            struct_objref = simple_property(id_="struct_objref",
#                                          type_="objref",
#                                          )
            struct_short = simple_property(id_="struct_short",
                                          type_="short",
                                          )
            struct_float = simple_property(id_="struct_float",
                                          type_="float",
                                          )
            struct_octet = simple_property(id_="struct_octet",
                                          type_="octet",
                                          )
            struct_char = simple_property(id_="struct_char",
                                          type_="char",
                                          )
            struct_ushort = simple_property(id_="struct_ushort",
                                          type_="ushort",
                                          )
            struct_double = simple_property(id_="struct_double",
                                          type_="double",
                                          )
            struct_long = simple_property(id_="struct_long",
                                          type_="long",
                                          )
            struct_longlong = simple_property(id_="struct_longlong",
                                          type_="longlong",
                                          )
            struct_ulonglong = simple_property(id_="struct_ulonglong",
                                          type_="ulonglong",
                                          )
        
            def __init__(self, **kw):
                """Construct an initialized instance of this struct definition"""
                for attrname, classattr in type(self).__dict__.items():
                    if type(classattr) == simple_property:
                        classattr.initialize(self)
                for k,v in kw.items():
                    setattr(self,k,v)

            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["struct_string"] = self.struct_string
                d["struct_boolean"] = self.struct_boolean
                d["struct_ulong"] = self.struct_ulong
#                d["struct_objref"] = self.struct_objref
                d["struct_short"] = self.struct_short
                d["struct_float"] = self.struct_float
                d["struct_octet"] = self.struct_octet
                d["struct_char"] = self.struct_char
                d["struct_ushort"] = self.struct_ushort
                d["struct_double"] = self.struct_double
                d["struct_long"] = self.struct_long
                d["struct_longlong"] = self.struct_longlong
                d["struct_ulonglong"] = self.struct_ulonglong
                return str(d)

            def getId(self):
                return "struct_vars"

            def isStruct(self):
                return True

            def getMembers(self):
                return [("struct_string",self.struct_string),("struct_boolean",self.struct_boolean),("struct_ulong",self.struct_ulong),#("struct_objref",self.struct_objref),
("struct_short",self.struct_short),("struct_float",self.struct_float),("struct_octet",self.struct_octet),("struct_char",self.struct_char),("struct_ushort",self.struct_ushort),("struct_double",self.struct_double),("struct_long",self.struct_long),("struct_longlong",self.struct_longlong),("struct_ulonglong",self.struct_ulonglong)]

        
        struct_vars = struct_property(id_="struct_vars",
                                          structdef=StructVars,
                                          configurationkind=("configure",),
                                          mode="readwrite"
                                          )
        class StructSeqVars(object):
            struct_seq_string = simple_property(id_="struct_seq_string",
                                          type_="string",
                                          )
            struct_seq_boolean = simple_property(id_="struct_seq_boolean",
                                          type_="boolean",
                                          )
            struct_seq_ulong = simple_property(id_="struct_seq_ulong",
                                          type_="ulong",
                                          )
#            struct_seq_objref = simple_property(id_="struct_seq_objref",
#                                          type_="objref",
#                                          )
            struct_seq_short = simple_property(id_="struct_seq_short",
                                          type_="short",
                                          )
            struct_seq_float = simple_property(id_="struct_seq_float",
                                          type_="float",
                                          )
            struct_seq_octet = simple_property(id_="struct_seq_octet",
                                          type_="octet",
                                          )
            struct_seq_char = simple_property(id_="struct_seq_char",
                                          type_="char",
                                          )
            struct_seq_ushort = simple_property(id_="struct_seq_ushort",
                                          type_="ushort",
                                          )
            struct_seq_double = simple_property(id_="struct_seq_double",
                                          type_="double",
                                          )
            struct_seq_long = simple_property(id_="struct_seq_long",
                                          type_="long",
                                          )
            struct_seq_longlong = simple_property(id_="struct_seq_longlong",
                                          type_="longlong",
                                          )
            struct_seq_ulonglong = simple_property(id_="struct_seq_ulonglong",
                                          type_="ulonglong",
                                          )
        
            def __init__(self, struct_seq_string="", struct_seq_boolean=False, struct_seq_ulong=0, struct_seq_objref="", struct_seq_short=0, struct_seq_float=0, struct_seq_octet=0, struct_seq_char="", struct_seq_ushort=0, struct_seq_double=0, struct_seq_long=0, struct_seq_longlong=0, struct_seq_ulonglong=0):
                self.struct_seq_string = struct_seq_string
                self.struct_seq_boolean = struct_seq_boolean
                self.struct_seq_ulong = struct_seq_ulong
                self.struct_seq_objref = struct_seq_objref
                self.struct_seq_short = struct_seq_short
                self.struct_seq_float = struct_seq_float
                self.struct_seq_octet = struct_seq_octet
                self.struct_seq_char = struct_seq_char
                self.struct_seq_ushort = struct_seq_ushort
                self.struct_seq_double = struct_seq_double
                self.struct_seq_long = struct_seq_long
                self.struct_seq_longlong = struct_seq_longlong
                self.struct_seq_ulonglong = struct_seq_ulonglong

            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["struct_seq_string"] = self.struct_seq_string
                d["struct_seq_boolean"] = self.struct_seq_boolean
                d["struct_seq_ulong"] = self.struct_seq_ulong
                d["struct_seq_objref"] = self.struct_seq_objref
                d["struct_seq_short"] = self.struct_seq_short
                d["struct_seq_float"] = self.struct_seq_float
                d["struct_seq_octet"] = self.struct_seq_octet
                d["struct_seq_char"] = self.struct_seq_char
                d["struct_seq_ushort"] = self.struct_seq_ushort
                d["struct_seq_double"] = self.struct_seq_double
                d["struct_seq_long"] = self.struct_seq_long
                d["struct_seq_longlong"] = self.struct_seq_longlong
                d["struct_seq_ulonglong"] = self.struct_seq_ulonglong
                return str(d)

            def getId(self):
                return "struct_seq_vars"

            def isStruct(self):
                return True

            def getMembers(self):
                return [("struct_seq_string",self.struct_seq_string),("struct_seq_boolean",self.struct_seq_boolean),("struct_seq_ulong",self.struct_seq_ulong),("struct_seq_objref",self.struct_seq_objref),("struct_seq_short",self.struct_seq_short),("struct_seq_float",self.struct_seq_float),("struct_seq_octet",self.struct_seq_octet),("struct_seq_char",self.struct_seq_char),("struct_seq_ushort",self.struct_seq_ushort),("struct_seq_double",self.struct_seq_double),("struct_seq_long",self.struct_seq_long),("struct_seq_longlong",self.struct_seq_longlong),("struct_seq_ulonglong",self.struct_seq_ulonglong)]

                
        struct_seq = structseq_property(id_="struct_seq",
                                          structdef=StructSeqVars,                          
                                          defvalue=[],
                                          configurationkind=("configure",),
                                          mode="readwrite"
                                          )
class start_event_device_base(CF__POA.Device, Device, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        Device.__init__(self, devmgr, uuid, label, softwareProfile,
                        compositeDevice, execparams)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 devices.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this device
        self.port_message_out = MessageSupplierPort()

    def start(self):
        Device.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Device.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Device.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    port_message_out = usesport(name="message_out",
                                repid="IDL:ExtendedEvent/MessageEvent:1.0",
                                type_="responses")

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    device_kind = simple_property(
        id_="DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d",
        name="device_kind",
        type_="string",
        defvalue="start_event_device",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description="""This specifies the device kind""")

    device_model = simple_property(
        id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
        name="device_model",
        type_="string",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description=""" This specifies the specific device""")

    class StateChange(object):
        identifier = simple_property(id_="state_change::identifier",
                                     name="identifier",
                                     type_="string")

        event = simple_property(id_="state_change::event",
                                name="event",
                                type_="string")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["identifier"] = self.identifier
            d["event"] = self.event
            return str(d)

        @classmethod
        def getId(cls):
            return "state_change"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("identifier", self.identifier), ("event", self.event)]

    state_change = struct_property(id_="state_change",
                                   structdef=StateChange,
                                   configurationkind=("message", ),
                                   mode="readwrite")

    class Failures(object):
        start = simple_property(id_="failures::start",
                                name="start",
                                type_="boolean",
                                defvalue=False)

        stop = simple_property(id_="failures::stop",
                               name="stop",
                               type_="boolean",
                               defvalue=False)

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["start"] = self.start
            d["stop"] = self.stop
            return str(d)

        @classmethod
        def getId(cls):
            return "failures"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("start", self.start), ("stop", self.stop)]

    failures = struct_property(id_="failures",
                               structdef=Failures,
                               configurationkind=("property", ),
                               mode="readwrite")
Ejemplo n.º 17
0
     action="eq",
     kinds=("allocation", "configure"),
     description="""This specifies the device kind""")
 device_model = simple_property(
     id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
     name="device_model",
     type_="string",
     defvalue="",
     mode="readonly",
     action="eq",
     kinds=("allocation", "configure"),
     description=""" This specifies the specific device""")
 frontend_video_allocation = struct_property(
     id_="FRONTEND::video_allocation",
     name="frontend_video_allocation",
     structdef=frontend_video_allocation,
     configurationkind=("allocation", ),
     mode="readwrite",
     description="""Frontend Interfaces v2.0 main allocation structure""")
 frontend_listener_allocation = struct_property(
     id_="FRONTEND::listener_allocation",
     name="frontend_listener_allocation",
     structdef=frontend_listener_allocation,
     configurationkind=("allocation", ),
     mode="readwrite",
     description=
     """Allocates a listener (subscriber) based off a previous allocation """
 )
 frontend_video_status = structseq_property(
     id_="FRONTEND::video_status",
     name="frontend_video_status",
class writeonly_py_base(CF__POA.Device, Device, ThreadedComponent):
        # These values can be altered in the __init__ of your derived class

        PAUSE = 0.0125 # The amount of time to sleep if process return NOOP
        TIMEOUT = 5.0 # The amount of time to wait for the process thread to die when stop() is called
        DEFAULT_QUEUE_SIZE = 100 # The number of BulkIO packets that can be in the queue before pushPacket will block

        def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams):
            Device.__init__(self, devmgr, uuid, label, softwareProfile, compositeDevice, execparams)
            ThreadedComponent.__init__(self)

            # self.auto_start is deprecated and is only kept for API compatibility
            # with 1.7.X and 1.8.0 devices.  This variable may be removed
            # in future releases
            self.auto_start = False
            # Instantiate the default implementations for all ports on this device

        def start(self):
            Device.start(self)
            ThreadedComponent.startThread(self, pause=self.PAUSE)

        def stop(self):
            Device.stop(self)
            if not ThreadedComponent.stopThread(self, self.TIMEOUT):
                raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")

        def releaseObject(self):
            try:
                self.stop()
            except Exception:
                self._log.exception("Error stopping")
            Device.releaseObject(self)

        ######################################################################
        # PORTS
        # 
        # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file, 
        # or via the IDE.

        ######################################################################
        # PROPERTIES
        # 
        # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
        # or by using the IDE.
        device_kind = simple_property(id_="DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d",
                                      name="device_kind",
                                      type_="string",
                                      mode="readonly",
                                      action="eq",
                                      kinds=("allocation",),
                                      description="""This specifies the device kind""")


        device_model = simple_property(id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
                                       name="device_model",
                                       type_="string",
                                       mode="readonly",
                                       action="eq",
                                       kinds=("allocation",),
                                       description=""" This specifies the specific device""")


        foo = simple_property(id_="foo",
                              type_="string",
                              defvalue="something",
                              mode="writeonly",
                              action="external",
                              kinds=("allocation",))


        foo_seq = simpleseq_property(id_="foo_seq",
                                     type_="string",
                                     defvalue=["abc"                                             ],
                                     mode="writeonly",
                                     action="external",
                                     kinds=("allocation",))


        class FooStruct(object):
            abc = simple_property(
                                  id_="abc",
                                  
                                  type_="string",
                                  defvalue="def"
                                  )
        
            def __init__(self, **kw):
                """Construct an initialized instance of this struct definition"""
                for classattr in type(self).__dict__.itervalues():
                    if isinstance(classattr, (simple_property, simpleseq_property)):
                        classattr.initialize(self)
                for k,v in kw.items():
                    setattr(self,k,v)
        
            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["abc"] = self.abc
                return str(d)
        
            @classmethod
            def getId(cls):
                return "foo_struct"
        
            @classmethod
            def isStruct(cls):
                return True
        
            def getMembers(self):
                return [("abc",self.abc)]

        foo_struct = struct_property(id_="foo_struct",
                                     structdef=FooStruct,
                                     configurationkind=("allocation",),
                                     mode="writeonly")


        class Ghi(object):
            jkl = simple_property(
                                  id_="jkl",
                                  
                                  type_="string")
        
            def __init__(self, jkl=""):
                self.jkl = jkl
        
            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["jkl"] = self.jkl
                return str(d)
        
            @classmethod
            def getId(cls):
                return "ghi"
        
            @classmethod
            def isStruct(cls):
                return True
        
            def getMembers(self):
                return [("jkl",self.jkl)]

        foo_struct_seq = structseq_property(id_="foo_struct_seq",
                                            structdef=Ghi,
                                            defvalue=[Ghi(jkl="mno")],
                                            configurationkind=("allocation",),
                                            mode="writeonly")
Ejemplo n.º 19
0
class control_writes_base(CF__POA.Resource, Component, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component
        self.port_request = MessageConsumerPort(thread_sleep=0.1, parent=self)
        self.port_file_io_status = MessageConsumerPort(thread_sleep=0.1,
                                                       parent=self)
        self.port_response = MessageSupplierPort()

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    port_request = providesport(name="request",
                                repid="IDL:ExtendedEvent/MessageEvent:1.0",
                                type_="control")

    port_file_io_status = providesport(
        name="file_io_status",
        repid="IDL:ExtendedEvent/MessageEvent:1.0",
        type_="control")

    port_response = usesport(name="response",
                             repid="IDL:ExtendedEvent/MessageEvent:1.0",
                             type_="control")

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    ageoff = simple_property(id_="ageoff",
                             type_="float",
                             defvalue=600.0,
                             mode="readwrite",
                             action="external",
                             kinds=("property", ),
                             description="""seconds""")

    class CutRequest(object):
        time_begin = simple_property(id_="cut_request::time_begin",
                                     name="time_begin",
                                     type_="double")

        time_end = simple_property(id_="cut_request::time_end",
                                   name="time_end",
                                   type_="double")

        freq_begin = simple_property(id_="cut_request::freq_begin",
                                     name="freq_begin",
                                     type_="double")

        freq_end = simple_property(id_="cut_request::freq_end",
                                   name="freq_end",
                                   type_="double")

        request_id = simple_property(id_="cut_request::request_id",
                                     name="request_id",
                                     type_="string")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["time_begin"] = self.time_begin
            d["time_end"] = self.time_end
            d["freq_begin"] = self.freq_begin
            d["freq_end"] = self.freq_end
            d["request_id"] = self.request_id
            return str(d)

        @classmethod
        def getId(cls):
            return "cut_request"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [
                ("time_begin", self.time_begin), ("time_end", self.time_end),
                ("freq_begin", self.freq_begin), ("freq_end", self.freq_end),
                ("request_id", self.request_id)
            ]

    cut_request = struct_property(id_="cut_request",
                                  structdef=CutRequest,
                                  configurationkind=("message", ),
                                  mode="readwrite")

    class CutResponse(object):
        request_id = simple_property(id_="cut_response::request_id",
                                     name="request_id",
                                     type_="string")

        file_location = simple_property(id_="cut_response::file_location",
                                        name="file_location",
                                        type_="string")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["request_id"] = self.request_id
            d["file_location"] = self.file_location
            return str(d)

        @classmethod
        def getId(cls):
            return "cut_response"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("request_id", self.request_id),
                    ("file_location", self.file_location)]

    cut_response = struct_property(id_="cut_response",
                                   structdef=CutResponse,
                                   configurationkind=("message", ),
                                   mode="readwrite")

    class FileIoMessage(object):
        file_operation = simple_property(id_="file_io_message::file_operation",
                                         name="file_operation",
                                         type_="string",
                                         defvalue="OPEN")

        stream_id = simple_property(id_="file_io_message::stream_id",
                                    name="stream_id",
                                    type_="string")

        filename = simple_property(id_="file_io_message::filename",
                                   name="filename",
                                   type_="string")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["file_operation"] = self.file_operation
            d["stream_id"] = self.stream_id
            d["filename"] = self.filename
            return str(d)

        @classmethod
        def getId(cls):
            return "file_io_message"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("file_operation", self.file_operation),
                    ("stream_id", self.stream_id), ("filename", self.filename)]

    file_io_message = struct_property(
        id_="file_io_message",
        structdef=FileIoMessage,
        configurationkind=("message", ),
        mode="readwrite",
        description="""The structure representing a file IO message.""")
Ejemplo n.º 20
0
class MsgPort_P_base(CF__POA.Resource, Component, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component
        self.port_msg_out = MessageSupplierPort()

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    port_msg_out = usesport(name="msg_out",
                            repid="IDL:ExtendedEvent/MessageEvent:1.0",
                            type_="control")

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    class MsgOut(object):
        field1 = simple_property(id_="field1", name="field1", type_="string")

        field2 = simple_property(id_="field2", name="field2", type_="long")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["field1"] = self.field1
            d["field2"] = self.field2
            return str(d)

        @classmethod
        def getId(cls):
            return "msg_out"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("field1", self.field1), ("field2", self.field2)]

    msg_out = struct_property(id_="msg_out",
                              structdef=MsgOut,
                              configurationkind=("message", ),
                              mode="readwrite")
Ejemplo n.º 21
0
class struct_fields_base(CF__POA.Resource, Resource, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component

    def start(self):
        Resource.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")
        Resource.stop(self)

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Resource.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    class First(object):
        first = simple_property(id_="first::first",
                                name="first",
                                type_="long",
                                defvalue=0)

        second = simple_property(id_="first::second",
                                 name="second",
                                 type_="string",
                                 defvalue="")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["first"] = self.first
            d["second"] = self.second
            return str(d)

        def getId(self):
            return "first"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("first", self.first), ("second", self.second)]

    first = struct_property(id_="first",
                            structdef=First,
                            configurationkind=("configure", ),
                            mode="readwrite")

    class Second(object):
        first = simple_property(id_="second::first",
                                name="first",
                                type_="float",
                                defvalue=0.0)

        second = simple_property(id_="second::second",
                                 name="second",
                                 type_="boolean",
                                 defvalue=False)

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["first"] = self.first
            d["second"] = self.second
            return str(d)

        def getId(self):
            return "second"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("first", self.first), ("second", self.second)]

    second = struct_property(id_="second",
                             structdef=Second,
                             configurationkind=("configure", ),
                             mode="readwrite")
Ejemplo n.º 22
0
class TestComponentProperty_base(CF__POA.Resource, Resource):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self.threadControlLock = threading.RLock()
        self.process_thread = None
        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False

    def initialize(self):
        Resource.initialize(self)

        # Instantiate the default implementations for all ports on this component

    def start(self):
        self.threadControlLock.acquire()
        try:
            Resource.start(self)
            if self.process_thread == None:
                self.process_thread = ProcessThread(target=self.process,
                                                    pause=self.PAUSE)
                self.process_thread.start()
        finally:
            self.threadControlLock.release()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        self.threadControlLock.acquire()
        try:
            process_thread = self.process_thread
            self.process_thread = None

            if process_thread != None:
                process_thread.stop()
                process_thread.join(self.TIMEOUT)
                if process_thread.isAlive():
                    raise CF.Resource.StopError(
                        CF.CF_NOTSET, "Processing thread did not die")
            Resource.stop(self)
        finally:
            self.threadControlLock.release()

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        self.threadControlLock.acquire()
        try:
            Resource.releaseObject(self)
        finally:
            self.threadControlLock.release()

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    my_long_enum = simple_property(id_="my_long_enum",
                                   type_="long",
                                   defvalue=11,
                                   mode="readwrite",
                                   action="external",
                                   kinds=("configure", ))
    simpleExecparam = simple_property(id_="simpleExecparam",
                                      type_="float",
                                      defvalue=1.0,
                                      mode="readwrite",
                                      action="eq",
                                      kinds=("execparam", ))
    seqTest = simpleseq_property(id_="seqTest",
                                 type_="char",
                                 defvalue=[
                                     'a',
                                     'b',
                                     'c',
                                 ],
                                 mode="readwrite",
                                 action="external",
                                 kinds=("configure", ))

    class MyStruct(object):
        bool_true = simple_property(
            id_="bool_true",
            type_="boolean",
            defvalue=True,
        )
        bool_false = simple_property(
            id_="bool_false",
            type_="boolean",
        )
        bool_empty = simple_property(
            id_="bool_empty",
            type_="boolean",
        )
        long_s = simple_property(
            id_="long_s",
            type_="long",
        )
        str_s = simple_property(
            id_="str_s",
            type_="string",
        )
        enum_bool = simple_property(
            id_="enum_bool",
            type_="boolean",
        )
        enum_str = simple_property(
            id_="enum_str",
            type_="string",
        )
        enum_long = simple_property(
            id_="enum_long",
            type_="long",
        )
        es__3 = simple_property(
            id_="es::3",
            type_="long",
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["bool_true"] = self.bool_true
            d["bool_false"] = self.bool_false
            d["bool_empty"] = self.bool_empty
            d["long_s"] = self.long_s
            d["str_s"] = self.str_s
            d["enum_bool"] = self.enum_bool
            d["enum_str"] = self.enum_str
            d["enum_long"] = self.enum_long
            d["es__3"] = self.es__3
            return str(d)

        def getId(self):
            return "my_struct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("bool_true", self.bool_true),
                    ("bool_false", self.bool_false),
                    ("bool_empty", self.bool_empty), ("long_s", self.long_s),
                    ("str_s", self.str_s), ("enum_bool", self.enum_bool),
                    ("enum_str", self.enum_str), ("enum_long", self.enum_long),
                    ("es__3", self.es__3)]

    my_struct = struct_property(id_="my_struct",
                                structdef=MyStruct,
                                configurationkind=("configure", ),
                                mode="readwrite")

    class Tests(object):
        b = simple_property(
            id_="b",
            type_="ulonglong",
            defvalue=32,
        )
        t = simple_property(
            id_="t",
            type_="string",
            defvalue="dfdasfas",
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["b"] = self.b
            d["t"] = self.t
            return str(d)

        def getId(self):
            return "tests"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("b", self.b), ("t", self.t)]

    tests = struct_property(id_="tests",
                            structdef=Tests,
                            configurationkind=("configure", ),
                            mode="readwrite")

    class StructsTest(object):
        simpleShort = simple_property(
            id_="simpleShort",
            type_="short",
            defvalue=3,
        )
        simpleFloat = simple_property(
            id_="simpleFloat",
            type_="long",
            defvalue=2,
        )

        def __init__(self, simpleShort=3, simpleFloat=2):
            self.simpleShort = simpleShort
            self.simpleFloat = simpleFloat

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["simpleShort"] = self.simpleShort
            d["simpleFloat"] = self.simpleFloat
            return str(d)

        def getId(self):
            return "structsTest"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("simpleShort", self.simpleShort),
                    ("simpleFloat", self.simpleFloat)]

    structSeqTest = structseq_property(
        id_="structSeqTest",
        structdef=StructsTest,
        defvalue=[StructsTest(3, 2), StructsTest(3, 2)],
        configurationkind=("allocation", "configure"),
        mode="readwrite")
Ejemplo n.º 23
0
class CommandWrapper_i(CF__POA.Resource, Resource):
    """This component simply ensures that all other components in the waveform get started and
    stopped together."""


    # The signal to send and the number of seconds (max) to wait
    # for the process to actually exit before trying the next signals.
    # None means wait until the process dies (which we have to do to
    # avoid creating zombie processes
    STOP_SIGNALS = ((signal.SIGINT, 1), (signal.SIGTERM, 5), (signal.SIGKILL, None))
    def __init__(self, identifier, execparams):
        loggerName = "CommandWrapper"
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self._pid = None
        self.execparams = execparams.items()

    #####################################
    # Implement the Resource interface
    def start(self):
        self._log.debug("start()")
        if self.get_commandAlive() == False:
            command = self._props["command"]
            args = copy.copy(self._props["args"])
            args.insert(0, command)
            self._log.debug("start %s %r", command, args)
            self._pid = os.spawnv(os.P_NOWAIT, command, args)
            self._log.debug("spawned %s", self._pid)
        Resource.start(self)

    def stop(self):
        self._log.debug("stop()")
        try:
            if self.get_commandAlive() == True:
                for sig, timeout in self.STOP_SIGNALS:
                    try:
                        os.kill(self._pid, sig)
                    except OSError:
                        self._pid = None
                        return
                    if timeout != None:
                        giveup_time = time.time() + timeout
                        while os.waitpid(self._pid, os.WNOHANG) == (0,0):
                            time.sleep(0.1)
                            if time.time() > giveup_time:
                                break
                    else:
                        # Wait until there is a response
                        os.waitpid(self._pid, 0)
                self._pid = None
        finally:
            Resource.stop(self)

    # CF::LifeCycle
    def initialize(self):
        self.fromOther = fromOther_i(self, "resource_in")

    # CF::PortSupplier
    def getPort(self, name):
        if name == "resource_in":
            return self.fromOther._this()
    
    ######################################
    # Implement specific property setters/getters 
    def get_commandAlive(self):
        if self._pid != None:
            try:
                os.kill(self._pid, 0)
                if os.waitpid(self._pid, os.WNOHANG) == (0,0):
                    return True
                else:
                    return False
            except OSError:
                pass
        return False

    command = simple_property(\
        id_='DCE:a4e7b230-1d17-4a86-aeff-ddc6ea3df26e',
        type_="string",
        name="command",
        defvalue="/bin/echo")

    commandAlive = simple_property(\
        id_='DCE:95f19cb8-679e-48fb-bece-dc199ef45f20',
        type_="boolean",
        name="commandAlive",
        defvalue=False,
        mode="readonly",
        fget=get_commandAlive)

    someprop = simple_property(\
        id_='DCE:fa8c5924-845c-484a-81df-7941f2c5baa9',
        type_="long",
        name="someprop",
        defvalue=10)

    someprop2 = simple_property(\
        id_='DCE:cf623573-a09d-4fb1-a2ae-24b0b507115d',
        type_="double",
        name="someprop2",
        defvalue=50.0)

    configure_prop_notset = simple_property(\
        id_='configure_prop_notset',
        type_="double",
        name="configure_prop_notset",
        kinds=("property"))

    someprop3 = simple_property(\
        id_='DCE:6ad84383-49cf-4017-b7ca-0ec4c4917952',
        type_="double",
        name="someprop3",
        kinds=("configure"))

    execparams = simpleseq_property(\
        id_='DCE:85d133fd-1658-4e4d-b3ff-1443cd44c0e2',
        type_="string",
        name="execparams")

    execparam1 = simple_property(\
        id_='EXEC_PARAM_1',
        type_="string",
        name="Parameter 1",
        defvalue="Test1",
        kinds=("execparam"))

    execparam2 = simple_property(\
        id_='EXEC_PARAM_2',
        type_="long",
        name="Parameter 2",
        defvalue=2,
        kinds=("execparam"))

    execparam3 = simple_property(\
        id_='EXEC_PARAM_3',
        type_="float",
        name="Parameter 3",
        defvalue=3.125,
        kinds=("execparam"),
        mode="readonly")

    someobjref = simple_property(\
        id_='SOMEOBJREF',
        type_="objref",
        name="Object Ref",
        defvalue=None,
        kinds=("execparam"),
        mode="writeonly")

    someobjref = simpleseq_property(\
        id_='DCE:5d8bfe8d-bc25-4f26-8144-248bc343aa53',
        type_="string",
        name="args",
        defvalue=("Hello World",))

    somelonglongprop = simple_property(\
        id_='DCE:a7de97ee-1e78-45e9-8e2b-204c141656fc',
        type_="longlong",
        name="somelonglongprop",
        defvalue=12345678901)

    somelonglongprop2 = simple_property(\
        id_='DCE:9ec6e2ff-6a4f-4452-8f38-4df47d6eebc1',
        type_="longlong",
        name="somelonglongprop2",
        defvalue=12345678901)

    class SomeStruct(object):
        field1 = simple_property(id_="item1",
                                type_="string",
                                defvalue="value1")
        field2 = simple_property(id_="item2",
                                type_="long",
                                defvalue=100)
        field3 = simple_property(id_="item3",
                                type_="double",
                                defvalue=3.14156)

    struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f", 
                            name="struct_test", 
                            structdef=SomeStruct)
class TestComplexProps_base(CF__POA.Resource, Resource):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Resource.__init__(self, identifier, execparams, loggerName=loggerName)
        self.threadControlLock = threading.RLock()
        self.process_thread = None
        # self.auto_start is deprecated and is only kept for API compatability
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False

    def initialize(self):
        Resource.initialize(self)

        # Instantiate the default implementations for all ports on this component

    def start(self):
        self.threadControlLock.acquire()
        try:
            Resource.start(self)
            if self.process_thread == None:
                self.process_thread = ProcessThread(target=self.process,
                                                    pause=self.PAUSE)
                self.process_thread.start()
        finally:
            self.threadControlLock.release()

    def process(self):
        """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
        raise NotImplementedError

    def stop(self):
        self.threadControlLock.acquire()
        try:
            process_thread = self.process_thread
            self.process_thread = None

            if process_thread != None:
                process_thread.stop()
                process_thread.join(self.TIMEOUT)
                if process_thread.isAlive():
                    raise CF.Resource.StopError(
                        CF.CF_NOTSET, "Processing thread did not die")
            Resource.stop(self)
        finally:
            self.threadControlLock.release()

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        self.threadControlLock.acquire()
        try:
            Resource.releaseObject(self)
        finally:
            self.threadControlLock.release()

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    complexBooleanProp = simple_property(id_="complexBooleanProp",
                                         type_="boolean",
                                         defvalue=complex(0, 1),
                                         complex=True,
                                         mode="readwrite",
                                         action="external",
                                         kinds=("configure", ))
    complexULongProp = simple_property(id_="complexULongProp",
                                       type_="ulong",
                                       defvalue=complex(4, 5),
                                       complex=True,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    complexShortProp = simple_property(id_="complexShortProp",
                                       type_="short",
                                       defvalue=complex(4, 5),
                                       complex=True,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    complexFloatProp = simple_property(id_="complexFloatProp",
                                       type_="float",
                                       defvalue=complex(4.0, 5.0),
                                       complex=True,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    complexOctetProp = simple_property(id_="complexOctetProp",
                                       type_="octet",
                                       defvalue=complex(4, 5),
                                       complex=True,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    complexCharProp = simple_property(id_="complexCharProp",
                                      type_="char",
                                      defvalue=complex(4, 5),
                                      complex=True,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    complexUShort = simple_property(id_="complexUShort",
                                    type_="ushort",
                                    defvalue=complex(4, 5),
                                    complex=True,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    complexDouble = simple_property(id_="complexDouble",
                                    type_="double",
                                    defvalue=complex(4.0, 5.0),
                                    complex=True,
                                    mode="readwrite",
                                    action="external",
                                    kinds=("configure", ))
    complexLong = simple_property(id_="complexLong",
                                  type_="long",
                                  defvalue=complex(4, 5),
                                  complex=True,
                                  mode="readwrite",
                                  action="external",
                                  kinds=("configure", ))
    complexLongLong = simple_property(id_="complexLongLong",
                                      type_="longlong",
                                      defvalue=complex(4, 5),
                                      complex=True,
                                      mode="readwrite",
                                      action="external",
                                      kinds=("configure", ))
    complexULongLong = simple_property(id_="complexULongLong",
                                       type_="ulonglong",
                                       defvalue=complex(4, 5),
                                       complex=True,
                                       mode="readwrite",
                                       action="external",
                                       kinds=("configure", ))
    complexFloatSequence = simpleseq_property(id_="complexFloatSequence",
                                              type_="float",
                                              defvalue=[
                                                  complex(4.0, 5.0),
                                                  complex(4.0, 5.0),
                                                  complex(4.0, 5.0),
                                              ],
                                              complex=True,
                                              mode="readwrite",
                                              action="external",
                                              kinds=("configure", ))

    class Float(object):
        FloatStructMember = simple_property(
            id_="FloatStructMember",
            type_="float",
            defvalue=4.0,
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["FloatStructMember"] = self.FloatStructMember
            return str(d)

        def getId(self):
            return "FloatStruct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("FloatStructMember", self.FloatStructMember)]

    FloatStruct = struct_property(id_="FloatStruct",
                                  structdef=Float,
                                  configurationkind=("configure", ),
                                  mode="readwrite")

    class ComplexFloat(object):
        complexFloatStructMember = simple_property(
            id_="complexFloatStructMember",
            type_="float",
            defvalue=complex(4.0, 5.0),
            complex=True,
        )

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["complexFloatStructMember"] = self.complexFloatStructMember
            return str(d)

        def getId(self):
            return "complexFloatStruct"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("complexFloatStructMember", self.complexFloatStructMember)
                    ]

    complexFloatStruct = struct_property(id_="complexFloatStruct",
                                         structdef=ComplexFloat,
                                         configurationkind=("configure", ),
                                         mode="readwrite")

    class FloatStructSequenceMember(object):
        FloatStructSequenceMemberMemember = simple_property(
            id_="FloatStructSequenceMemberMemember",
            type_="float",
            defvalue=4.0,
        )

        def __init__(self, FloatStructSequenceMemberMemember=4.0):
            self.FloatStructSequenceMemberMemember = FloatStructSequenceMemberMemember

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["FloatStructSequenceMemberMemember"] = self.FloatStructSequenceMemberMemember
            return str(d)

        def getId(self):
            return "FloatStructSequenceMember"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("FloatStructSequenceMemberMemember",
                     self.FloatStructSequenceMemberMemember)]

    FloatStructSequence = structseq_property(
        id_="FloatStructSequence",
        structdef=FloatStructSequenceMember,
        defvalue=[],
        configurationkind=("configure", ),
        mode="readwrite")

    class ComplexFloatStructSequenceMember(object):
        complexFloatStructSequenceMemberMemember = simple_property(
            id_="complexFloatStructSequenceMemberMemember",
            type_="float",
            defvalue=complex(4.0, 5.0),
            complex=True,
        )

        def __init__(self,
                     complexFloatStructSequenceMemberMemember=complex(
                         4.0, 5.0)):
            self.complexFloatStructSequenceMemberMemember = complexFloatStructSequenceMemberMemember

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["complexFloatStructSequenceMemberMemember"] = self.complexFloatStructSequenceMemberMemember
            return str(d)

        def getId(self):
            return "complexFloatStructSequenceMember"

        def isStruct(self):
            return True

        def getMembers(self):
            return [("complexFloatStructSequenceMemberMemember",
                     self.complexFloatStructSequenceMemberMemember)]

    complexFloatStructSequence = structseq_property(
        id_="complexFloatStructSequence",
        structdef=ComplexFloatStructSequenceMember,
        defvalue=[],
        configurationkind=("configure", ),
        mode="readwrite")
Ejemplo n.º 25
0
class BadReleaseBefore(CF__POA.AggregateExecutableDevice, ExecutableDevice,
                       AggregateDevice):
    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams, PROPERTIES)
        AggregateDevice.__init__(self)
        self._props["memCapacity"] = 100000000
        self._props["BogoMipsCapacity"] = 100000000
        self._props["nicCapacity"] = 100.0
        self._props["fakeCapacity"] = 3
        self._props["execparams"] = " ".join(
            ["%s %s" % x for x in execparams.items()])

    def execute(self, name, options, parameters):
        retval = ExecutableDevice.execute(self, name, options, parameters)
        for option in options:
            if option.id == 'STACK_SIZE':
                self._props['check_STACK_SIZE'] = option.value._v
            elif option.id == 'PRIORITY':
                self._props['check_PRIORITY'] = option.value._v
        return retval

    # See BasicChildDevice for an example of manually dealing with allocate/deallocate
    def allocate_fakeCapacity(self, value):
        if self._props["fakeCapacity"] < value:
            return False
        self._props["fakeCapacity"] = self._props["fakeCapacity"] - value
        return True

    def allocate_nicCapacity(self, value):
        if self._props["nicCapacity"] < value:
            return False
        self._props["nicCapacity"] = self._props["nicCapacity"] - value
        return True

    def allocate_memCapacity(self, value):
        if self._props["memCapacity"] < value:
            return False
        self._props["memCapacity"] = self._props["memCapacity"] - value
        return True

    def allocate_BogoMipsCapacity(self, value):
        if self._props["BogoMipsCapacity"] < value:
            return False
        self._props[
            "BogoMipsCapacity"] = self._props["BogoMipsCapacity"] - value
        return True

    def deallocate_fakeCapacity(self, value):
        self._props["fakeCapacity"] = self._props["fakeCapacity"] + value

    def deallocate_nicCapacity(self, value):
        self._props["nicCapacity"] = self._props["nicCapacity"] + value

    def deallocate_memCapacity(self, value):
        self._props["memCapacity"] = self._props["memCapacity"] + value

    def deallocate_BogoMipsCapacity(self, value):
        self._props[
            "BogoMipsCapacity"] = self._props["BogoMipsCapacity"] + value

    def allocate_allocStruct(self, value):
        if value > self.allocStruct:
            return False

        self.allocStruct -= value
        return True

    def deallocate_allocStruct(self, value):
        self.allocStruct += value

    def updateUsageState(self):
        # Update usage state
        if self._props["memCapacity"] == 0 and self._props[
                "BogoMipsCapacity"] == 0:
            self._usageState = CF.Device.BUSY
        elif self._props["memCapacity"] == 100000000 and self._props[
                "BogoMipsCapacity"] == 100000000:
            self._usageState = CF.Device.IDLE
        else:
            self._usageState = CF.Device.ACTIVE

    def releaseObject(self):
        a = b
        ExecutableDevice.releaseObject(self)

    class SomeStruct(object):
        field1 = simple_property(id_="item1",
                                 type_="string",
                                 defvalue="value1")
        field2 = simple_property(id_="item2", type_="long", defvalue=100)
        field3 = simple_property(id_="item3", type_="double", defvalue=3.14156)

    struct = struct_property(id_="DCE:ffe634c9-096d-425b-86cc-df1cce50612f",
                             name="struct_test",
                             structdef=SomeStruct)

    class AllocStruct(object):
        long_capacity = simple_property(id_="long_capacity",
                                        type_="long",
                                        defvalue=100)
        float_capacity = simple_property(id_="float_capacity",
                                         type_="float",
                                         defvalue=1.0)

        def __gt__(self, other):
            if self.long_capacity <= other.long_capacity:
                return False
            if self.float_capacity <= other.float_capacity:
                return False
            return True

        def __iadd__(self, other):
            self.long_capacity += other.long_capacity
            self.float_capacity += other.float_capacity
            return self

        def __isub__(self, other):
            self.long_capacity -= other.long_capacity
            self.float_capacity -= other.float_capacity
            return self

    allocStruct = struct_property(
        id_="DCE:001fad60-b4b3-4ed2-94cb-40e1d956bf4f",
        name="allocStruct",
        configurationkind=("configure", "allocation"),
        structdef=AllocStruct)

    structseq = structseq_property(
        id_="DCE:e836f007-5821-4671-b05a-e0ff5147fe86",
        name="structseq_test",
        structdef=SomeStruct,
        defvalue=[])
Ejemplo n.º 26
0
                               kinds=("allocation","configure"),
                               description="""This specifies the device kind"""
                               )
 device_model = simple_property(id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
                                name="device_model",
                                type_="string",
                                defvalue="",
                                mode="readonly",
                                action="eq",
                                kinds=("allocation","configure"),
                                description=""" This specifies the specific device"""
                                )
 frontend_video_allocation = struct_property(id_="FRONTEND::video_allocation",
                                             name="frontend_video_allocation",
                                             structdef=frontend_video_allocation,
                                             configurationkind=("allocation",),
                                             mode="readwrite",
                                             description="""Frontend Interfaces v2.0 main allocation structure"""
                                             )
 frontend_listener_allocation = struct_property(id_="FRONTEND::listener_allocation",
                                                name="frontend_listener_allocation",
                                                structdef=frontend_listener_allocation,
                                                configurationkind=("allocation",),
                                                mode="readwrite",
                                                description="""Allocates a listener (subscriber) based off a previous allocation """
                                                )
 frontend_video_status = structseq_property(id_="FRONTEND::video_status",
                                            name="frontend_video_status",
                                            structdef=default_frontend_video_status_struct_struct,
                                            defvalue=[],
                                            configurationkind=("configure",),
class NicExecDevice_base(CF__POA.ExecutableDevice, ExecutableDevice,
                         ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, devmgr, uuid, label, softwareProfile, compositeDevice,
                 execparams):
        ExecutableDevice.__init__(self, devmgr, uuid, label, softwareProfile,
                                  compositeDevice, execparams)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 devices.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this device

    def start(self):
        ExecutableDevice.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        ExecutableDevice.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        ExecutableDevice.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    device_kind = simple_property(
        id_="DCE:cdc5ee18-7ceb-4ae6-bf4c-31f983179b4d",
        name="device_kind",
        type_="string",
        defvalue="GPP",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description="""This specifies the device kind""")

    device_model = simple_property(
        id_="DCE:0f99b2e4-9903-4631-9846-ff349d18ecfb",
        name="device_model",
        type_="string",
        defvalue="NicExecDevice",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description=""" This specifies the specific device""")

    processor_name = simple_property(
        id_="DCE:9B445600-6C7F-11d4-A226-0050DA314CD6",
        name="processor_name",
        type_="string",
        defvalue="x86_64",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description="""SCA required property describing the CPU type""")

    os_name = simple_property(
        id_="DCE:80BF17F0-6C7F-11d4-A226-0050DA314CD6",
        name="os_name",
        type_="string",
        defvalue="Linux",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description=
        """SCA required property describing the Operating System Name""")

    os_version = simple_property(
        id_="DCE:0f3a9a37-a342-43d8-9b7f-78dc6da74192",
        name="os_version",
        type_="string",
        mode="readonly",
        action="eq",
        kinds=("allocation", ),
        description=
        """SCA required property describing the Operating System Version""")

    nic_list = simpleseq_property(id_="nic_list",
                                  type_="string",
                                  defvalue=[],
                                  mode="readonly",
                                  action="external",
                                  kinds=("property", ))

    class NicAllocation(object):
        identifier = simple_property(id_="nic_allocation::identifier",
                                     name="identifier",
                                     type_="string",
                                     defvalue="")

        interface = simple_property(id_="nic_allocation::interface",
                                    name="interface",
                                    type_="string",
                                    defvalue="")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["identifier"] = self.identifier
            d["interface"] = self.interface
            return str(d)

        @classmethod
        def getId(cls):
            return "nic_allocation"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("identifier", self.identifier),
                    ("interface", self.interface)]

    nic_allocation = struct_property(id_="nic_allocation",
                                     structdef=NicAllocation,
                                     configurationkind=("allocation", ),
                                     mode="readwrite")

    class NicAllocationStatusStruct(object):
        identifier = simple_property(id_="nic_allocation_status::identifier",
                                     name="identifier",
                                     type_="string")

        interface = simple_property(id_="nic_allocation_status::interface",
                                    name="interface",
                                    type_="string")

        def __init__(self, identifier="", interface=""):
            self.identifier = identifier
            self.interface = interface

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["identifier"] = self.identifier
            d["interface"] = self.interface
            return str(d)

        @classmethod
        def getId(cls):
            return "nic_allocation_status_struct"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("identifier", self.identifier),
                    ("interface", self.interface)]

    nic_allocation_status = structseq_property(
        id_="nic_allocation_status",
        structdef=NicAllocationStatusStruct,
        defvalue=[],
        configurationkind=("property", ),
        mode="readonly")
Ejemplo n.º 28
0
class dbwriter_base(CF__POA.Resource, Component, ThreadedComponent):
    # These values can be altered in the __init__ of your derived class

    PAUSE = 0.0125  # The amount of time to sleep if process return NOOP
    TIMEOUT = 5.0  # The amount of time to wait for the process thread to die when stop() is called
    DEFAULT_QUEUE_SIZE = 100  # The number of BulkIO packets that can be in the queue before pushPacket will block

    def __init__(self, identifier, execparams):
        loggerName = (execparams['NAME_BINDING'].replace('/',
                                                         '.')).rsplit("_",
                                                                      1)[0]
        Component.__init__(self, identifier, execparams, loggerName=loggerName)
        ThreadedComponent.__init__(self)

        # self.auto_start is deprecated and is only kept for API compatibility
        # with 1.7.X and 1.8.0 components.  This variable may be removed
        # in future releases
        self.auto_start = False
        # Instantiate the default implementations for all ports on this component
        self.port_dataFloat_in = MessageConsumerPort(thread_sleep=0.1,
                                                     parent=self)
        self.port_dataFloat_in2 = MessageConsumerPort(thread_sleep=0.1,
                                                      parent=self)

    def start(self):
        Component.start(self)
        ThreadedComponent.startThread(self, pause=self.PAUSE)

    def stop(self):
        Component.stop(self)
        if not ThreadedComponent.stopThread(self, self.TIMEOUT):
            raise CF.Resource.StopError(CF.CF_NOTSET,
                                        "Processing thread did not die")

    def releaseObject(self):
        try:
            self.stop()
        except Exception:
            self._log.exception("Error stopping")
        Component.releaseObject(self)

    ######################################################################
    # PORTS
    #
    # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file,
    # or via the IDE.

    port_dataFloat_in = providesport(
        name="dataFloat_in",
        repid="IDL:ExtendedEvent/MessageEvent:1.0",
        type_="control")

    port_dataFloat_in2 = providesport(
        name="dataFloat_in2",
        repid="IDL:ExtendedEvent/MessageEvent:1.0",
        type_="control")

    ######################################################################
    # PROPERTIES
    #
    # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
    # or by using the IDE.
    class FromUpToInsert(object):
        X = simple_property(id_="X", type_="float")

        Y = simple_property(id_="Y", type_="float")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["X"] = self.X
            d["Y"] = self.Y
            return str(d)

        @classmethod
        def getId(cls):
            return "fromUpToInsert"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("X", self.X), ("Y", self.Y)]

    fromUpToInsert = struct_property(id_="fromUpToInsert",
                                     structdef=FromUpToInsert,
                                     configurationkind=("message", ),
                                     mode="readwrite")

    class FromCentToDB(object):
        ave = simple_property(id_="ave", type_="float")

        lat = simple_property(id_="lat", type_="float")

        long = simple_property(id_="long", type_="float")

        freq = simple_property(id_="freq", type_="float")

        aoa = simple_property(id_="aoa", type_="octet")

        node = simple_property(id_="node", type_="octet")

        wave = simple_property(id_="wave", type_="float")

        comp = simple_property(id_="comp", type_="octet")

        def __init__(self, **kw):
            """Construct an initialized instance of this struct definition"""
            for classattr in type(self).__dict__.itervalues():
                if isinstance(classattr,
                              (simple_property, simpleseq_property)):
                    classattr.initialize(self)
            for k, v in kw.items():
                setattr(self, k, v)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["ave"] = self.ave
            d["lat"] = self.lat
            d["long"] = self.long
            d["freq"] = self.freq
            d["aoa"] = self.aoa
            d["node"] = self.node
            d["wave"] = self.wave
            d["comp"] = self.comp
            return str(d)

        @classmethod
        def getId(cls):
            return "fromCentToDB"

        @classmethod
        def isStruct(cls):
            return True

        def getMembers(self):
            return [("ave", self.ave), ("lat", self.lat), ("long", self.long),
                    ("freq", self.freq), ("aoa", self.aoa),
                    ("node", self.node), ("wave", self.wave),
                    ("comp", self.comp)]

    fromCentToDB = struct_property(id_="fromCentToDB",
                                   structdef=FromCentToDB,
                                   configurationkind=("property", ),
                                   mode="readwrite")
class cf_1535_p1_base(CF__POA.Resource, Component, ThreadedComponent):
        # These values can be altered in the __init__ of your derived class

        PAUSE = 0.0125 # The amount of time to sleep if process return NOOP
        TIMEOUT = 5.0 # The amount of time to wait for the process thread to die when stop() is called
        DEFAULT_QUEUE_SIZE = 100 # The number of BulkIO packets that can be in the queue before pushPacket will block

        def __init__(self, identifier, execparams):
            loggerName = (execparams['NAME_BINDING'].replace('/', '.')).rsplit("_", 1)[0]
            Component.__init__(self, identifier, execparams, loggerName=loggerName)
            ThreadedComponent.__init__(self)

            # self.auto_start is deprecated and is only kept for API compatibility
            # with 1.7.X and 1.8.0 components.  This variable may be removed
            # in future releases
            self.auto_start = False
            # Instantiate the default implementations for all ports on this component
            self.port_d1 = bulkio.InLongPort("d1", maxsize=self.DEFAULT_QUEUE_SIZE)
            self.port_d3 = bulkio.OutLongPort("d3")

        def start(self):
            Component.start(self)
            ThreadedComponent.startThread(self, pause=self.PAUSE)

        def stop(self):
            Component.stop(self)
            if not ThreadedComponent.stopThread(self, self.TIMEOUT):
                raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")

        def releaseObject(self):
            try:
                self.stop()
            except Exception:
                self._log.exception("Error stopping")
            Component.releaseObject(self)

        ######################################################################
        # PORTS
        # 
        # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file, 
        # or via the IDE.

        port_d1 = providesport(name="d1",
                               repid="IDL:BULKIO/dataLong:1.0",
                               type_="data")

        port_d3 = usesport(name="d3",
                           repid="IDL:BULKIO/dataLong:1.0",
                           type_="data")

        ######################################################################
        # PROPERTIES
        # 
        # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
        # or by using the IDE.
        p1 = simple_property(id_="p1",
                             name="p1",
                             type_="string",
                             mode="readwrite",
                             action="external",
                             kinds=("property",),
                             description="""can you dig it { ( [""")


        window = simple_property(id_="window",
                                 name="window",
                                 type_="string",
                                 mode="readwrite",
                                 action="external",
                                 kinds=("property",))


        freq = simple_property(id_="freq",
                               name="freq",
                               type_="float",
                               defvalue=0.0,
                               mode="readwrite",
                               action="external",
                               kinds=("property",))


        s1 = simpleseq_property(id_="s1",
                                name="s1",
                                type_="long",
                                defvalue=[],
                                mode="readwrite",
                                action="external",
                                kinds=("property",))


        class St1(object):
            a1 = simple_property(
                                 id_="st1::a1",
                                 name="a1",
                                 type_="string")
        
            b1 = simple_property(
                                 id_="st1::b1",
                                 name="b1",
                                 type_="float")
        
            def __init__(self, **kw):
                """Construct an initialized instance of this struct definition"""
                for classattr in type(self).__dict__.itervalues():
                    if isinstance(classattr, (simple_property, simpleseq_property)):
                        classattr.initialize(self)
                for k,v in kw.items():
                    setattr(self,k,v)
        
            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["a1"] = self.a1
                d["b1"] = self.b1
                return str(d)
        
            @classmethod
            def getId(cls):
                return "st1"
        
            @classmethod
            def isStruct(cls):
                return True
        
            def getMembers(self):
                return [("a1",self.a1),("b1",self.b1)]

        st1 = struct_property(id_="st1",
                              name="st1",
                              structdef=St1,
                              configurationkind=("property",),
                              mode="readwrite")


        class Ss1St1(object):
            a1 = simple_property(
                                 id_="ss1::st1::a1",
                                 name="a1",
                                 type_="string")
        
            b1 = simple_property(
                                 id_="ss1::st1::b1",
                                 name="b1",
                                 type_="float")
        
            def __init__(self, a1="", b1=0.0):
                self.a1 = a1
                self.b1 = b1
        
            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["a1"] = self.a1
                d["b1"] = self.b1
                return str(d)
        
            @classmethod
            def getId(cls):
                return "ss1::st1"
        
            @classmethod
            def isStruct(cls):
                return True
        
            def getMembers(self):
                return [("a1",self.a1),("b1",self.b1)]

        ss1 = structseq_property(id_="ss1",
                                 name="ss1",
                                 structdef=Ss1St1,
                                 defvalue=[],
                                 configurationkind=("property",),
                                 mode="readwrite")
class PropertyChangeEvents(CF__POA.Resource, Resource):
    """
    Example component to send property change events to an EventChannel port.
    """

    myprop = simple_property(id_="myprop",
                             type_="long",
                             name="myprop",
                             defvalue=0,
                             mode="readwrite",
                             action="external",
                             kinds=("configure", "event"))

    anotherprop = simple_property(id_="anotherprop",
                                  type_="long",
                                  name="anotherprop",
                                  defvalue=0,
                                  mode="readwrite",
                                  action="external",
                                  kinds=("configure", ))

    propEvent = usesport(name="propEvent",
                         repid="IDL:CosEventChannelAdmin/EventChannel:1.0",
                         type_="data")

    seqprop = simpleseq_property(id_="seqprop",
                                 type_="float",
                                 defvalue=None,
                                 mode="readwrite",
                                 action="external",
                                 kinds=("configure", "event"))

    class SomeStruct(object):
        some_number = simple_property(
            id_="some_number",
            type_="double",
        )
        some_string = simple_property(
            id_="some_string",
            type_="string",
        )

        def __init__(self):
            """Construct an initialized instance of this struct definition"""
            for attrname, classattr in type(self).__dict__.items():
                if type(classattr) == simple_property:
                    classattr.initialize(self)

        def __str__(self):
            """Return a string representation of this structure"""
            d = {}
            d["some_number"] = self.some_number
            d["some_string"] = self.some_string
            return str(d)

        def isStruct(self):
            return True

        def getMembers(self):
            return [("some_number", self.some_number),
                    ("some_string", self.some_string)]

    def __init__(self, identifier, execparams):
        Resource.__init__(self, identifier, execparams)

    def initialize(self):
        self.propEvent = PropertyEventSupplier(self)

    some_struct = struct_property(id_="some_struct",
                                  structdef=SomeStruct,
                                  configurationkind=("configure", "event"),
                                  mode="readwrite")
    structseq_prop = structseq_property(id_="structseq_prop",
                                        structdef=SomeStruct,
                                        defvalue=[],
                                        configurationkind=("configure",
                                                           "event"),
                                        mode="readwrite")

    def start(self):
        self.myprop = 123
        self.anotherprop = 123
        self.seqprop = [1.0]
        self.some_struct.some_number = 123.0
        tmp = self.SomeStruct()
        tmp.some_number = 2.0
        tmp.some_string = "another string"
        newval = copy.deepcopy(self.structseq_prop)
        newval.append(tmp)
        self.structseq_prop = newval

    def runTest(self, testid, properties):
        if testid == 1061:
            # Ticket #1061: Ensure that if an eventable struct or struct sequence
            # has None for both the current and prior values, sendChangedPropertiesEvent
            # does not raise an exception.

            # Save values of struct and struct sequence properties
            saved_struct = copy.deepcopy(self.some_struct)
            saved_structseq = copy.deepcopy(self.structseq_prop)

            self.some_struct = None
            self.saved_structseq = None
            try:
                # Send two consecutive property change events so that the current
                # and saved values are both None.
                self.propEvent.sendChangedPropertiesEvent()
                self.propEvent.sendChangedPropertiesEvent()
                success = True
            except:
                success = False
            results = [CF.DataType('1061', any.to_any(success))]

            # Restore saved state
            self.some_struct = saved_struct
            self.saved_structseq = saved_structseq
        else:
            raise CF.TestableObject.UnknownTest('No test %d' % testid)
        return results
class ticket_cf_1066_comp_base(CF__POA.Resource, Resource):
        # These values can be altered in the __init__ of your derived class

        PAUSE = 0.0125 # The amount of time to sleep if process return NOOP
        TIMEOUT = 5.0 # The amount of time to wait for the process thread to die when stop() is called
        DEFAULT_QUEUE_SIZE = 100 # The number of BulkIO packets that can be in the queue before pushPacket will block
        
        def __init__(self, identifier, execparams):
            loggerName = (execparams['NAME_BINDING'].replace('/', '.')).rsplit("_", 1)[0]
            Resource.__init__(self, identifier, execparams, loggerName=loggerName)
            self.threadControlLock = threading.RLock()
            self.process_thread = None
            # self.auto_start is deprecated and is only kept for API compatability
            # with 1.7.X and 1.8.0 components.  This variable may be removed
            # in future releases
            self.auto_start = False
            
        def initialize(self):
            Resource.initialize(self)
            
            # Instantiate the default implementations for all ports on this component


        def start(self):
            self.threadControlLock.acquire()
            try:
                Resource.start(self)
                if self.process_thread == None:
                    self.process_thread = ProcessThread(target=self.process, pause=self.PAUSE)
                    self.process_thread.start()
            finally:
                self.threadControlLock.release()

        def process(self):
            """The process method should process a single "chunk" of data and then return.  This method will be called
            from the processing thread again, and again, and again until it returns FINISH or stop() is called on the
            component.  If no work is performed, then return NOOP"""
            raise NotImplementedError

        def stop(self):
            self.threadControlLock.acquire()
            try:
                process_thread = self.process_thread
                self.process_thread = None

                if process_thread != None:
                    process_thread.stop()
                    process_thread.join(self.TIMEOUT)
                    if process_thread.isAlive():
                        raise CF.Resource.StopError(CF.CF_NOTSET, "Processing thread did not die")
                Resource.stop(self)
            finally:
                self.threadControlLock.release()

        def releaseObject(self):
            try:
                self.stop()
            except Exception:
                self._log.exception("Error stopping")
            self.threadControlLock.acquire()
            try:
                Resource.releaseObject(self)
            finally:
                self.threadControlLock.release()

        ######################################################################
        # PORTS
        # 
        # DO NOT ADD NEW PORTS HERE.  You can add ports in your derived class, in the SCD xml file, 
        # or via the IDE.
                

        ######################################################################
        # PROPERTIES
        # 
        # DO NOT ADD NEW PROPERTIES HERE.  You can add properties in your derived class, in the PRF xml file
        # or by using the IDE.       
        simple_prop = simple_property(id_="simple_prop",
                                          type_="string",
                                          defvalue="default_value",
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          ) 
        seq_prop = simpleseq_property(id_="seq_prop",  
                                          type_="short",
                                          defvalue=(111,222,333),
                                          mode="readwrite",
                                          action="external",
                                          kinds=("configure",)
                                          )
        class StructProp(object):
            prop_one = simple_property(id_="prop_one",
                                          type_="boolean",
                                          defvalue=True,
                                          )
            prop_two = simple_property(id_="prop_two",
                                          type_="string",
                                          defvalue="This is another default value",
                                          )
            prop_three = simple_property(id_="prop_three",
                                          type_="float",
                                          defvalue=555,
                                          )
        
            def __init__(self, **kw):
                """Construct an initialized instance of this struct definition"""
                for attrname, classattr in type(self).__dict__.items():
                    if type(classattr) == simple_property:
                        classattr.initialize(self)
                for k,v in kw.items():
                    setattr(self,k,v)

            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["prop_one"] = self.prop_one
                d["prop_two"] = self.prop_two
                d["prop_three"] = self.prop_three
                return str(d)

            def getId(self):
                return "struct_prop"

            def isStruct(self):
                return True

            def getMembers(self):
                return [("prop_one",self.prop_one),("prop_two",self.prop_two),("prop_three",self.prop_three)]

        
        struct_prop = struct_property(id_="struct_prop",
                                          structdef=StructProp,
                                          configurationkind=("configure",),
                                          mode="readwrite"
                                          )
        class TmpStruct(object):
            prop_four = simple_property(id_="prop_four",
                                          type_="string",
                                          defvalue="yet another default",
                                          )
            prop_five = simple_property(id_="prop_five",
                                          type_="long",
                                          defvalue=246,
                                          )
            prop_six = simple_property(id_="prop_six",
                                          type_="double",
                                          defvalue=135,
                                          )
        
            def __init__(self, prop_four="", prop_five=0, prop_six=0):
                self.prop_four = prop_four
                self.prop_five = prop_five
                self.prop_six = prop_six

            def __str__(self):
                """Return a string representation of this structure"""
                d = {}
                d["prop_four"] = self.prop_four
                d["prop_five"] = self.prop_five
                d["prop_six"] = self.prop_six
                return str(d)

            def getId(self):
                return "tmp_struct"

            def isStruct(self):
                return True

            def getMembers(self):
                return [("prop_four",self.prop_four),("prop_five",self.prop_five),("prop_six",self.prop_six)]

                
        struct_seq_prop = structseq_property(id_="struct_seq_prop",
                                          structdef=TmpStruct,                          
                                          defvalue=[],
                                          configurationkind=("configure",),
                                          mode="readwrite"
                                          )