TAO  2.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces
Generic_Sequence_T.h File Reference

Implement the generic version of CORBA sequences. More...

#include "tao/Range_Checking_T.h"
#include "ace/checked_iterator.h"
#include <algorithm>

Classes

class  TAO::details::generic_sequence< T, ALLOCATION_TRAITS, ELEMENT_TRAITS >
 

Namespaces

 TAO
 Define symbolic names for the ORB collocation strategies as used at runtime.
 
 TAO::details
 

Detailed Description

Implement the generic version of CORBA sequences.

All CORBA sequences are based on this class template. The behavior of this class is controlled by two sets of traits. First, the ALLOCATION_TRAITS control how buffers are allocated and initialized. Since this is where most of the variation between unbounded and bounded sequences is found, the ALLOCATION_TRAITS can be thought as the bounded aspect of the sequence.

Second, the element traits control how are elements copied, initialized and released. Value-like types, such as integers and structures, have trivial initialization and release requirements (their constructor/destructors do the job!) But reference-like types, such as strings and object references, have more complicated requirements. This is yet another aspect of the sequences, we can call it the "element copy semantics" or something.

Oh, and let us not forget the type that the sequences encapsulates.

The intent is not for sequences to simply derive or instantiate this type. Instead, different each sequence type is written using composition. They instantiate a generic sequence with the correct traits, and implement the adapt the generic sequence interface to whatever requirements the spec may impose. For example, replace() has different number of arguments in bounded vs. unbounded sequences, and operator[] returns different types depending on the underlying type of the sequence.

This class offers the strong exception-safety guarantee, as long as destructors and release operations do not throw.

This class is not thread-safe. Thread-safe collections are mostly useless anyways.

In general the performance characteristics of the class depends on the traits. Obviously, they can only be expressed on the number of element constructor and destructor calls. If the constructor takes O(K) time that is not the sequence fault!

All accessors are O(1), single-element modifiers are O(1), multiple element modifiers are O(n + m) where n is the number of elements originally in the sequence, and m is the number of elements left in the sequence afterwards.

Beware:

Id:
Generic_Sequence_T.h 94532 2011-09-28 12:43:45Z johnnyw
Author
Carlos O'Ryan