From 18644419b50b2b14a24456e0fcdb210f231ee317 Mon Sep 17 00:00:00 2001 From: Tuowen Zhao Date: Sun, 18 Sep 2016 15:16:52 -0600 Subject: doc updated for code_gen --- omegalib/omega/include/basic/Bag.h | 29 ++-- omegalib/omega/include/basic/BoolSet.h | 18 ++- omegalib/omega/include/basic/Collection.h | 12 +- omegalib/omega/include/basic/ConstString.h | 1 - omegalib/omega/include/basic/DynamicArray.c | 219 +++++++++++++++++++++++++++ omegalib/omega/include/basic/DynamicArray.h | 103 +++++++++++++ omegalib/omega/include/basic/Dynamic_Array.c | 219 --------------------------- omegalib/omega/include/basic/Dynamic_Array.h | 103 ------------- omegalib/omega/include/basic/Iterator.h | 48 +++--- omegalib/omega/include/basic/Link.h | 17 +-- omegalib/omega/include/basic/List.h | 5 - 11 files changed, 386 insertions(+), 388 deletions(-) create mode 100644 omegalib/omega/include/basic/DynamicArray.c create mode 100644 omegalib/omega/include/basic/DynamicArray.h delete mode 100644 omegalib/omega/include/basic/Dynamic_Array.c delete mode 100644 omegalib/omega/include/basic/Dynamic_Array.h (limited to 'omegalib/omega/include/basic') diff --git a/omegalib/omega/include/basic/Bag.h b/omegalib/omega/include/basic/Bag.h index 42285d0..3bd7143 100644 --- a/omegalib/omega/include/basic/Bag.h +++ b/omegalib/omega/include/basic/Bag.h @@ -14,13 +14,14 @@ virtual ~Bag(); Bag(); Bag(const Bag&); Bag & operator=(const Bag&); -virtual void operator |= (const Bag & b); // add elements in b + //! add elements in b + virtual void operator |= (const Bag & b); Iterator *new_iterator(); bool empty() const; void remove(T); -virtual void insert(T); + virtual void insert(T); void clear(); -virtual bool contains(T) const; + virtual bool contains(T) const; int size() const; T extract(); // protected: breaks g++ 261 @@ -31,10 +32,11 @@ virtual bool contains(T) const; template class Ordered_Bag : public Bag { public: Ordered_Bag(); -// virtual ~Ordered_Bag(); Ordered_Bag(const Ordered_Bag& B) : Bag(B) {} void insert(T); -virtual void operator |= (const Ordered_Bag & b); // add elements in b + //! add elements in b + virtual void operator |= (const Ordered_Bag & b); + //! add elements in b void operator |= (const Bag & b); bool contains(T) const; bool operator == (const Ordered_Bag&) const; @@ -45,21 +47,26 @@ virtual void operator |= (const Ordered_Bag & b); // add elements in b template class Set : public Ordered_Bag { public: Set(); -// virtual ~Set(); Set(T); Set(const Set& S) : Ordered_Bag(S) {} bool contains (const Set& b) const; bool contains (T t) const { return Ordered_Bag::contains(t); } // the above makes "standard" C++ happy - -virtual void operator |= (const Set & b); // add elements in b + + //! add elements in b + virtual void operator |= (const Set & b); + //! add elements in b void operator |= (const Ordered_Bag & b); + //! add elements in b void operator |= (const Bag & b); - void operator -= (const Set & b); // delete items also in b - void operator &= (const Set & b); // delete items not in b - bool operator & (const Set &) const; // check for elements in common + //! delete items also in b + void operator -= (const Set & b); + //! delete items not in b + void operator &= (const Set & b); + //! check for elements in common + bool operator & (const Set &) const; }; } // namespace diff --git a/omegalib/omega/include/basic/BoolSet.h b/omegalib/omega/include/basic/BoolSet.h index dc9ef83..a78af2e 100755 --- a/omegalib/omega/include/basic/BoolSet.h +++ b/omegalib/omega/include/basic/BoolSet.h @@ -25,7 +25,8 @@ #include namespace omega { - + + //! BoolSet class, used as a set of integers from 0 to n-1 where n is a very small integer. template class BoolSet { protected: @@ -50,17 +51,20 @@ public: BoolSet &operator|=(const BoolSet &); BoolSet &operator&=(const BoolSet &); BoolSet &operator-=(const BoolSet &); - - template friend BoolSet operator|(const BoolSet &, const BoolSet &); // union - template friend BoolSet operator&(const BoolSet &, const BoolSet &); // intersection - template friend BoolSet operator-(const BoolSet &, const BoolSet &); // difference - template friend BoolSet operator~(const BoolSet &); // complement + + //! union + template friend BoolSet operator|(const BoolSet &, const BoolSet &); + //! intersection + template friend BoolSet operator&(const BoolSet &, const BoolSet &); + //! difference + template friend BoolSet operator-(const BoolSet &, const BoolSet &); + //! complement + template friend BoolSet operator~(const BoolSet &); template friend bool operator==(const BoolSet &, const BoolSet &); template friend bool operator!=(const BoolSet &, const BoolSet &); template friend std::ostream& operator<<(std::ostream &, const BoolSet &); template friend bool operator<(const BoolSet &, const BoolSet &); -// iterator related public: class iterator; class const_iterator; diff --git a/omegalib/omega/include/basic/Collection.h b/omegalib/omega/include/basic/Collection.h index c7e4eef..80ddf48 100644 --- a/omegalib/omega/include/basic/Collection.h +++ b/omegalib/omega/include/basic/Collection.h @@ -7,10 +7,7 @@ template class Iterator; template class Any_Iterator; -/* - * protocol for any kind of collection - */ - +//! protocol for any kind of collection template class Collection { public: virtual Iterator *new_iterator() = 0; @@ -20,21 +17,20 @@ public: }; -/* +/*! * protocol for collections whose elements are ordered * by the way they are entered into the collection, and * whose elements can be accessed by "index" * * note that the implementation need not be a linked list */ - template class Sequence : public Collection { public: virtual const T &operator[](int) const = 0; virtual T &operator[](int) = 0; - virtual int index(const T &) const = 0; // Y in X --> X[X.index(Y)] == Y -}; + /*! Y in X --> X[X.index(Y)] == Y */ + virtual int index(const T &) const = 0; }; } // namespace diff --git a/omegalib/omega/include/basic/ConstString.h b/omegalib/omega/include/basic/ConstString.h index 5149e55..f149c9d 100644 --- a/omegalib/omega/include/basic/ConstString.h +++ b/omegalib/omega/include/basic/ConstString.h @@ -10,7 +10,6 @@ namespace omega { // global, but if it and its size are static to Const_String, // the compiler still doesn't seem to like the definition, // or the declaration either for that matter. - class ConstStringRep { public: const char *name; diff --git a/omegalib/omega/include/basic/DynamicArray.c b/omegalib/omega/include/basic/DynamicArray.c new file mode 100644 index 0000000..8ede2f7 --- /dev/null +++ b/omegalib/omega/include/basic/DynamicArray.c @@ -0,0 +1,219 @@ +#include +#include + +namespace omega { + +template void DynamicArray::do_constr() + { +// #if ! defined SHUT_UP_ABOUT_STATEMENT_WITH_NO_EFFECT_IN_DYNAMIC_ARRAY_CREATION +// assert(d > 0); +// #endif + bounds = 0; + elements = 0; + partial = false; + } + + +template void DynamicArray1::do_construct(int d0) + { + this->bounds = new int[1]; + this->bounds[0] = d0; + this->elements = new T [d0]; + this->partial = false; + } + +template void DynamicArray2::do_construct(int d0, int d1) + { + this->bounds = new int[2]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->elements = new T [d0 * d1]; + this->partial = false; + } + +template void DynamicArray3::do_construct(int d0,int d1,int d2) + { + this->bounds = new int[3]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->bounds[2] = d2; + this->elements = new T [d0 * d1 * d2]; + this->partial = false; + } + +template void DynamicArray4::do_construct(int d0,int d1,int d2,int d3) + { + this->bounds = new int[4]; + this->bounds[0] = d0; + this->bounds[1] = d1; + this->bounds[2] = d2; + this->bounds[3] = d3; + this->elements = new T [d0 * d1 * d2 * d3]; + this->partial = false; + } + +template DynamicArray::DynamicArray() + { + do_constr(); + } + +template DynamicArray1::DynamicArray1(const char *) + { + this->do_constr(); + } + +template DynamicArray2::DynamicArray2(const char *,const char *) + { + this->do_constr(); + } + +template DynamicArray3::DynamicArray3(const char *,const char *,const char *) + { + this->do_constr(); + } + +template DynamicArray4::DynamicArray4(const char *,const char *,const char *,const char *) + { + this->do_constr(); + } + +template DynamicArray1::DynamicArray1(int d0) + { + do_construct(d0); + } + +template DynamicArray2::DynamicArray2(int d0, int d1) + { + do_construct(d0, d1); + } + +template DynamicArray3::DynamicArray3(int d0,int d1,int d2) + { + do_construct(d0, d1, d2); + } + +template DynamicArray4::DynamicArray4(int d0,int d1,int d2,int d3) + { + do_construct(d0, d1, d2, d3); + } + + +template void DynamicArray::do_destruct() + { + if (! partial) + { + delete [] bounds; + delete [] elements; + } + } + + +template DynamicArray::~DynamicArray() + { + do_destruct(); + } + + +template void DynamicArray1::resize(int d0) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0) + this->do_constr(); + else + do_construct(d0); + } + +template void DynamicArray2::resize(int d0, int d1) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0) + this->do_constr(); + else + do_construct(d0, d1); + } + +template void DynamicArray3::resize(int d0, int d1, int d2) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0 && d2 == 0) + this->do_constr(); + else + do_construct(d0, d1, d2); + } + +template void DynamicArray4::resize(int d0, int d1, int d2, int d3) + { + assert(!this->partial); + this->do_destruct(); + if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0) + this->do_constr(); + else + do_construct(d0, d1, d2, d3); + } + + +template T& DynamicArray1::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + return this->elements[d0]; + } + +template DynamicArray1 DynamicArray2::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + DynamicArray1 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * d0; + result.partial = true; + return result; + } + +template DynamicArray2 DynamicArray3::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + DynamicArray2 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * this->bounds[2] * d0; + result.partial = true; + return result; + } + +template DynamicArray3 DynamicArray4::operator[](int d0) + { +#if !defined (NDEBUG) + assert(this->elements != 0 && "Trying to dereference undefined array"); + assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); +#endif + + DynamicArray3 result; + result.bounds = this->bounds+1; + result.elements = this->elements + this->bounds[1] * this->bounds[2] * this->bounds[3] * d0; + result.partial = true; + return result; + } + + +template + DynamicArray::DynamicArray(DynamicArray &D) + { + assert(D.elements != 0 && "Trying to copy an undefined array"); + partial = true; + bounds = D.bounds; + elements = D.elements; + } + +} // namespace diff --git a/omegalib/omega/include/basic/DynamicArray.h b/omegalib/omega/include/basic/DynamicArray.h new file mode 100644 index 0000000..ac9bae4 --- /dev/null +++ b/omegalib/omega/include/basic/DynamicArray.h @@ -0,0 +1,103 @@ +#ifndef Already_Included_DynamicArray +#define Already_Included_DynamicArray + +namespace omega { + +template class DynamicArray2; +template class DynamicArray3; +template class DynamicArray4; + +template class DynamicArray + { + public: + DynamicArray(DynamicArray &D); + ~DynamicArray(); + + protected: + DynamicArray(); + bool partial; + int *bounds; + T *elements; + + void do_constr(); + void do_destruct(); + }; + + +template class DynamicArray1 : public DynamicArray + { + public: + DynamicArray1(const char *s0 = 0); + DynamicArray1(int d0); + void resize(int d0); + T& operator[](int d); + + friend class DynamicArray2; + + private: + void do_construct(int d0); + }; + + +template class DynamicArray2 : public DynamicArray + { + public: + DynamicArray2(const char *s0 = 0, const char *s1 = 0); + DynamicArray2(int d0, int d1); + void resize(int d0, int d1); + DynamicArray1 operator[](int d); + + friend class DynamicArray3; + + private: + void do_construct(int d0, int d1); + }; + + +template class DynamicArray3 : public DynamicArray + { + public: + DynamicArray3(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0); + DynamicArray3(int d0, int d1, int d2); + void resize(int d0, int d1, int d2); + DynamicArray2 operator[](int d); + + friend class DynamicArray4; + + private: + void do_construct(int d0, int d1, int d2); + }; + +template class DynamicArray4 : public DynamicArray + { + public: + DynamicArray4(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0, const char *s3 = 0); + DynamicArray4(int d0, int d1, int d2, int d3); + void resize(int d0, int d1, int d2, int d3); + DynamicArray3 operator[](int d); + + private: + void do_construct(int d0, int d1, int d2, int d3); + }; + +} // namespace + +#if ! defined DONT_INCLUDE_TEMPLATE_CODE +#include +#endif + +#define instantiate_DynamicArray1(T) template class DynamicArray1; \ + template class DynamicArray; + +#define instantiate_DynamicArray2(T) template class DynamicArray2; \ + template class DynamicArray; \ + instantiate_DynamicArray1(T); + +#define instantiate_DynamicArray3(T) template class DynamicArray3; \ + template class DynamicArray; \ + instantiate_DynamicArray2(T); + +#define instantiate_DynamicArray4(T) template class DynamicArray4; \ + template class DynamicArray; \ + instantiate_DynamicArray3(T); +#endif diff --git a/omegalib/omega/include/basic/Dynamic_Array.c b/omegalib/omega/include/basic/Dynamic_Array.c deleted file mode 100644 index 0300fd8..0000000 --- a/omegalib/omega/include/basic/Dynamic_Array.c +++ /dev/null @@ -1,219 +0,0 @@ -#include -#include - -namespace omega { - -template void Dynamic_Array::do_constr() - { -// #if ! defined SHUT_UP_ABOUT_STATEMENT_WITH_NO_EFFECT_IN_DYNAMIC_ARRAY_CREATION -// assert(d > 0); -// #endif - bounds = 0; - elements = 0; - partial = false; - } - - -template void Dynamic_Array1::do_construct(int d0) - { - this->bounds = new int[1]; - this->bounds[0] = d0; - this->elements = new T [d0]; - this->partial = false; - } - -template void Dynamic_Array2::do_construct(int d0, int d1) - { - this->bounds = new int[2]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->elements = new T [d0 * d1]; - this->partial = false; - } - -template void Dynamic_Array3::do_construct(int d0,int d1,int d2) - { - this->bounds = new int[3]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->bounds[2] = d2; - this->elements = new T [d0 * d1 * d2]; - this->partial = false; - } - -template void Dynamic_Array4::do_construct(int d0,int d1,int d2,int d3) - { - this->bounds = new int[4]; - this->bounds[0] = d0; - this->bounds[1] = d1; - this->bounds[2] = d2; - this->bounds[3] = d3; - this->elements = new T [d0 * d1 * d2 * d3]; - this->partial = false; - } - -template Dynamic_Array::Dynamic_Array() - { - do_constr(); - } - -template Dynamic_Array1::Dynamic_Array1(const char *) - { - this->do_constr(); - } - -template Dynamic_Array2::Dynamic_Array2(const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array3::Dynamic_Array3(const char *,const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array4::Dynamic_Array4(const char *,const char *,const char *,const char *) - { - this->do_constr(); - } - -template Dynamic_Array1::Dynamic_Array1(int d0) - { - do_construct(d0); - } - -template Dynamic_Array2::Dynamic_Array2(int d0, int d1) - { - do_construct(d0, d1); - } - -template Dynamic_Array3::Dynamic_Array3(int d0,int d1,int d2) - { - do_construct(d0, d1, d2); - } - -template Dynamic_Array4::Dynamic_Array4(int d0,int d1,int d2,int d3) - { - do_construct(d0, d1, d2, d3); - } - - -template void Dynamic_Array::do_destruct() - { - if (! partial) - { - delete [] bounds; - delete [] elements; - } - } - - -template Dynamic_Array::~Dynamic_Array() - { - do_destruct(); - } - - -template void Dynamic_Array1::resize(int d0) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0) - this->do_constr(); - else - do_construct(d0); - } - -template void Dynamic_Array2::resize(int d0, int d1) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0) - this->do_constr(); - else - do_construct(d0, d1); - } - -template void Dynamic_Array3::resize(int d0, int d1, int d2) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0 && d2 == 0) - this->do_constr(); - else - do_construct(d0, d1, d2); - } - -template void Dynamic_Array4::resize(int d0, int d1, int d2, int d3) - { - assert(!this->partial); - this->do_destruct(); - if (d0 == 0 && d1 == 0 && d2 == 0 && d3 == 0) - this->do_constr(); - else - do_construct(d0, d1, d2, d3); - } - - -template T& Dynamic_Array1::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - return this->elements[d0]; - } - -template Dynamic_Array1 Dynamic_Array2::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - Dynamic_Array1 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * d0; - result.partial = true; - return result; - } - -template Dynamic_Array2 Dynamic_Array3::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - Dynamic_Array2 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * this->bounds[2] * d0; - result.partial = true; - return result; - } - -template Dynamic_Array3 Dynamic_Array4::operator[](int d0) - { -#if !defined (NDEBUG) - assert(this->elements != 0 && "Trying to dereference undefined array"); - assert(0 <= d0 && d0 < this->bounds[0] && "Array subscript out of bounds"); -#endif - - Dynamic_Array3 result; - result.bounds = this->bounds+1; - result.elements = this->elements + this->bounds[1] * this->bounds[2] * this->bounds[3] * d0; - result.partial = true; - return result; - } - - -template - Dynamic_Array::Dynamic_Array(Dynamic_Array &D) - { - assert(D.elements != 0 && "Trying to copy an undefined array"); - partial = true; - bounds = D.bounds; - elements = D.elements; - } - -} // namespace diff --git a/omegalib/omega/include/basic/Dynamic_Array.h b/omegalib/omega/include/basic/Dynamic_Array.h deleted file mode 100644 index c0bdf12..0000000 --- a/omegalib/omega/include/basic/Dynamic_Array.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef Already_Included_Dynamic_Array -#define Already_Included_Dynamic_Array - -namespace omega { - -template class Dynamic_Array2; -template class Dynamic_Array3; -template class Dynamic_Array4; - -template class Dynamic_Array - { - public: - Dynamic_Array(Dynamic_Array &D); - ~Dynamic_Array(); - - protected: - Dynamic_Array(); - bool partial; - int *bounds; - T *elements; - - void do_constr(); - void do_destruct(); - }; - - -template class Dynamic_Array1 : public Dynamic_Array - { - public: - Dynamic_Array1(const char *s0 = 0); - Dynamic_Array1(int d0); - void resize(int d0); - T& operator[](int d); - - friend class Dynamic_Array2; - - private: - void do_construct(int d0); - }; - - -template class Dynamic_Array2 : public Dynamic_Array - { - public: - Dynamic_Array2(const char *s0 = 0, const char *s1 = 0); - Dynamic_Array2(int d0, int d1); - void resize(int d0, int d1); - Dynamic_Array1 operator[](int d); - - friend class Dynamic_Array3; - - private: - void do_construct(int d0, int d1); - }; - - -template class Dynamic_Array3 : public Dynamic_Array - { - public: - Dynamic_Array3(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0); - Dynamic_Array3(int d0, int d1, int d2); - void resize(int d0, int d1, int d2); - Dynamic_Array2 operator[](int d); - - friend class Dynamic_Array4; - - private: - void do_construct(int d0, int d1, int d2); - }; - -template class Dynamic_Array4 : public Dynamic_Array - { - public: - Dynamic_Array4(const char *s0 = 0, const char *s1 = 0, const char *s2 = 0, const char *s3 = 0); - Dynamic_Array4(int d0, int d1, int d2, int d3); - void resize(int d0, int d1, int d2, int d3); - Dynamic_Array3 operator[](int d); - - private: - void do_construct(int d0, int d1, int d2, int d3); - }; - -} // namespace - -#if ! defined DONT_INCLUDE_TEMPLATE_CODE -#include -#endif - -#define instantiate_Dynamic_Array1(T) template class Dynamic_Array1; \ - template class Dynamic_Array; - -#define instantiate_Dynamic_Array2(T) template class Dynamic_Array2; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array1(T); - -#define instantiate_Dynamic_Array3(T) template class Dynamic_Array3; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array2(T); - -#define instantiate_Dynamic_Array4(T) template class Dynamic_Array4; \ - template class Dynamic_Array; \ - instantiate_Dynamic_Array3(T); -#endif diff --git a/omegalib/omega/include/basic/Iterator.h b/omegalib/omega/include/basic/Iterator.h index 8975d9e..f62874c 100644 --- a/omegalib/omega/include/basic/Iterator.h +++ b/omegalib/omega/include/basic/Iterator.h @@ -16,24 +16,24 @@ namespace omega { #define foreachSeparated(x,T,S,A,B) do {for (omega::Any_Iterator __P_##x = (S).any_iterator();__P_##x;) {T & x = *__P_##x; A; __P_##x++; if (__P_##x) B;}} while (0) -/* - * Abstract base class Iterator +/*! + * \brief Abstract base class Iterator + * * Supports two styles of iteration: - * + * ~~~ * for ( ... initialize i (typically i = collection) ... ; i ; i++ ) * operate_on(*i) - * + * ~~~ * or - * + * ~~~ * for ( ... initialize i ... ; i.live() ; i.next() ) * operate_on(i.curr()) - * - * >>> IF THE COLLECTION IS CHANGED, THE ITERATOR IS NO LONGER VALID <<< + * ~~~ + * **IF THE COLLECTION IS CHANGED, THE ITERATOR IS NO LONGER VALID** * * For collections that are not "Sequence"s, the order in * which the elements are returned may not be consistent. */ - template class Iterator { public: virtual const T & operator*() const = 0; @@ -54,9 +54,8 @@ public: }; -// A generator is like an iterator but it gives out values, -// which may or may not exist in some writable collection - +//! A generator is like an iterator but it gives out values +/*! Values may or may not exist in some writable collection */ template class Generator { public: virtual T operator*() const = 0; @@ -74,14 +73,13 @@ public: -// Delegate to any kind of iterator (on the heap) -// If created via a reference, become a copy of the iterator -// If created via a pointer, manipulate that pointer and free *p when this dies -// -// Mostly useful for Collection::iterator -// Iterator::Iterator(Collection) - - +//! Delegate to any kind of iterator (on the heap) +/*! + * * If created via a reference, become a copy of the iterator + * * If created via a pointer, manipulate that pointer and free *p when this dies + * + * Mostly useful for Collection::iterator `Iterator::Iterator(Collection)` + */ template class Any_Iterator : public Iterator { public: Any_Iterator(Collection &c); @@ -101,13 +99,13 @@ public: Iterator *new_copy() const { return new Any_Iterator((*me).new_copy()); } private: - Any_Iterator(Iterator *p) // take over *p, *p MUST BE ON THE HEAP - { me = p; } + //! take over *p, *p MUST BE ON THE HEAP + Any_Iterator(Iterator *p) { me = p; } friend class Collection; -#if 0 - // Couldn't make this work with g++258 - friend Any_Iterator Collection::any_iterator(); -#endif +/* + * // Couldn't make this work with g++258 + * friend Any_Iterator Collection::any_iterator(); + */ Iterator *me; }; diff --git a/omegalib/omega/include/basic/Link.h b/omegalib/omega/include/basic/Link.h index ede7a2b..bdf169c 100644 --- a/omegalib/omega/include/basic/Link.h +++ b/omegalib/omega/include/basic/Link.h @@ -16,20 +16,19 @@ namespace omega { #endif #endif -/* - List_Element: one item in a list and the pointer to the next. - Each such object should be pointed to by either exactly one - other List_Element or by some other pointer(s), exactly one - of which will delete the List_Element. - ListElements should ONLY be allocated on the heap. - */ - #if ListElementFreeList // g++ 2.5.8 does not allow static data in template classes, so... extern void *kludgy_List_Element_new(size_t size); extern void kludgy_List_Element_delete(void *ptr, size_t size); #endif - +/*! + * \brief List_Element: one item in a list and the pointer to the next. + * + * Each such object should be pointed to by either exactly one + * other List_Element or by some other pointer(s), exactly one + * of which will delete the List_Element. + * ListElements should ONLY be allocated on the heap. + */ template class List_Element { public: #if ListElementFreeList diff --git a/omegalib/omega/include/basic/List.h b/omegalib/omega/include/basic/List.h index c6fc062..ee394d9 100644 --- a/omegalib/omega/include/basic/List.h +++ b/omegalib/omega/include/basic/List.h @@ -4,11 +4,6 @@ /* * Linked lists with an interface like a bit of libg++'s SLList class */ - - -#if 0 -#include /* List requires assert which needs Exit which */ -#endif /* needs List! just include assert in List.c */ #include // for NULL #include #include -- cgit v1.2.3-70-g09d2