IDL to C++0x/C++11
                   Initial submission

                      OMG document mars/2011-09-04




Copyright © 2011                                     Page 1
RFP asks for

        The new mapping should be functionally equivalent to the existing
        IDL to C++ mapping. While the syntax may change, an application
        should be able to implement functionality identical to that which can
        be achieved with the current IDL to C++ mapping.
        Applications programmed using alternative language mappings
        should inter operate transparently. An application utilizing this new
        language mapping should have no awareness, other than
        informational, of what language mapping a peer application is using.
        The new language mapping should be designed to co-exist with
        other technologies. Specifically, it should not interfere with the
        namespaces used by other OMG specifications, or commonly used
        packages.
        Interoperability between the IDL to C++ and IDL to C++0x mapping in
        the same compilation unit is not required.
Copyright © 2011                                                          Page 2
C++11

        C++0x was unanimously approved August 12 th
        2011
        Is now formally available as ISO/IEC 14882:2011
        Unofficially named C++11




Copyright © 2011                                      Page 3
Goal of IDL to C++11

        Simplified mapping for C++11
        Make use of the new C++11 features to
          –   Gain performance
          –   Reduce coding errors
          –   Reduce amount of code
          –   No need to create conversion between STL/C++
              types and IDL based types




Copyright © 2011                                             Page 4
Concepts

        Map basic types to their C++11 counterparts
        IDL (w)string map to std::(w)string
        IDL sequences map to std::vector




Copyright © 2011                                      Page 5
Interface mapping

        When defining interface Foo, than Foo is the
        object reference
        C++ traits are used to determine the type for
        the proxy and skeleton base classes, not the
        name and how they are implemented
         –   Foo::local_base_type
         –   Foo::servant_type
         –   Foo::servant_base_type
        Foo as object reference has the semantics of
        std::shared_ptr<>
Copyright © 2011                                        Page 6
Nil object references

        C++11 has a new type for a nil pointer: nullptr_t
        Object references can be checked for nil by
        comparing them with nullptr
        Explicit bool conversion operators for usage in
        for example if statements




Copyright © 2011                                            Page 7
Argument passing

        Argument passing is the same for any type
          –   in: const T&
          –   inout: T&
          –   out: T&
          –   return: T
        C++ method interfaces will not change if for
        example a typedef is changed from basic type
        to complex type.


Copyright © 2011                                       Page 8
Struct/union


       Struct and union now both map to a C++ class
       Providing constructor(s), copy and move
       operators
       Set of accessors for each member:
        –          void A (const T&);
        –          void A (T&&);
        –          const T& A (void) const;
        –          T& A (void);


Copyright © 2011                                        Page 9
What next?

        Address comments on initial submission
        Add mapping for arrays/abstract/valuetype/any
        Extend mapping with sequence traits, ostream
        insertion operators, and more if needed
        Check out IDL annotations when they are part of
        the formal IDL specification. Mostly interesting for
        user defined mapping of IDL types.



Copyright © 2011                                          Page 10
Proof of concept

        New language binding for TAO: IDL2C++11
        Supports the initial submission and more
        More details on http://osportal.remedy.nl and
        http://www.orbzone.org




Copyright © 2011                                        Page 11
Thanks for your attention



                      Johnny Willemsen
                   <jwillemsen@remedy.nl>



                   http://www.theaceorb.nl
Copyright © 2011                               Page 12

IDL to C++11 initial submission presentation

  • 1.
    IDL to C++0x/C++11 Initial submission OMG document mars/2011-09-04 Copyright © 2011 Page 1
  • 2.
    RFP asks for The new mapping should be functionally equivalent to the existing IDL to C++ mapping. While the syntax may change, an application should be able to implement functionality identical to that which can be achieved with the current IDL to C++ mapping. Applications programmed using alternative language mappings should inter operate transparently. An application utilizing this new language mapping should have no awareness, other than informational, of what language mapping a peer application is using. The new language mapping should be designed to co-exist with other technologies. Specifically, it should not interfere with the namespaces used by other OMG specifications, or commonly used packages. Interoperability between the IDL to C++ and IDL to C++0x mapping in the same compilation unit is not required. Copyright © 2011 Page 2
  • 3.
    C++11 C++0x was unanimously approved August 12 th 2011 Is now formally available as ISO/IEC 14882:2011 Unofficially named C++11 Copyright © 2011 Page 3
  • 4.
    Goal of IDLto C++11 Simplified mapping for C++11 Make use of the new C++11 features to – Gain performance – Reduce coding errors – Reduce amount of code – No need to create conversion between STL/C++ types and IDL based types Copyright © 2011 Page 4
  • 5.
    Concepts Map basic types to their C++11 counterparts IDL (w)string map to std::(w)string IDL sequences map to std::vector Copyright © 2011 Page 5
  • 6.
    Interface mapping When defining interface Foo, than Foo is the object reference C++ traits are used to determine the type for the proxy and skeleton base classes, not the name and how they are implemented – Foo::local_base_type – Foo::servant_type – Foo::servant_base_type Foo as object reference has the semantics of std::shared_ptr<> Copyright © 2011 Page 6
  • 7.
    Nil object references C++11 has a new type for a nil pointer: nullptr_t Object references can be checked for nil by comparing them with nullptr Explicit bool conversion operators for usage in for example if statements Copyright © 2011 Page 7
  • 8.
    Argument passing Argument passing is the same for any type – in: const T& – inout: T& – out: T& – return: T C++ method interfaces will not change if for example a typedef is changed from basic type to complex type. Copyright © 2011 Page 8
  • 9.
    Struct/union Struct and union now both map to a C++ class Providing constructor(s), copy and move operators Set of accessors for each member: – void A (const T&); – void A (T&&); – const T& A (void) const; – T& A (void); Copyright © 2011 Page 9
  • 10.
    What next? Address comments on initial submission Add mapping for arrays/abstract/valuetype/any Extend mapping with sequence traits, ostream insertion operators, and more if needed Check out IDL annotations when they are part of the formal IDL specification. Mostly interesting for user defined mapping of IDL types. Copyright © 2011 Page 10
  • 11.
    Proof of concept New language binding for TAO: IDL2C++11 Supports the initial submission and more More details on http://osportal.remedy.nl and http://www.orbzone.org Copyright © 2011 Page 11
  • 12.
    Thanks for yourattention Johnny Willemsen <jwillemsen@remedy.nl> http://www.theaceorb.nl Copyright © 2011 Page 12