# Objects-by-Value

Points of contact: Jeff Parsons Boris Kolpackov

Last Update: 2002/07/29

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`. Relevant options of TAO's IDL compiler 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).

- Support for valuetypes as members of IDL aggregate types has been added.

- Support for inheritance from interface (supports) has been added.

- Support for abstract interfaces has been added.

- Support for forward declared valuetypes defined in another compilation unit has been added.

### Known issues:

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

- No support for sharing (aliasing).

- 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 is different from the CORBA specs and needs to be changed. But the optimized mode (`-Wb,obv_opt_accessor`) should be unaffected by 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