예제 #1
0
def generate(module_builder, local_ns, global_ns):
    """
    local_ns: is the namespace that corresponds to the given namespace
    global_ns: is the module builder for the entire library
    """

    local_ns.exclude()
    classes = []

    module_builder.class_('::ram::core::Subsystem').already_exposed = True

    # NetworkPublisher
    NetworkPublisher = local_ns.class_('NetworkPublisher')
    NetworkPublisher.include()
    classes.append(NetworkPublisher)

    events = wrap.expose_events(local_ns)

    if events:
        wrap.make_already_exposed(global_ns, 'ram::core', ['Event'])
        classes += events

    wrap.registerSubsystemConverter(NetworkPublisher)

    wrap.add_needed_includes(classes)

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/network/include/RegisterFunctions.h'
            ] + list(include_files)
예제 #2
0
def generate(module_builder, local_ns, global_ns):
    """
    local_ns: is the namespace that corresponds to the given namespace
    global_ns: is the module builder for the entire library
    """

    local_ns.exclude()
    classes = []

    module_builder.class_('::ram::core::Subsystem').already_exposed = True

    # NetworkPublisher
    NetworkPublisher = local_ns.class_('NetworkPublisher')
    NetworkPublisher.include()
    classes.append(NetworkPublisher)

    events = wrap.expose_events(local_ns)

    if events:
        wrap.make_already_exposed(global_ns, 'ram::core', ['Event'])
        classes += events

    wrap.registerSubsystemConverter(NetworkPublisher)

    wrap.add_needed_includes(classes)

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/network/include/RegisterFunctions.h'] + list(include_files)
예제 #3
0
def generate(module_builder, local_ns, global_ns):
    classes = []

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True
    module_builder.class_('::ram::math::Vector3').already_exposed = True
    Quaternion = module_builder.class_('::ram::math::Quaternion')
    Quaternion.already_exposed = True
    Quaternion.constructors().allow_implicit_conversion = False

    # Include controller classes
    IController = local_ns.class_('IController')
    IController.include()

    IController.include_files.append(os.environ['RAM_SVN_DIR'] +
                                     '/packages/control/include/IController.h')
    classes.append(IController)

    # Include desired state class
    DesiredState = global_ns.class_('DesiredState')
    DesiredState.include()
    DesiredState.include_files.append(
        os.environ['RAM_SVN_DIR'] + '/packages/control/include/DesiredState.h')
    classes.append(DesiredState)

    yawVehicleHelper = local_ns.free_function('yawVehicleHelper')
    pitchVehicleHelper = local_ns.free_function('pitchVehicleHelper')
    rollVehicleHelper = local_ns.free_function('rollVehicleHelper')
    holdCurrentHeadingHelper = local_ns.free_function(
        'holdCurrentHeadingHelper')

    yawVehicleHelper.include()
    pitchVehicleHelper.include()
    rollVehicleHelper.include()
    holdCurrentHeadingHelper.include()

    # Wrap Events
    events = wrap.expose_events(local_ns)

    if events:
        wrap.make_already_exposed(global_ns, 'ram::core', ['Event'])
        classes += events

    # Add a castTo
    wrap.registerSubsystemConverter(IController)

    wrap.add_needed_includes(classes)
    module_builder.add_registration_code("registerIControllerPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    include_files.add('packages/control/include/Helpers.h')
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/control/include/RegisterFunctions.h'
            ] + list(include_files)
예제 #4
0
def generate(module_builder, local_ns, global_ns):
    classes = []

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True
    module_builder.class_('::ram::math::Vector3').already_exposed = True
    Quaternion = module_builder.class_('::ram::math::Quaternion')
    Quaternion.already_exposed = True
    Quaternion.constructors().allow_implicit_conversion = False

    # Include controller classes
    IController = local_ns.class_('IController')
    IController.include()
    
    IController.include_files.append(os.environ['RAM_SVN_DIR'] +
                                     '/packages/control/include/IController.h')
    classes.append(IController)

    # Include desired state class
    DesiredState = global_ns.class_('DesiredState')
    DesiredState.include()
    DesiredState.include_files.append(os.environ['RAM_SVN_DIR'] +
                                     '/packages/control/include/DesiredState.h')
    classes.append(DesiredState)

    yawVehicleHelper = local_ns.free_function('yawVehicleHelper')
    pitchVehicleHelper = local_ns.free_function('pitchVehicleHelper')
    rollVehicleHelper = local_ns.free_function('rollVehicleHelper')
    holdCurrentHeadingHelper = local_ns.free_function('holdCurrentHeadingHelper')

    yawVehicleHelper.include()
    pitchVehicleHelper.include()
    rollVehicleHelper.include()
    holdCurrentHeadingHelper.include()

    # Wrap Events
    events = wrap.expose_events(local_ns)

    if events:
        wrap.make_already_exposed(global_ns, 'ram::core', ['Event'])
        classes += events

    # Add a castTo
    wrap.registerSubsystemConverter(IController)

    wrap.add_needed_includes(classes)
#    wrap.make_already_exposed(global_ns, 'ram::pattern', 'Subject')
    module_builder.add_registration_code("registerIControllerPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    include_files.add('packages/control/include/Helpers.h')
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/control/include/RegisterFunctions.h'] + list(include_files)
예제 #5
0
def generate(module_builder, local_ns, global_ns):
    """
    local_ns: is the namespace that coresponds to the given namespace
    global_ns: is the module builder for the entire library
    """
    classes = []

    local_ns.exclude()

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True
    module_builder.class_('::ram::math::Vector3').already_exposed = True
    module_builder.class_('::ram::math::Vector2').already_exposed = True
    Quaternion = module_builder.class_('::ram::math::Quaternion')
    Quaternion.already_exposed = True
    Quaternion.constructors().allow_implicit_conversion = False

    # Wrap Events
    events = wrap.expose_events(local_ns)
    if events:
        module_builder.class_('::ram::core::Event').already_exposed = True
        classes += events

    # Include obstacle class
    Obstacle = local_ns.class_('Obstacle')
    Obstacle.include()

    Obstacle.include_files.append(os.environ['RAM_SVN_DIR'] +
                                  '/packages/estimation/include/Obstacle.h')

    # Include state estimator class
    IStateEstimator = local_ns.class_('IStateEstimator')
    IStateEstimator.include()

    IStateEstimator.include_files.append(
        os.environ['RAM_SVN_DIR'] +
        '/packages/estimation/include/IStateEstimator.h')
    classes.append(IStateEstimator)

    wrap.registerSubsystemConverter(IStateEstimator)

    module_builder.add_registration_code("registerIStateEstimatorPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/estimation/include/RegisterFunctions.h'
            ] + list(include_files)
예제 #6
0
def generate(module_builder, local_ns, global_ns):
    """
    local_ns: is the namespace that coresponds to the given namespace
    global_ns: is the module builder for the entire library
    """
    classes = []

    local_ns.exclude()

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True
    module_builder.class_('::ram::math::Vector3').already_exposed = True
    module_builder.class_('::ram::math::Vector2').already_exposed = True
    Quaternion = module_builder.class_('::ram::math::Quaternion')
    Quaternion.already_exposed = True
    Quaternion.constructors().allow_implicit_conversion = False

    # Wrap Events
    events = wrap.expose_events(local_ns)
    if events:
        module_builder.class_('::ram::core::Event').already_exposed = True
        classes += events

    # Include obstacle class
    Obstacle = local_ns.class_('Obstacle')
    Obstacle.include()

    Obstacle.include_files.append(os.environ['RAM_SVN_DIR'] +
                                  '/packages/estimation/include/Obstacle.h')

    # Include state estimator class
    IStateEstimator = local_ns.class_('IStateEstimator')
    IStateEstimator.include()

    IStateEstimator.include_files.append(os.environ['RAM_SVN_DIR'] +
                                         '/packages/estimation/include/IStateEstimator.h')
    classes.append(IStateEstimator)

    wrap.registerSubsystemConverter(IStateEstimator)

    module_builder.add_registration_code("registerIStateEstimatorPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/estimation/include/RegisterFunctions.h'] + list(include_files)
예제 #7
0
def generate(module_builder, local_ns, global_ns):
    """
    name: is the name of the module being wrapped (in name::space::form)
    global_ns: is the module builder for the entire library
    local_ns: is the namespace that coresponds to the given namespace
    """

    # Remove all those pesky warnings about only pointed to types!
    for cls in local_ns.decls(decl_type=decls_package.class_declaration_t):
        cls.include()
        cls.already_exposed = True

    module_builder.class_('::ram::core::Subsystem').already_exposed = True

    classes = []

    # Include IVehicle class and handle special cases
    IVehicle = local_ns.class_('IVehicle')
    IVehicle.include()
    classes.append(IVehicle)

    # Remove default wrapper for getDevice
    IVehicle.member_function('getDevice').exclude()

    # Provide the normal one by hand, so C++ users of python subclasses
    # still get the overridden method
    IVehicle.add_wrapper_code("""
    virtual ::ram::vehicle::device::IDevicePtr getDevice( ::std::string name ){
        bp::override func = this->get_override(\"getDevice\");
        return func( name);
    }
    """)

    # Provide a hand made implementation for Python users of C++ IVehicle
    # subclasses, this uses our custom converter to ensure proper IDevice
    # downcasting
    IVehicle.add_declaration_code("""
    boost::python::object pyGetDevice(
        ram::vehicle::IVehicle& veh,
        std::string deviceName)
    {
        ram::vehicle::device::IDevicePtr device =
            veh.getDevice(deviceName);
        return ram::vehicle::device::IDeviceConverter::convertObject(device);
    }
    """)
    IVehicle.add_registration_code("def(\"getDevice\", &::pyGetDevice)",
                                   works_on_instance = True )
    IVehicle.include_files.append('vehicle/include/device/IDeviceConverter.h')

    global_ns.typedef('TempNameList').type.declaration.already_exposed = True
    global_ns.typedef('TempList').include()

    # Fix TempNameList (the include does stick)
    t = global_ns.class_(function =
                         lambda x: x.name.startswith('vector<std::string'))
    t.already_exposed = True

    # Fix overley long std::container names
    #wrap.mangle_container_names(local_ns)

    # Wrap Events
    events = wrap.expose_events(local_ns)
    if events:
        module_builder.class_('::ram::core::Event').already_exposed = True
        classes += events
    
    # Added the needed includes
    wrap.add_needed_includes(classes)
    IVehicle.include_files.append(os.environ['RAM_SVN_DIR'] +
                                  '/packages/vehicle/include/device/IDevice.h')

    # Add a castTo
    wrap.registerSubsystemConverter(IVehicle)

    module_builder.add_registration_code("registerIVehiclePtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/vehicle/include/RegisterFunctions.h'] + list(include_files)
예제 #8
0
def generate(module_builder, local_ns, global_ns):
    """
    name: is the name of the module being wrapped (in name::space::form)
    global_ns: is the module builder for the entire library
    local_ns: is the namespace that coresponds to the given namespace
    """

    # Remove all those pesky warnings about only pointed to types!
    for cls in local_ns.decls(decl_type=decls_package.class_declaration_t):
        cls.include()
        cls.already_exposed = True

    module_builder.class_('::ram::core::Subsystem').already_exposed = True

    classes = []

    # Include IVehicle class and handle special cases
    IVehicle = local_ns.class_('IVehicle')
    IVehicle.include()
    classes.append(IVehicle)

    # Remove default wrapper for getDevice
    IVehicle.member_function('getDevice').exclude()

    # Provide the normal one by hand, so C++ users of python subclasses
    # still get the overridden method
    IVehicle.add_wrapper_code("""
    virtual ::ram::vehicle::device::IDevicePtr getDevice( ::std::string name ){
        bp::override func = this->get_override(\"getDevice\");
        return func( name);
    }
    """)

    # Provide a hand made implementation for Python users of C++ IVehicle
    # subclasses, this uses our custom converter to ensure proper IDevice
    # downcasting
    IVehicle.add_declaration_code("""
    boost::python::object pyGetDevice(
        ram::vehicle::IVehicle& veh,
        std::string deviceName)
    {
        ram::vehicle::device::IDevicePtr device =
            veh.getDevice(deviceName);
        return ram::vehicle::device::IDeviceConverter::convertObject(device);
    }
    """)
    IVehicle.add_registration_code("def(\"getDevice\", &::pyGetDevice)",
                                   works_on_instance=True)
    IVehicle.include_files.append('vehicle/include/device/IDeviceConverter.h')

    global_ns.typedef('TempNameList').type.declaration.already_exposed = True
    global_ns.typedef('TempList').include()

    # Fix TempNameList (the include does stick)
    t = global_ns.class_(
        function=lambda x: x.name.startswith('vector<std::string'))
    t.already_exposed = True

    # Fix overley long std::container names
    #wrap.mangle_container_names(local_ns)

    # Wrap Events
    events = wrap.expose_events(local_ns)
    if events:
        module_builder.class_('::ram::core::Event').already_exposed = True
        classes += events

    # Added the needed includes
    wrap.add_needed_includes(classes)
    IVehicle.include_files.append(os.environ['RAM_SVN_DIR'] +
                                  '/packages/vehicle/include/device/IDevice.h')

    # Add a castTo
    wrap.registerSubsystemConverter(IVehicle)

    module_builder.add_registration_code("registerIVehiclePtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/vehicle/include/RegisterFunctions.h'
            ] + list(include_files)