Tuesday, April 18, 2006

Interfaces, Local Interfaces, ValueTypes and Abstract Interfaces

CORBA IDL Series Continued (Part 2)

OMG IDL Interface:

Interfaces form the heart of the client-server contract. In IDL it is represented using the following EBNF -

<interface> ::= <interface_dcl> <forward_dcl>

<interface_dcl> ::= <interface_header> “{” <interface_body> “}”

<forward_dcl> ::= [ “abstract” “local” ] “interface” <identifier>

<interface_header> ::= [ “abstract” “local” ] “interface”
<identifier> [ <interface_inheritance_spec> ]

<interface_body> ::= <export>*

<export> ::= <type_dcl> “;” <const_dcl> “;” <except_dcl> “;” <attr_dcl> “;” <op_dcl> “;”

Interfaces also forms a namespace for identifiers scoped inside it. Apart from the attribute and operation declarations, types, exceptions and constants can also be defined inside an interface namespace.

Interfaces support multiple inheritance.

Salient notes about Interfaces

Derived interfaces can redefine any identifier previously defined in the base interfaces, but for attributes and operations.

An interface cannot be direct base of another more than once; however it can be indirect base multiple times. For example

interface A {...}
interface B : A {...}
interface C : A, B {...} // okay
interface D : A, B, A {...} // error

Derived interfaces can refer identifiers defined in base interfaces by using complete scope. The references need to obviously unambiguous. Also references to identifiers get bound to interface when they are defined. Their binding does not change if it is redefined. For example

const long L = 3;
interface A {
typedef float coord[L]:
void f (in coord s); // s has three floats
};
interface B {
const long L = 4;
};
interface C: B, A { }; // f is still taking fload coord[3]

Local Interfaces:

These interfaces cannot be marshalled out - sent in a remote operation; hence are local. Any type containing these themselves become local. They can however be used in valuetype operations. Also valuetypes can support a single local interface as supporting an interface does not make the valuetype syb types of the inetrface. Such valuetypes can then be marshalled.

The table below shows inheritance structures


-----------------------------
I LI AI VT BVT AVT
-----------------------------
I M - M - - -
-----------------------------
LI M M M - - -
-----------------------------
AI - - M - - -
-----------------------------
VT SS SS SM S - M
-----------------------------
AVT SS SS SM - - M
-----------------------------
BVT - - - - - -
-----------------------------
I - Remote Interface
LI - Local Interface
AI - Abstract Interface
VT - Value Type
BVT - Boxed Value Type
AVT - Abstract Value Type
M - Can inherit multiple
- - Cannot inherit or support
SS - Can support single
SM - Can support multiple
ValueTypes

In CORBA, objects passing is by reference. When an IDL interface parameter is passed, it is converted to a reference and is passed to the peer. Any method call on the reference effects the original object. Sometimes, it is useful to encapsulate data only and the methods just manipulate the data. When such objects are passed, it needs to be copied so that peers can independently work on the encapsulated data. Such a requirement is not catered for by IDL interfaces. IDL structs do allow the data to be copied across between peers, but does not allow encapsulating data.

To answer the above need, ValueTypes were introduced. ValueTypes are in a way cross between interfaces and structs. While it allows method calling and inheritance, its value is copied over instead of reference being passed. The peer end constructs the Valuetype instances with the data that has come over the wire.

Types of ValueTypes

ValueTypes could be either
  • concrete value types
  • abstract value types.
Concrete valuetypes are those that have data encapsulation. Such valuetypes, obviously can be instantiated. On the other hand, when a valuetype is a pure bundle of operation and contains no state, it is said to be abstract and cannot be instantiated.

Boxed valuetypes is a special type of concrete valuetypes which does not have any operations and has only a single datamember. Typically this is used if data structures such as string or sequences need null parameter passing.

EBNF of ValueType

<value> ::= ( <value_dcl> <value_abs_dcl> <value_box_dcl> <value_forward_dcl>)

Regular Value Type

<value_dcl> ::= <value_header> “{“ < value_element>* “}”

<value_header> ::= [“custom” ] “valuetype” <identifier> [<value_inheritance_spec> ]

<value_element> ::= <export> < state_member> <init_dcl>

<value_inheritance_spec> ::= [ “:” [ “truncatable” ] <value_name> { “,” <value_name> }* ][ “supports” <interface_name> { “,” <interface_name> }* ]

<value_name> ::= <scoped_name>

State declaration

<state_member> ::= ( “public” “private” ) <type_spec> <declarators> “;”

Important charecteristics of ValueTypes
  • ValueTypes are local. They are implemented and reside locally. When a valuetype is sent across the wire, only its state is really sent and the object is recreated at the peer end using the state marshalled across.
  • Valuetypes can singly inherit from concrete valuetype and multiply inherit from abstract valuetype. I presume the restriction of single inheritance from concrete valuetype is to avoid the issues because of multiple implementation inheritance. Valuetypes can also support a single IDL interface or a local interface. Further more, it can support multiple abstract interfaces.
  • Sharing semantics - Valuetype instances can be shared between other valuetype instances. This allows the preservation of relationship between instances when these objects are marshalled over.
  • Null semantics - strings, structs, sequences and other data types in IDL do not support passing of null value. However, this can be done for a ValueType object.
  • Copy semantics of the valuetype are only guarenteed when the valuetype instances are part of an IDL interface method signature. If a valuetype instance is used in a language specific function call or as part of a valuetype operation, then these instances are passed using the programming language specific reference semantics.
Inheritance in ValueTypes

  • Abstract valuetypes can inherit from any number of abstract valuetypes and support any number of abstract interfaces. It can also additionally support a single interface. Abstract valuetypes obviously cannot inherit from concrete valuetypes.
  • Concrete valuetypes can only inherit from a single concrete valuetype. It however can inherit from multiple abstract valuetypes and support multiple abstract interfaces. It can also additionally support a single interface. An interesting problem arises when concrete valuetypes inherit from other concrete valuetypes. When they are marshalled over, it could so happen that the recieving peer only has information till some of the parent valuetypes. Specifying this valuetype, then to be truncatable allows the receiving side to truncate the value to the parent valuetype.
Substitutability

When a valuetype instance is to be passed into an CORBA operation that takes -

1) Interface reference - When a valuetype supports an interface, it is not naturally the subtype of the interface. It cannot be passed in situation where a paremeter type is the base interface. In this case, through special language mapping mechanisms, the valuetype needs to be converted to the interface reference type to be passed.

2) Abstract Interface - Derived valuetype instance is a subtype of the abstract interface and hence can be passed.

3) ValueType - Yes. If the receiving peer has the same version of the implementation of valuetype, then it is no problem. If not, then it tries to (1) load the implementation if possible (2) truncate to a base class if truncatable (3) throw NO_IMPLEMENT.

11 Comments:

Blogger ninest123 Ninest said...

ninest123 10.27
tiffany jewelry, michael kors outlet, oakley sunglasses wholesale, ugg boots, louis vuitton, jordan shoes, nike air max, burberry outlet, uggs outlet, prada outlet, louis vuitton, ugg boots, louis vuitton outlet, michael kors outlet store, ray ban sunglasses, louis vuitton outlet, replica watches, replica watches, uggs outlet, michael kors outlet, polo ralph lauren outlet online, nike free, ray ban sunglasses, oakley sunglasses, christian louboutin outlet, michael kors outlet online, longchamp outlet, louis vuitton outlet, christian louboutin, tiffany and co, prada handbags, cheap oakley sunglasses, polo outlet, longchamp outlet, tory burch outlet, longchamp outlet, nike outlet, oakley sunglasses, oakley sunglasses, ray ban sunglasses, christian louboutin shoes, christian louboutin uk, chanel handbags, uggs on sale, burberry handbags, nike air max, kate spade outlet, michael kors outlet online

9:46 AM  
Blogger ninest123 Ninest said...

hollister uk, nike roshe run uk, sac longchamp pas cher, nike air max uk, north face, vans pas cher, michael kors, kate spade, nike blazer pas cher, longchamp pas cher, ray ban uk, nike free run, abercrombie and fitch uk, louboutin pas cher, coach outlet store online, timberland pas cher, nike roshe, north face uk, polo ralph lauren, oakley pas cher, nike air max, sac vanessa bruno, hollister pas cher, polo lacoste, true religion outlet, ralph lauren uk, nike tn, sac hermes, ray ban pas cher, coach outlet, jordan pas cher, michael kors, coach purses, nike air force, true religion jeans, lululemon canada, michael kors pas cher, mulberry uk, nike air max uk, true religion outlet, burberry pas cher, michael kors outlet, nike free uk, converse pas cher, coach outlet, hogan outlet, new balance, guess pas cher, true religion outlet, air max

9:47 AM  
Blogger ninest123 Ninest said...

bottega veneta, new balance shoes, nike air max, soccer jerseys, louboutin, giuseppe zanotti outlet, lululemon, mac cosmetics, vans, nike trainers uk, vans outlet, abercrombie and fitch, reebok outlet, nike air max, converse, iphone 6 cases, insanity workout, ghd hair, hollister clothing, converse outlet, oakley, nfl jerseys, baseball bats, herve leger, gucci, nike huaraches, mont blanc pens, north face outlet, ferragamo shoes, valentino shoes, north face outlet, p90x workout, longchamp uk, nike roshe run, soccer shoes, wedding dresses, timberland boots, hollister, hermes belt, hollister, ralph lauren, jimmy choo outlet, chi flat iron, asics running shoes, ray ban, instyler, mcm handbags, beats by dre, celine handbags, babyliss, gucci handbags, michael kors outlet online

9:49 AM  
Blogger ninest123 Ninest said...

toms shoes, ugg, ugg uk, moncler, moncler, juicy couture outlet, hollister, ugg,uggs,uggs canada, michael kors outlet online, canada goose outlet, lancel, wedding dresses, moncler outlet, canada goose, swarovski, barbour uk, moncler, canada goose outlet, louis vuitton, ugg,ugg australia,ugg italia, louis vuitton, moncler uk, louis vuitton, ugg pas cher, louis vuitton, montre pas cher, links of london, marc jacobs, barbour, louis vuitton, canada goose uk, michael kors handbags, canada goose outlet, pandora charms, supra shoes, replica watches, canada goose, juicy couture outlet, coach outlet, karen millen uk, moncler outlet, moncler, pandora uk, doudoune moncler, thomas sabo, swarovski crystal, pandora jewelry, canada goose jackets, michael kors outlet, canada goose, doke gabbana, pandora jewelry
ninest123 10.27

9:49 AM  
Blogger 艾丰 said...

jianbin1219
longchamp outlet
true religion sale
true religion outlet
fitflops shoes
fitflops sale
fitflops sale clearance
fitflops sale
fitflops shoes
michael kors outlet
michael kors outlet
michael kors outlet
tiffany and co
tiffany jewellery
beats by dr dre
beats by dre
oakley sunglasses
oakley sunglasses
ray-ban sunglasses
ray ban sunglasses
hollister uk
lululemon outlet
ugg outlet
ugg boots
ugg boots
rolex watches
mulberry handbags
mulberry bags
mulberry outlet
mulberry sale
mulberry handbags
mulberry handbags
louis vuitton handbags
louis vuitton handbags
toms shoes

10:59 AM  
Blogger oakleyses said...

christian louboutin uk, louis vuitton outlet, christian louboutin shoes, michael kors pas cher, louis vuitton outlet, sac longchamp pas cher, prada handbags, gucci handbags, tiffany and co, polo ralph lauren outlet online, christian louboutin outlet, cheap oakley sunglasses, longchamp outlet, uggs on sale, polo outlet, louis vuitton, nike air max, oakley sunglasses, longchamp outlet, nike free, nike outlet, longchamp outlet, longchamp pas cher, chanel handbags, nike air max, oakley sunglasses, nike free run, tiffany jewelry, oakley sunglasses wholesale, louboutin pas cher, ray ban sunglasses, ugg boots, replica watches, air max, louis vuitton outlet, oakley sunglasses, nike roshe, louis vuitton, tory burch outlet, ray ban sunglasses, jordan shoes, christian louboutin, prada outlet, polo ralph lauren, burberry pas cher, ugg boots, jordan pas cher, kate spade outlet, ray ban sunglasses

8:37 AM  
Blogger oakleyses said...

nike blazer pas cher, mulberry uk, burberry handbags, michael kors, timberland pas cher, oakley pas cher, ray ban uk, vans pas cher, coach purses, north face, nike free uk, new balance, ray ban pas cher, sac hermes, michael kors, nike air force, ralph lauren uk, nike air max, kate spade, nike roshe run uk, true religion jeans, north face uk, hogan outlet, michael kors outlet online, nike air max uk, uggs outlet, nike tn, burberry outlet, hollister uk, coach outlet store online, replica handbags, lululemon canada, michael kors outlet online, michael kors outlet online, michael kors outlet, michael kors outlet online, converse pas cher, michael kors outlet, true religion outlet, true religion outlet, polo lacoste, hollister pas cher, coach outlet, guess pas cher, true religion outlet, abercrombie and fitch uk, nike air max uk, sac vanessa bruno, michael kors outlet

8:40 AM  
Blogger oakleyses said...

hollister, oakley, celine handbags, instyler, nike trainers uk, ghd hair, converse outlet, hollister clothing, hermes belt, beats by dre, ray ban, lancel, herve leger, timberland boots, nike air max, chi flat iron, longchamp uk, asics running shoes, vans, nike air max, insanity workout, reebok outlet, giuseppe zanotti outlet, abercrombie and fitch, nike roshe run, north face outlet, louboutin, jimmy choo outlet, iphone cases, gucci, mcm handbags, north face outlet, valentino shoes, soccer shoes, hollister, wedding dresses, babyliss, bottega veneta, baseball bats, p90x workout, nfl jerseys, nike huaraches, new balance shoes, soccer jerseys, mont blanc pens, ralph lauren, vans outlet, mac cosmetics, ferragamo shoes, lululemon

8:43 AM  
Blogger oakleyses said...

hollister, louis vuitton, moncler outlet, pandora uk, moncler, canada goose outlet, ugg,ugg australia,ugg italia, marc jacobs, toms shoes, moncler outlet, louis vuitton, canada goose, swarovski crystal, supra shoes, moncler, ugg, juicy couture outlet, wedding dresses, thomas sabo, karen millen uk, ugg pas cher, canada goose jackets, pandora jewelry, louis vuitton, moncler, swarovski, pandora jewelry, links of london, moncler uk, louis vuitton, coach outlet, ugg uk, canada goose uk, ugg,uggs,uggs canada, canada goose, doudoune moncler, louis vuitton, pandora charms, juicy couture outlet, canada goose outlet, canada goose outlet, canada goose, moncler, replica watches, montre pas cher

8:45 AM  
Blogger Liu Liu said...

Nick Saban’s relatively brief time as head coach of the Miami Dolphins is not looked upon fondly by most fans of the team. He went 15-17 christian louboutin shoes in his two seasons, but basically quit on the nfl jerseys store team in the final weeks Nike Air Max 90 of the 2006 season, focused more on his next job, at the University of Alabama, instead of the one he christian louboutin uk was under contract for.And at least one player who played – or at Christian Louboutin Women Flat least practiced – under Saban during those ill-fated christian louboutin men flat final weeks Nike Roshe Run hasn’t forgotten NFL Jerseys how Nike Free Run he was louboutin outlet treated. According to Nike Air Max 2015 Shoes receiver P.K. Sam, a journeyman cheap nfl jerseys who spent time with five NFL teams as well as two CFL clubs, Saban cut wholesale nfl jerseys him after he left the team christian louboutin Panettone spiked leather wallet briefly to see his dying father

2:56 PM  
Blogger dalia alaa said...

http://www.prokr.net/2016/09/cleaning-company-taif.html
http://www.prokr.net/2016/09/cleaning-company-mecca.html
http://www.prokr.net/2016/09/cleaning-company-jeddah.html

6:41 AM  

Post a Comment

<< Home