Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies...

27
Asynchronous Method Invocation through Connectors Custom DDS Connectors IDL to C++11

Transcript of Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies...

Page 1: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Asynchronous Method Invocation through Connectors

Custom DDS Connectors

IDL to C++11

Page 2: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Why AMI4CCM?

LwCCM has no standardized way to perform an asynchronous method invocation between two components

Each project and developer solves this challenge differently

Need a standardized solution to align implementations and models

Copyright © 2013 2

Page 3: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Requirements AMI4CCM

Pure client side solution

Shall not extend the LwCCM specification

Reuse the Generic Interaction Support (GIS) that was introduced by DDS4CCM and which is now part of the CCM specification

Copyright © 2013 3

Page 4: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

AMI4CCM Connector (1)

Copyright © 2013 4

Page 5: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

AMI4CCM Connector (2)

Copyright © 2013 5

Page 6: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Conversion rules

AMI4CCM defines a set of conversion rules how to convert a regular interface to • Asynchronous invocation interface • Reply handler interface • Callback for the successful case • Callback for the error case

Naming rules are based on CORBA AMI • Reply handler is a local interface

Copyright © 2013 6

Page 7: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Conclusion

AMI4CCM introduces asynchronous method invocation for CCM

Doesn’t extend the CCM core

Reuses GIS from CCM

Copyright © 2013 7

Page 8: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Custom DDS Connectors

Copyright © 2013 8

Page 9: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

How to you create your connector?

Define your connector in IDL • Define your own types, exceptions, and interfaces • Extend standard port types • Use an IDL templated module when possible

Implement your connector • Use for example the extensible GIS connector

framework as part of CIAO

Copyright © 2013 9

Page 10: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

NGC Teton connectors (1)

Publish Subscribe Attachment Transfert (PSAT) • High performance, general purpose & location

independent pub-sub transport of wideband data with DDS signaling

Signal Processing Data Model (SPDM) • PSAT extension to support transport of OMG

VSIPL++ or VSIPL blocks and views for signal and image processing applications

Copyright © 2013 10

Page 11: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

NGC Teton connectors (2)

Application Instrumentation (AI) • Simplification of the DDS PSM, providing a very

easy to use encapsulation of the in development OMG AI standard for binary data instrumentation

Discovery • Directory services access to support dynamic,

runtime registration, discovery/lookup and binding of component service endpoints and topic data

Copyright © 2013 11

Page 12: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

NGC Teton connectors (3)

More details can be found as part of the presentation delivered by Mark Hayman from Northrop Grumman at the OMG Reston 2013 Component Workshop

Copyright © 2013 12

Page 13: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

IDL to C++11

Copyright © 2013 13

Page 14: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Why a new language mapping?

IDL to C++ language mapping is impossible to change because • Multiple implementations are on the market (open

source and commercial) • A huge amount of applications have been developed

An updated IDL to C++ language mapping would force vendors and users to update their products The standardization of a new C++ revision in 2011 (ISO/IEC 14882:2011, called C++11) gives the opportunity to define a new language mapping • C++11 features are not backward compatible with

C++03 or C++99 • A new C++11 mapping leaves the existing mapping

intact

Copyright © 2013 14

Page 15: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Goals

Simplify mapping for C++

Make use of the new C++11 features to • Reduce amount of application code • Reduce amount of possible errors made • Gain runtime performance • Speedup development and testing • Faster time to market • Reduced costs • Reduced training time

Copyright © 2013 15

Page 16: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Basic types

Copyright © 2013 16

IDL C++11 Default value

short int16_t 0

long int32_t 0

long long int64_t 0

unsigned short uint16_t 0

unsigned long uint32_t 0

unsigned long long uint64_t 0

float float 0.0

double double 0.0

long double long double 0.0

char char 0

wchar wchar_t 0

boolean bool false

octet uint8_t 0

Page 17: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

String types

No need to introduce an IDL specific type mapping but leverage STL

string name; wstring w_name;

Copyright © 2013 17

IDL C++11 std::string name; std::wstring w_name; name = “Hello”; std::cout << name << std::endl;

Page 18: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Sequence

IDL unbounded sequence maps to std::vector typedef sequence<long> LongSeq;

Copyright © 2013 18

IDL C++11 typedef std::vector <int32_t>

LongSeq; LongSeq mysequence; // Add an element to the vector mysequence.push_back (5); // Dump using C++11 range based loop for (const int32_t& e : mysequence) { std::cout << e << “;” << std::end; }

Page 19: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Reference types (1)

An IDL interface maps to so called reference types

Reference types are reference counted, given type A • Strong reference type behaves like std::shared_ptr

and is available as IDL::traits<A>::ref_type • Weak reference type behaves like std::weak_ptr and

is available as IDL::traits<A>::weak_ref_type A nil reference type is represented as nullptr

Invoking an operation on a nil reference results in a INV_OBJREF exception

Copyright © 2013 19

Page 20: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Reference types (2)

Given IDL type A the mapping delivers IDL::traits<A> with type traits interface A { // definitions };

Copyright © 2013 20

IDL C++11 // Obtain a reference IDL::traits<A>::ref_type a = // obtain a // reference // Obtain a weak reference IDL::traits<A>::weak_ref_type w =

a.weak_reference(); // Obtain a strong reference from a weak // one IDL::traits<A>::ref_type p = w.lock (); if (a == nullptr) // Legal comparisons if (a != nullptr ) // legal comparison if (a) // legal usage, true if a != nullptr if (!a) // legal usage, true if a == // nullptr if (a == 0) // illegal, results in a // compile error delete a; // illegal, results in a compile //error

Page 21: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Components with C++11

Component executors are local object implementations

Implemented as C++ classes using standardized C++ traits

Method signatures will be different compared to the IDL to C++ mapping

Implementation can use the new C++11 features

Copyright © 2013 21

Page 22: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Conclusion IDL to C++11

IDL to C++11 simplifies programming

The combination of reference counting and C++11 move semantics make the code much safer and secure

Application code is much smaller and easier to read

Examples, tutorials and a more detailed comparison is available online at http://osportal.remedy.nl

Copyright © 2013 22

Page 23: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

Want to know more?

Check the ORBzone.org, the community site for CORBA, CCM, and related technologies

Check the Remedy IT provided examples at http://osportal.remedy.nl

Contact us, see http://www.theaceorb.nl or http://www.remedy.nl

23 Copyright © 2013

Page 24: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

CCM Implementations

Copyright © 2013 24

Page 25: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

CIAO as implementation

Open source LwCCM implementation using IDL to C++ • Optional support for CCM navigation • Profile to disable CCM event support

Uses TAO for all of its infrastructure

Support for DDS4CCM using OpenDDS and RTI Connext DDS as underlying DDS implementations

Support for AMI4CCM

Available from http://download.dre.vanderbilt.edu

Copyright © 2013 25

Page 26: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

CIAOX11 as implementation

LwCCM implementation using IDL to C++11

Deviates from LwCCM towards UCM

Clean separation between CORBA and the user component executors

Current plan is to release CIAOX11 as open source LwCCM implementation using a similar license as CIAO

New CIAOX11 high level architecture would also work with other programming languages

Copyright © 2013 26

Page 27: Asynchronous Method Invocation through Connectors IDL to C++11 · IDL to C++11 simplifies programming The combination of reference counting and C++11 move semantics make the code

DAnCE

Open source implementation of the OMG D&C standard using the IDL to C++ language mapping

Uses TAO as CORBA implementation

Introduces LocalityManager as component server • CIAOX11 will deliver its own C++11 LocalityManager

and will reuse the other services from the C++ DAnCE version

Defines a set of plugins to customize its behavior

Copyright © 2013 27