CORBA Any’s and TypeCodes Martin Senger

Slides:



Advertisements
Similar presentations
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
Advertisements

ESO - Tokyo July, 2005 ALMA Common Software Training- Course Session 1b Distributed Systems G.Chiozzi.
Programming Languages and Paradigms The C Programming Language.
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
Computer Science 209 Software Development Equality and Comparisons.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Chapter 7:: Data Types Programming Language Pragmatics
Intro to OOP with Java, C. Thomas Wu Inheritance and Polymorphism
C#: Data Types Based on slides by Joe Hummel. 2 UCN Technology: Computer Science Content: “.NET is designed around the CTS, or Common Type System.
CORBA Architecture Nitin Prabhu. Outline CORBA Object Model CORBA Architecture Static Invocation Dynamic Invocation CORBA Communication Model.
CORBA IDL 1 Introduction to CORBA IDL Overview  OMG IDL is purely a descriptive language  OMG IDL obeys the same lexical rules as C++  OMG IDL grammar.
Netprog CORBA Intro1 CORBA Common Object Request Broker Architecture Based partially on Notes by D. Hollinger and Java Network Programming and Distributed.
A brief look at CORBA. What is CORBA Common Object Request Broker Architecture developed by OMG Combine benefits of OO and distributed computing Distributed.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
Principles of Object-Oriented Software Development Interface Definition Language.
IDL Interface Definition Language. IDL products Interface repository Dynamic Interface Static skeletons Client IDL stubs Dynamic skeletons Server Object.
What is a class? a class definition is a blueprint to build objects its like you use the blueprint for a house to build many houses in the same way you.
II. Middleware for Distributed Systems
Dynamic Object Requests 1  Outline  Motivating Examples  Dynamic Invocation  Reflection  Designing Generic Applications.
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
September 21, 2005 Dynamic Typing in CORBA Middleware Jeff Parsons ISIS Vanderbilt University Nashville, TN.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
JavaServer Pages Syntax Harry Richard Erwin, PhD CSE301/CIT304.
Java. Why Java? It’s the current “hot” language It’s almost entirely object-oriented It has a vast library of predefined objects It’s platform independent.
Copyright © 2003 ProsoftTraining. All rights reserved. Distributed Object Computing Using Java and CORBA.
H Research Issues in CORBA Peter de Jong Hewlett-Packard Usenix 8/12/97 Research Issues in CORBA What keeps CORBA people awake at Night! Peter de Jong.
CORBA Distributed Technology CASE STUDY Juan C. Navarro.
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
C Tokens Identifiers Keywords Constants Operators Special symbols.
Information Management NTU Interprocess Communication and Middleware.
Copyright (c) Qusay H. Mahmoud 1 The Naming Service (Client’s View) A tree-like directory for object references Much like a file system: provides directory.
Introduction to Java University of Sunderland CSE301 Harry R. Erwin, PhD.
JAVA 0. HAFTA Algorithms FOURTH EDITION Robert Sedgewick and Kevin Wayne Princeton University.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
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.
CSE 425: Data Types I Data and Data Types Data may be more abstract than their representation –E.g., integer (unbounded) vs. 64-bit int (bounded) A language.
Dynamic Invocation Interface Alternative to using IDL stubs Object cannot distinguish between the two. How is DII different for the programmer?
Introduction to Java COM379 (Part-Time) University of Sunderland Harry R Erwin, PhD.
Types in programming languages1 What are types, and why do we need them?
Simple Classes. ADTs A specification for a real world data item –defines types and valid ranges –defines valid operations on the data. Specification is.
1 Chapter 2 C++ Syntax and Semantics, and the Program Development Process.
Chapter 14 Abstract Classes and Interfaces. Abstract Classes An abstract class extracts common features and functionality of a family of objects An abstract.
Generic lists Vassilis Athitsos. Problems With Textbook Interface? Suppose that we fix the first problem, and we can have multiple stacks. Can we have.
3C-1 Purity Typing Language semantics Inheritance model  Single vs. Multiple inheritance  Common root Modular mechanisms Generics Object Oriented Languages.
CORBA (Common Object Request Broker Architechture) Aniket Prabhune Varun Saini Balaprasuna Chennupati Lally Singh.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
C++ for Java Programmers Chapter 2. Fundamental Daty Types Timothy Budd.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
CS2102: Lecture on Abstract Classes and Inheritance Kathi Fisler.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Day 3: The Command and Visitor Patterns. Preliminaries The Java static type system uses simple rules to infer types for Java expressions. The inferred.
Data Types (1) 1 Programming Languages – Principles and Practice by Kenneth C Louden.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
CORBA Antonio Vasquez, John Shelton, Nidia, Ruben.
Interface Definition Language
CORBA (Common Object Request Broker Architecture)
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Building a CORBA Server
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
CS 363 – Chapter 7 Chapter 7 – type systems Types that are supported
Programming Language C Language.
Java Programming Language
Lab4 problems More about templates Some STL
Classes, Objects and Methods
CS2013 Lecture 7 John Hurley Cal State LA.
Copyright © 2001 Qusay H. Mahmoud
Building Blocks of C Programming Language
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

CORBA Any’s and TypeCodes Martin Senger

We want something, but we do not know what... Type-safety vs. flexibility –type-safe are objects with type known at the compile time - but it limits developers –most often the type-safe problems end by crashing programs - but not breaking security –inheritance is (probably) also sort of type- unsafe Methods to find the “real” type: –type-casting, narrowing, testing a variable,...

In CORBA, there are: org.omg.CORBA.Object –a super-class to all CORBA Objects –represents (only) interfaces –narrowing to the “real” type can be costly Any –and we are going to talk about it in details... DynAny –that’s a new story… - an extension of Any’s

A place of Any’s in CORBA Entity Object reference Value Type Abstract Interface Basic Value Constructed Values Struct Sequence Union Array Short Long LongLong UShort ULong ULongLong Float Double LongDouble Fixed Char WChar String WString Boolean Octet Enum Any

Some features... The any type permits the specification of values that can express any OMG IDL type An any contains a TypeCode and a value that is described by the TypeCode Each IDL language mapping provides operations that allow to insert and access the TypeCode and value contained in an any

Remember: The golden rule You can pass in Any only “things” whose types are known to the receiving program already in time of compilation Therefore the “things” in Any can be only –basic IDL types (boolean, float,…) –sequences of (most) basic IDL types String and WString are exceptions –types defined in IDL files known to both sites of communication

Creating Any’s (in Java) create an empty Any: Any any = orb.create_any(); insert the value into the Any –for basic IDL types: String str = “Hello World”; any.insert_string (str); –for compiled IDL types use their Helper classes: MyClass myClass = new MyClass (…); MyClassHelper.insert (any, myClass); –for sequences of basic IDL types use their Helper classes that are provided by ORB: int[] myNumbers = new int[] { 1, 2, 3, 4, 6 }; ShortSeqHelper.insert (any, myNumbers);

Extracting from Any’s (in Java) extract the value from an Any –for basic IDL types: int number = any.extract_short(); –for compiled IDL types use their Helper classes: MyClass myClass = MyClassHelper.extract (any); –for sequences of basic IDL types use their Helper classes that are provided by ORB: int[] myNumbers = ShortSeqHelper.extract (any); of course, first you have to know what type you have got in the Any...

CORBA TypeCodes TypeCodes are values that represent data types TypeCode is described as a CORBA interface –with methods to enquire what type it represents, –to ask if two TypeCodes are equal or equivalent, –and with some exceptions (BadParam, Bounds) TypeCodes are used in Any’s, by Interface Repository, by DII, etc...

The contents of a TypeCode a “kind” field enum TCKind { tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong, tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box, tk_native, tk_abstract_interface }; a set of parameters appropriate for that “kind”

TypeCode parameters From the book: “Advanced CORBA Programming with C++” by Michi Henning and Steve Vinoski Each TypeCode has a “kind” field... …and for each “kind” field it has different parameters

Some TypeCode’s special kinds tk_null –this TC does not describe anything (“not-there” condition) tk_TypeCode –to insert TypeCodes into an Any tk_alias –describes typedef definitions tk_any –because an Any can contain another Any tk_void –used in the Interface Repository (never in Any’s)

Where TypeCodes come from don’t bother, usually they are created for you Helper classes have method returning TC: TypeCode tc = MyClassHelper.type(); ORB has methods for creating TC’s (examples): TypeCode create_struct_tc ( in RepositoryId id, in Identifier name, in StructMemberSeq members); TypeCode get_primitive_tc (in TCKind tcKind);

Notes on hands-on [skipping Any’s => will be done in Property Service hands-on] TypeCodes –go to directory “ TypeCodes ” –compile “ ExerciseTypeCodes.idl ” –implement conversion methods “ stringToEnum ”, “ enumToString ”, and “ printAll ” in the example “ ReadingColors.java ” –hint: look what parameters are available for “kind” enum