/* * CENA C++ Utilities * * by Stephane Chatty * * Copyright 1990, 1991, 1992 * Laboratoire de Recherche en Informatique (LRI) * Centre d'Etudes de la Navigation Aerienne (CENA) * * plain and generic arrays (orginal C version by Michel Beaudouin-Lafon) * * $Id$ * $CurLog$ */ #ifndef Array_H_ #define Array_H_ #include "cplus_bugs.h" typedef void CcuArrayItem; class CcuArray { protected: static CcuArrayItem* InvalidCell; int Length; CcuArrayItem** Data; void Clean (); public: CcuArray (int size, CcuArrayItem* = 0); CcuArray (const CcuArray&); ~CcuArray (); void Reset (CcuArrayItem* = 0); CcuArrayItem*& operator [] (int i) const; CcuArrayItem** operator + (int) const; CcuArray& operator = (const CcuArray&); inline int Check (int i) const { return (i >= 0 && i < Length); } inline int GetSize () const { return Length; } void Resize (int, CcuArrayItem* = 0); }; #ifndef CPLUS_BUG19 template class CcuArrayOf : public CcuArray { public: inline CcuArrayOf (int size, ITEM* value = 0) : CcuArray (size, value) {} inline CcuArrayOf (const CcuArrayOf& a) : CcuArray (a) {} inline ~CcuArrayOf () {} inline void Reset (ITEM* value = 0) { CcuArray::Reset (value); } inline void Resize (int size, ITEM* value = 0) { CcuArray::Resize (size, value); } inline ITEM*& operator [] (int i) const { return (ITEM*&) ((* (CcuArray*) this)[i]); } inline ITEM** operator + (int i) const { return (ITEM**) ((*(CcuArray*) this) + i); } }; #endif #endif /* Array_H_ */