NAME

OTC_Vector - Wrapper around a conventional C vector.

SYNOPSIS


#include <OTC/collctn/vector.hh>

template<class T>
class OTC_Vector
{
  public:
    static os_typespec* get_os_typespec();
    inline ~OTC_Vector();
    OTC_Vector(u_int theSize);
    OTC_Vector(OTC_Vector<T> const& theVector);
    OTC_Vector(
      OTC_Vector<T> const& theVector,
      OTC_Range const& theRange
    );
    OTC_Vector(
      OTC_Vector<T> const& theVector,
      u_int theStart,
      u_int theLength
    );
    OTC_Vector(T const* theVector, u_int theSize);
    OTC_Vector<T>& operator=(OTC_Vector<T> const& theVector);
    inline operator T*();
    inline operator T const*() const;
    inline T* buffer();
    inline T const* buffer() const;
    inline u_int size() const;
    inline T& operator[](u_int theIndex);
    inline T const& operator[](u_int theIndex) const;
    void resize(u_int theSize);
};

CLASS TYPE

Concrete

DESCRIPTION

The class OTC_Vector is a wrapper around a conventional C style vector. As with the traditional vector, indexes into the vector commence at 0 and extend up to one less than the size of the vector. If the vector is to hold a data type possessing a constructor, the data type must have a constructor which accepts no arguments. If the data type being held, doesn't automatically initialise itself through a constructor, it is the user's responsibility to initialise the vector. For example, if the vector is to hold pointers, the user will have to initialise each location in the vector to 0 before use. In addition to having to initialise the vector when holding pointers, it is also the user's responsibility to delete each object pointed at, when the vector is destroyed, if those objects would no longer be referenced.

CLASS INITIALISATION

OTC_Vector(u_int theSize);
OTC_Vector(OTC_Vector<T> const& theVector);
OTC_Vector(OTC_Vector<T> const& theVector, OTC_Range const& theRange);
OTC_Vector(
  OTC_Vector<T> const& theVector,
  u_int theStart,
  u_int theLength
);
OTC_Vector(T const* theVector, u_int theSize);

ASSIGNMENT

OTC_Vector<T>& operator=(OTC_Vector<T> const& theVector);

ACCESSING

inline operator T*();
inline operator T const*() const;
inline T* buffer();
inline T const* buffer() const;
inline u_int size() const;
inline T& operator[](u_int theIndex);
inline T const& operator[](u_int theIndex) const;

RESIZING

void resize(u_int theSize);

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1992 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED