Beispiel #1
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)
Beispiel #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)
Beispiel #3
0
def initAlreadyExposedClasses(module_builder):
	# Elenco delle classi esposte manualmente
	already_exposed_classes = ["::boost::posix_time::ptime",					       
					       "::osiris::String"]

	for c in already_exposed_classes:
		module_builder.class_(c).already_exposed = True
Beispiel #4
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
    """
    global_ns.exclude()
    classes = []

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True

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

    events = wrap.expose_events(local_ns)

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

    # Do class wide items
    wrap.add_needed_includes(classes)

    # Add registrations functions for hand wrapped classes
    module_builder.add_registration_code("registerLoggingPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/logging/include/RegisterFunctions.h'] + list(include_files)
Beispiel #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
    """
    global_ns.exclude()
    classes = []

    # Mark class from other modules as already exposed
    module_builder.class_('::ram::core::Subsystem').already_exposed = True

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

    events = wrap.expose_events(local_ns)

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

    # Do class wide items
    wrap.add_needed_includes(classes)

    # Add registrations functions for hand wrapped classes
    module_builder.add_registration_code("registerLoggingPtrs();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/logging/include/RegisterFunctions.h'
            ] + list(include_files)
Beispiel #6
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)
Beispiel #7
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)
Beispiel #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)
def generate(module_builder, local_ns, global_ns):
    """
    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::EventPublisher').already_exposed = True
    module_builder.class_('::ram::core::IUpdatable').already_exposed = True

    wrappedClasses = []

    # Wrap IDevice Class
    IDevice = expose_device(local_ns, 'IDevice', register = False);
    wrappedClasses.append(IDevice)

    # Wrap the thruster class
    IThruster = expose_device(local_ns, 'IThruster')
    wrappedClasses.append(IThruster)

    # Wrap the IDepthSensor class
    IDepthSensor = expose_device(local_ns, 'IDepthSensor')
    wrappedClasses.append(IDepthSensor)

    # Wrap marker interfaces (slightly abuse expose device)
    IVoltageProvider = expose_device(local_ns, 'IVoltageProvider',
                                     register = False)
    wrappedClasses.append(IVoltageProvider)
    ICurrentProvider = expose_device(local_ns, 'ICurrentProvider',
                                     register = False)
    wrappedClasses.append(ICurrentProvider)

    # Wrap the IPowerSource class
    IPowerSource = expose_device(local_ns, 'IPowerSource')
    wrappedClasses.append(IPowerSource)

    # Wrap the ITempSensor class
    ITempSensor = expose_device(local_ns, 'ITempSensor')
    wrappedClasses.append(ITempSensor)

    # Wrap the IIMU class
    IIMU = expose_device(local_ns, 'IIMU')
    wrappedClasses.append(IIMU)

    # Wrap the ISonar class
    ISonar = expose_device(local_ns, 'ISonar')
    wrappedClasses.append(ISonar)

    # Wrap the IPayloadSet class
    IPayloadSet = expose_device(local_ns, 'IPayloadSet')
    wrappedClasses.append(IPayloadSet)

    # Wrap the IVelocitySensor class
    IVelocitySensor = expose_device(local_ns, 'IVelocitySensor')
    wrappedClasses.append(IVelocitySensor)

    # Wrap the IPositionSensor class
    IPositionSensor = expose_device(local_ns, 'IPositionSensor')
    wrappedClasses.append(IPositionSensor)

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

    module_builder.add_registration_code("registerIDeviceMakerClass();")
    module_builder.add_registration_code("registerIDevicePtrs();")
    wrap.add_needed_includes(wrappedClasses)

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

    # Lets Py++ know to make VisionSystem a subclass of Subsystem
    module_builder.class_('::ram::core::Subsystem').already_exposed = True
    module_builder.class_('::ram::core::Event').already_exposed = True

    # Vision System
    VisionSystem = local_ns.class_('VisionSystem')
    VisionSystem.include()
    VisionSystem.include_files.append('vision/include/Camera.h')
    classes.append(VisionSystem)   

    # Wrap Events
    EventType = local_ns.class_('EventType')
    EventType.include()
    classes.append(EventType)

    Symbol = local_ns.class_('Symbol')
    Symbol.include()
    Symbol.member_function('getSymbolNames').exclude()
    Symbol.member_function('symbolToText').exclude()
    classes.append(Symbol)

    Color = local_ns.class_('Color')
    Color.include()
    Color.member_function('getColorNames').exclude()
    Color.member_function('colorToText').exclude()
    classes.append(Color)
    
    events = wrap.expose_events(local_ns)
    classes += events

    ImageEvent = local_ns.class_('ImageEvent')
    ImageEvent.include_files.append('vision/include/Image.h')
    wrap.set_implicit_conversions([ImageEvent], False)

    BinEvent = local_ns.class_('BinEvent')
    wrap.set_implicit_conversions([BinEvent], False)

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

    # Append the approaite include files
#    for cls in classes:
#        cls.include()
    wrap.add_needed_includes(classes)

    module_builder.add_registration_code("registerImageClass();")
    module_builder.add_registration_code("registerCameraClass();")

    include_files = set([cls.location.file_name for cls in classes])
    for cls in classes:
        include_files.update(cls.include_files)
    return ['wrappers/vision/include/RegisterFunctions.h'] + list(include_files)
def generate(module_builder, local_ns, global_ns):
    """
    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::EventPublisher').already_exposed = True
    module_builder.class_('::ram::core::IUpdatable').already_exposed = True

    wrappedClasses = []

    # Wrap IDevice Class
    IDevice = expose_device(local_ns, 'IDevice', register=False)
    wrappedClasses.append(IDevice)

    # Wrap the thruster class
    IThruster = expose_device(local_ns, 'IThruster')
    wrappedClasses.append(IThruster)

    # Wrap the IDepthSensor class
    IDepthSensor = expose_device(local_ns, 'IDepthSensor')
    wrappedClasses.append(IDepthSensor)

    # Wrap marker interfaces (slightly abuse expose device)
    IVoltageProvider = expose_device(local_ns,
                                     'IVoltageProvider',
                                     register=False)
    wrappedClasses.append(IVoltageProvider)
    ICurrentProvider = expose_device(local_ns,
                                     'ICurrentProvider',
                                     register=False)
    wrappedClasses.append(ICurrentProvider)

    # Wrap the IPowerSource class
    IPowerSource = expose_device(local_ns, 'IPowerSource')
    wrappedClasses.append(IPowerSource)

    # Wrap the ITempSensor class
    ITempSensor = expose_device(local_ns, 'ITempSensor')
    wrappedClasses.append(ITempSensor)

    # Wrap the IIMU class
    IIMU = expose_device(local_ns, 'IIMU')
    wrappedClasses.append(IIMU)

    # Wrap the ISonar class
    ISonar = expose_device(local_ns, 'ISonar')
    wrappedClasses.append(ISonar)

    # Wrap the IPayloadSet class
    IPayloadSet = expose_device(local_ns, 'IPayloadSet')
    wrappedClasses.append(IPayloadSet)

    # Wrap the IVelocitySensor class
    IVelocitySensor = expose_device(local_ns, 'IVelocitySensor')
    wrappedClasses.append(IVelocitySensor)

    # Wrap the IPositionSensor class
    IPositionSensor = expose_device(local_ns, 'IPositionSensor')
    wrappedClasses.append(IPositionSensor)

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

    module_builder.add_registration_code("registerIDeviceMakerClass();")
    module_builder.add_registration_code("registerIDevicePtrs();")
    wrap.add_needed_includes(wrappedClasses)

    include_files = set([cls.location.file_name for cls in wrappedClasses])
    for cls in wrappedClasses:
        include_files.update(cls.include_files)
    return [
        'wrappers/vehicle/include/RegisterFunctions.h', 'core/include/Event.h'
    ] + list(include_files)
Beispiel #12
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)