# Objects-by-Value

Point of contact: Carlos O'Ryan

Last Update: 2001/03/26 21:47:10

Objects-by-Value (OBV) describes the new type, `valuetype`. It is introduced in CORBA 2.3
(Core: ptc/98-12-04.pdf Mapping to C++: ptc/98-09-03.pdf). This first implementation was contributed from Torsten Kuepper. Valuetypes are similar to IDL `struct`s extended with these features:

- Encapsulate state and operations with local implementation.

- Single inheritance from a `valuetype` and multiple inheritance from abstract `valuetype`s. Eventually support of an interface.

- References to other `valuetype`s, with the possibility of NULL references or shared (aliased) references.

`Valuetype`s will likely be used to implement abstract datatypes (ADT)s that can be copied to another process. All processes that use the `valuetype` must have an implementation for it since CORBA does not support code migration, a la Java RMI.

### Current status:

- The IDL compiler understands `valuetype`, if it was compiled with `IDL_HAS_VALUETYPE` defined. New options of TAO's IDL are:

  - -Gv Enable OBV support
  - -Sv Disable OBV support (default)
  - -Wb,obv_opt_accessor Make accessor and modifier functions inline. Overriding them is not allowed in this mode.

  `libTAO` must be compiled with `TAO_HAS_VALUETYPE`.

- `Valuetype`s can be used as arguments in CORBA invocations. There is an example in $TAO_ROOT/TAO/examples/OBV/Typed_Events. `Valuetype`s could even reference other `valuetype` objects (but without sharing).

### Known issues:

- No support for `TypeCodes` of `valuetype` objects

- `Valuetype`s work only in conjunction with compiled marshalling (`-Gc`, currently default for `tao_idl`).

- No support for `TypeCodes` of `valuetype` objects. Hence moving it into an `any` is not possible yet.

- `Valuetype`s can not be contained in other types like `struct`, `union`, `sequence` or `array`.

- No support for sharing (aliasing).

- Forward and typedef'd declaration does not work.

- Inheritance (support) from an ordinary interface not implemented.

- No support for abstract interfaces.

- No support for `valuebox`es

- No support for fragmentation (chunking) of the marshalled `valuetype` object. Hence no support for truncation or custom marshalling.

- The marshal engine accesses the state members directly and does not utilize the accessor/modifier functions. This not like in the CORBA specs and needs a change. But the optimized mode (`-Wb,obv_opt_accessor`) should be unaffected of that.

- Obtaining a repository id of a `valuetype` is currently non-standard. Hashed repository ids are not implemented.

- The map of `valuetype` factories needs some revision to provide proper locking. Currently the registration of factories is best completed before unmarshalling `valuetype`s. There is one map of factories for the whole process. This will once be changed to conform to the specs, which suggests one per ORB.

Back to TOC