Python/Tango Client Binding Swig (www.swig.org)www.swig.org Vs Boost (www.boost.org)

Slides:



Advertisements
Similar presentations
A Crash Course Python. Python? Isn’t that a snake? Yes, but it is also a...
Advertisements

German Cancio – WP4 developments Partner Logo WP4-install plans WP6 meeting, Paris project conference
Android architecture overview
Wrapping C++ with Perl Brian Magill March SWIG (Simplified Wrapper and Interface Generator) Wraps C++ with Perl or other computer languages Generates.
Binding python to other languages (Fortran and C).
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
TerascaleSimulation Tools and Technologies Tutorial: Presenter Institution.
Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department Asst.Prof.Dr.Ahmet Ünveren SPRING Computer Engineering Department.
Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
Introduction to .Net Framework
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
OpenFlow Tutorial Theophilus Benson. Outline Components in an OpenFlow testbed Setting up a testbed Writing a new component – C++ components version –
NeSC Grid Apps Workshop Exposing Legacy Applications as OGSI Components using pyGlobus Keith R. Jackson Distributed Systems Department Lawrence Berkeley.
Libsecondlife: Bots Hyungwook Park. LSL vs. libsecondlife Linden Script Language (LSL)  Programming language used by residents of Second Life  Controls.
Introduction .NET Framework
Dessy, 17 september 2007 Tango Meeting Development of Tango Client Applications in Python Tiago Coutinho and Josep Ribas.
K. Harrison CERN, 20th April 2004 AJDL interface and LCG submission - Overview of AJDL - Using AJDL from Python - LCG submission.
Parallel Interactive Computing with PyTrilinos and IPython Bill Spotz, SNL (Brian Granger, Tech-X Corporation) November 8, 2007 Trilinos Users Group Meeting.
Managed C++. Objectives Overview to Visual C++.NET Concepts and architecture Developing with Managed Extensions for C++ Use cases Managed C++, Visual.
Chapter 2: Everything is an Object ● C++ has many non object oriented features inherited from C. It is a hybrid language meaning that it support different.
Class Inheritance UNC-CHAPEL HILL COMP 401 BRIAN CRISTANTE 5 FEBRUARY 2015.
Algorithm Programming Bar-Ilan University תשס"ח by Moshe Fresko.
Programming Language C++ Xulong Peng CSC415 Programming Languages.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
Writing Perl Extensions: There’s more than one way to do it.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
CNS  Executive Overview  Template Parameters  Function Template Issues 2 CNS Templates.
PVSSProxy The first piece of the MACS procedure framework (ProShell) Angela Brett.
C# Versus Java Author: Eaddy, Marc Source: Software Tools for the Professional Programmer. Dr. Dobb's Journal. Feb2001, Vol. 26 Issue 2, p74 Hong Lu CS699A.
Copyright © CISST ERC, 2005 NSF Engineering Research Center for Computer Integrated Surgical Systems and Technology The CISST Software Package Peter Kazanzides.
Microscope Middleware Stand 29. Mai Microscope Manager Design Java SWIG MMCoreJ_wrap C++ MMCore C++ Device Drivers 1 class, 244 methods 6306 loc,
Chapters 1-5 Review C++ Class. Chapter 1 – the big picture Objects Class Inheritance Reusability Polymorphism and Overloading.
1 EPICS Bus Errors & Power PC u VME Bus Error can generate a Machine Check Exception (MCE) u The WRS mv2700 BSP doesn’t have code to do this u Write cycles.
Chapter 4 – Threads (Pgs 153 – 174). Threads  A "Basic Unit of CPU Utilization"  A technique that assists in performing parallel computation by setting.
The course. Description Computer systems programming using the C language – And possibly a little C++ Translation of C into assembly language Introduction.
Aug 9, CMSC 202 ArrayList. Aug 9, What’s an Array List ArrayList is  a class in the standard Java libraries that can hold any type of object.
JACO JACO - Java Access to C++ Objects Mark Dönszelmann and Tony Johnson 25 May 2000.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
AreaDetector workshop Summary and notes…. Overview iocBuilder File Writer Changes areaDetector driver pattern shared vector Asyn client without an IOC.
Siena Computational Crystallography School 2005
Writing EPICS Channel Access Clients in Python Geoff Savage March 2003.
Managing C++ CHRIS DAHLBERG MID-TIER DEVELOPER SCOTTRADE.
Gaudi Framework Tutorial, Interfacing Gaudi with Python.
Structured Component Composition Frameworks for Embedded System Design Sandeep Shukla, Virginia Tech. Frederic Doucet, Rajesh Gupta University of California,
Introduction to C# By: Abir Ghattas Michel Barakat.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
Wel come To Seminar On C#.
SRM “Multiple Inheritance for PyTango Device Classes” 21st Tango Meeting, 14th May A Multiple Inheritance Mechanism for PyTango Device Classes Sergi.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
EGEE is a project funded by the European Union under contract IST Installation and configuration of gLite services Robert Harakaly, CERN,
1/18/2000STScI Software Workshop Object-oriented Design Elements of the OPUS Application Programming Interface Data Processing Team.
Status of SEAL LCG Applications Area Meeting 22 July 2003 P. Mato / CERN Contents Overview Work Packages Status Summary.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 15: Java Basics Fundamentals of Web Programming.
Updates to CaPython/CaChannel John Hammonds Beamline Controls and Data Acquisition Group APS Engineering Support Division EPICS Collaboration Meeting INFN.
FASTFAST All rights reserved © MEP Make programming fun again.
From C to C++. 2 Why C++ is much more fun than C (C++ FAQ)? 1.Classes & methods - OO design 2.Generic programming - Templates allow for code reuse 3.Stricter.
September 24th 2006, aKademy The Design and Implementation of KJSEmbed Richard Moore,
Pixy Python API Charlotte Weaver.
Scripting Languages Info derived largely from Programming Language Pragmatics, by Michael Scott.
From C to C++.
Introduction Python is an interpreted, object-oriented and high-level programming language, which is different from a compiled one like C/C++/Java. Its.
From C to C++.
Object-Orientated Programming
An Overview of Java.
CMPE419 Mobile Application Development
CORBA usage within the TANGO control system
CSE 303 Concepts and Tools for Software Development
Towards a Boost Free PyTango
CMPE419 Mobile Application Development
Presentation transcript:

Python/Tango Client Binding Swig ( Vs Boost (

Swig wrapping Compiles interfaces connecting C/C++ code to scripting languages (Perl, Python, …) Generates glue code (wrappers) that scripting language needs to access underlying C/C++ code

Swig C++ supported features Classes Virtual functions Pubilc inheritance Operator overloading References templates

Swig unsupported C++ features Namespaces Functions and method overloading Nested classes Overloaded versions of certain operators (new, delete, etc.)

Boost Is a set of free portable C++ source libraries Some of the libraries have already been proposed for inclusion in the C++ Standard Library Among available libraries : any, date_time, math, pool, python, smart_ptr, thread, timer

Boost.Python wrapping Boost.python is a C++ library which enables seamless interoperability between C++ and Python Allows python to access C++ functions and data directly as if they were written in Python Does not involve any changes to the code

Boost.Python supported features References and Pointers Globally registered type coercions Automatic cross-module type conversions Efficient function overloading C++ to Python Exception translation Manipulating python objects in C++ Documentation strings

Tango Client Binding Using boost.python

#include class DeviceProxy { public: DeviceProxy(std::string name) : deviceName(name) { deviceProxy = new Tango::DeviceProxy(deviceName); } boost::python::dict info(); Tango::DevState state(); std::string status(); int ping(); int get_idl_version(); void set_source(Tango::DevSource source); Tango::DevSource get_source(); boost::python::tuple black_box(int n); boost::python::dict import_info(); boost::python::dict command_query(std::string command); boost::python::list command_list_query(); std::string description(); boost::python::object command_inout(std::string name, boost::python::object pyData); };

#include  BOOST_PYTHON_MODULE(PyTango) { using namespace boost::python; enum_ ("DevState").value("ON",Tango::ON).value("OFF",Tango::OFF).value("CLOSE",Tango::CLOSE) .value("UNKNOWN",Tango::UNKNOWN) ; enum_ ("DevSource").value("DEV",Tango::DEV).value("CACHE",Tango::CACHE).value("CACHE_DEV",Tango::CACHE_DEV) ; enum_ ("DispLevel").value("OPERATOR",Tango::OPERATOR).value("EXPERT",Tango::EXPERT) ; class_ ("DeviceProxy", init ()).def("status", &DeviceProxy::status).def("description", &DeviceProxy::description).def("ping", &DeviceProxy::ping) .def("command_query", &DeviceProxy::command_query).def("command_list_query", &DeviceProxy::command_list_query).def("command_inout", &DeviceProxy::command_inout) ; }

python Python (#1, Apr , 13:10:27) [GCC (Red Hat Linux )] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import PyTango >>> dev = PyTango.DeviceProxy("tango/tangotest/1") >>> dev.info() {'server_host': 'ganymede.synchrotron-soleil.fr', 'server_id': 'tangotest/1', 'dev_type': 0, 'dev_class': 'TangoTest', 'doc_url': ' 'server_version': 2} >>> dev.description() 'A TANGO device' >>> dev.command_inout("DevString","Hello, World!") 'Hello, World!' >>>