15 May, 2015 CORBA Object-by-Value An overview of the value type and its IDL-to-C++ mapping. George Edwards Institute for Software-Integrated Systems Vanderbilt.

Slides:



Advertisements
Similar presentations
CORBA Architecture Nitin Prabhu. Outline CORBA Object Model CORBA Architecture Static Invocation Dynamic Invocation CORBA Communication Model.
Advertisements

ITEC200 – Week03 Inheritance and Class Hierarchies.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Persistent State Service 1 CORBA Component  Component model  Container programming model  Component implementation framework  Component packaging and.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
C++ Training Datascope Lawrence D’Antonio Lecture 4 An Overview of C++: What is a Class/Object?
II. Middleware for Distributed Systems
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Lecture 9 Concepts of Programming Languages
CS 2511 Fall  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance  Polymorphism.
Chapter 13: Object-Oriented Programming
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
Inheritance and Polymorphism CS351 – Programming Paradigms.
Lecture 6: Polymorphism - The fourth pillar of OOP - 1.
Object Based Programming. Summary Slide  Instantiating An Object  Encapsulation  Inheritance  Polymorphism –Overriding Methods –Overloading vs. Overriding.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
Chapter 4 Inheritance Bernard Chen Spring Objective IS-A relationships and the allowable changes for derived classes The concept of polymorphism.
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Inheritance in C++ CS-1030 Dr. Mark L. Hornick.
Module 7: Object-Oriented Programming in Visual Basic .NET
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Information Management NTU Interprocess Communication and Middleware.
C++ Review Classes and Object Oriented Programming Parasol Lab, Texas A&M University.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Defining New Types Lecture 21 Hartmut Kaiser
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Chapter 11: Introduction to Classes. In this chapter you will learn about: – Classes – Basic class functions – Adding class functions – A case study involving.
CSSE501 Object-Oriented Development. Chapter 4: Classes and Methods  Chapters 4 and 5 present two sides of OOP: Chapter 4 discusses the static, compile.
Module 10: Inheritance in C#. Overview Deriving Classes Implementing Methods Using Sealed Classes Using Interfaces Using Abstract Classes.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Advanced C# Types Tom Roeder CS fa. From last time out parameters difference is that the callee is required to assign it before returning not the.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Object-Oriented Programming Chapter Chapter
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
A Quick CCM Example. Tutorial on CCM Introduction A Simple Sender&Receiver Scenario Sender sends out the click-out event to inform the Receiver. Receiver.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
Introduction to Object-Oriented Programming Lesson 2.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Object-Oriented Design Concepts University of Sunderland.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
OBJECT ORIENTED PROGRAMMING. Design principles for organizing code into user-defined types Principles include: Encapsulation Inheritance Polymorphism.
The const Keyword Extreme Encapsulation. Humble Beginnings There are often cases in coding where it is helpful to use a const variable in a method or.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Inheritance in C++ Bryce Boe 2012/08/28 CS32, Summer 2012 B.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
These materials where developed by Martin Schray
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
OOP: Encapsulation &Abstraction
Review: Two Programming Paradigms
Programming Models for Distributed Application
Corresponds with Chapter 7
CORBA Object-by-Value
CORBA Object-by-Value
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Jim Fawcett CSE687 – Object Oriented Design Spring 2014
C++ Object Oriented 1.
Creating and Using Classes
Presentation transcript:

15 May, 2015 CORBA Object-by-Value An overview of the value type and its IDL-to-C++ mapping. George Edwards Institute for Software-Integrated Systems Vanderbilt University

November 17, 2003 George Edwards CORBA Object-by-Value What is Object-by-Value? ¥Object-by-Value (OBV) is the CORBA mechanism for enabling objects to have pass-by-value semantics in CORBA operations. ¥Conventional CORBA objects always have pass-by-reference semantics.  The IDL keyword valuetype declares an object that will be passed by value. ¥Valuetype instances are guaranteed to be local to the context in which they are used.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Object-by-Value Semantics ¥ OBV implies similar semantics to pass- by-value in standard programming languages.  The receiving entity of a valuetype parameter (or returned object) instantiates a new object with identical state to the parameter.  The new instance has a separate identity and no relationship to the caller’s parameter. ¥ OBV requires that the receiving entity have access to an implementation of the valuetype.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value When to Use Valuetypes Valuetypes are often useful when:  An application needs a “copy” of an object.  An object’s primary purpose is encapsulation of data, rather than operation implementations. ¥ An application needs the performance predictability of local method invocations. ¥ An application needs to transfer an arbitrarily complex or recursive tree, lattice, or other graph data structure. CASE STUDY: Valuetypes in the CORBA Component Model CCM employs valuetypes for events and cookies. ¥ Events are messages that are transmitted asynchronously between components. ¥ Cookies encapsulate port connection ID information.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Basic Valuetype Capabilities An IDL valuetype can: ¥ have operations, public and private attributes, and factories. ¥ be recursively defined.  be declared abstract. ¥ inherit from a single concrete valuetype. ¥ inherit from multiple abstract valuetypes. Valuetypes in CCM (cont.) An abstract valuetype serves as a base for all event types. When a IDL eventtype is declared, a valuetype that inherits from EventBase is implied. module Components { abstract valuetype EventBase {}; }; Cookies store connection identifiers as a sequence of octets: module Components { valuetype Cookie { private CORBA::OctetSeq cookieValue; };

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Valuetype C++ Mapping (1/3) An IDL valuetype maps to an abstract base class with the same name... class Cookie : public virtual CORBA::ValueBase { //... protected: virtual void cookieValue ( const CORBA::OctetSeq &) = 0; virtual const CORBA::OctetSeq& cookieValue (void) const = 0; virtual CORBA::OctetSeq& cookieValue (void) = 0; Cookie (void); virtual ~Cookie (void); //... };  Inherits from CORBA::ValueBase. • Pure virtual methods corresponding to operations. • Pure virtual accessor and modifier methods corresponding to state members. • Protected default constructor and destructor.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Valuetype C++ Mapping (2/3) …a class with “OBV_” prepended to the fully-scoped name… • Inherits from the abstract base class. • Is abstract if the valuetype has operations; concrete otherwise. • Provides default implementations of accessors and modifiers. • Provides a protected constructor that initializes state members. namespace OBV_Components { class Cookie : public virtual Components::Cookie { //... protected: virtual void cookieValue ( const CORBA::OctetSeq &); virtual CORBA::OctetSeq& cookieValue (void); Cookie (const CORBA::OctetSeq&); private: CORBA::OctetSeq _pd_cookieValue; //... };

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Valuetype C++ Mapping (3/3) ¥ Inherits from CORBA::ValueFactoryBase. ¥ Each factory method declared in IDL maps to pure virtual method that returns an instance of the valuetype. ¥ Must be registered with the ORB via ORB::register_value_factory(). …and a factory class with “_init” appended to the valuetype name. class Cookie_init : public virtual CORBA::ValueFactoryBase { public: Cookie_init (void); virtual CORBA::ValueBase * create_for_unmarshal (void); protected: virtual ~Cookie_init (void); };

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Unmarshaling Valuetypes  The ORB calls create_for_unmarshal() to create an instance of a valuetype received as a parameter or return type.  The factory class is concrete for valueboxes and valuetypes that have no IDL factories or operations; an implementation of create_for_unmarshal() is generated.  Otherwise, the programmer must provide an implementation of create_for_unmarshal() and any factories declared in IDL. ValueFactoryBase declares a pure virtual create_for_unmarshal() method. class ValueFactoryBase { public: void _add_ref (void); void _remove_ref (void); virtual CORBA::ValueBase * create_for_unmarshal (void)=0; virtual CORBA::AbstractBase * create_for_unmarshal_abstract(); };

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Abstract Valuetypes  Have only operations – no state or factories. ¥ Have no generated OBV_ classes. ¥ Are not subject to single inheritance restrictions. ¥ Are inherited as public virtual base classes. ¥ Cannot be instantiated; cannot be parameters or the return type of an IDL operation. ¥ Essentially just a bundle of operation signatures. An IDL valuetype can be declared abstract. abstract interface abstract valuetype single multiple

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Supporting a Concrete Interface ¥A valuetype that supports a concrete interface is NOT a subtype of the interface and is NOT substitutable.  The interface’s operations are mapped to pure virtual methods in the valuetype ABC. ¥A skeleton (POA_) class is generated for the valuetype that inherits from the interface skeleton. ¥The valuetype can be registered with a POA and manipulated via an object reference of the interface type; pass- by-reference semantics apply. A valuetype is declared to support a concrete interface with the IDL keyword supports.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Supporting an Abstract Interface  Abstract interfaces inherit from CORBA::AbstractBase, not CORBA::Object. ¥Abstract interfaces have unique parameter passing semantics to their operations. ¥A valuetype that supports an abstract interface IS a subtype of the interface and IS substitutable. ¥Allows determination of pass-by- value vs. pass-by-reference semantics to be made at run-time. Valuetypes can support multiple abstract interfaces.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Reference Counting  CORBA::ValueBase declares pure virtual _add_ref() and _remove_ref() methods.  CORBA::DefaultValueRefCountBase can serve as a base class for valuetypes that will never be registered with a POA.  PortableServer::ValueRefCountBase must serve as a base class for valuetypes that will be registered with a POA. Valuetypes must fulfill the ValueBase reference counting interface with custom implementations or mix-in classes.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Other Features ¥ Any IDL type except a valuetype can be boxed. ¥ Valueboxes may not be a subtype or base type.  Valueboxes for string and wstring are included in the CORBA module as StringValue and WStringValue. A valuetype with only a single state member is a “valuebox.” A programmer can provide custom code to marshal and unmarshal valuetype instances.  A valuetype that is declared custom in IDL implicitly inherits from the abstract valuetype CustomMarshal.  The concrete valuetype must provide implementations of the marshal () and unmarshal () operations. ¥ Intended to facilitate the integration of legacy code.

Vanderbilt UniversityNovember 17, 2003 George Edwards CORBA Object-by-Value Conclusions ¥The valuetype is extremely useful, but: –Has some convoluted mapping rules.  Doesn’t totally solve the original problem.  Standard CORBA objects still can’t be passed by value. –Has some questionable features. ¥Questions?