summaryrefslogtreecommitdiff
path: root/utils/Array.h
diff options
context:
space:
mode:
authorchatty1992-12-15 10:55:33 +0000
committerchatty1992-12-15 10:55:33 +0000
commit3a4838bed13b767132cbdf06364b2658da6cc356 (patch)
treef6d7b33264c4634d069409ba3169126823ac4090 /utils/Array.h
parent23abb4b87c7e40ed259dd02f653516f60e55ade4 (diff)
downloadivy-league-3a4838bed13b767132cbdf06364b2658da6cc356.zip
ivy-league-3a4838bed13b767132cbdf06364b2658da6cc356.tar.gz
ivy-league-3a4838bed13b767132cbdf06364b2658da6cc356.tar.bz2
ivy-league-3a4838bed13b767132cbdf06364b2658da6cc356.tar.xz
Initial revision
Diffstat (limited to 'utils/Array.h')
-rw-r--r--utils/Array.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/utils/Array.h b/utils/Array.h
new file mode 100644
index 0000000..f33656f
--- /dev/null
+++ b/utils/Array.h
@@ -0,0 +1,59 @@
+/*
+ * 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 ITEM> 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_ */
+