/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcRecoUtil/MdcRecoUtil-00-01-08/MdcRecoUtil/CList.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // CLASSDOC OFF
00003 // $Id: CList.h,v 1.2 2010/03/25 09:55:57 zhangy Exp $
00004 // CLASSDOC ON
00005 //
00006 // This file is a part of what might become CLHEP -
00007 // a Class Library for High Energy Physics.
00008 // 
00009 // This is the definition of the HepCList class.
00010 //
00011 // HepCList is a template based list class for storing copies of
00012 // objects.  A HepCList can be made of any class where a copy
00013 // constructor and a operator== is defined.
00014 // 
00015 //
00016 // .SS Usage // A list of eg. integers is declared as
00017 //
00018 // .ft B
00019 //      HepCList<int> intlist;
00020 //
00021 //
00022 // .SS See Also
00023 //
00024 // AList.h AIterator.h, ConstAList.h, ConstAIterator.h, AListBase.h,
00025 // AIteratorBase.h
00026 //
00027 // Author: Leif Lonnblad
00028 //
00029 
00030 #ifndef _CLIST_H_
00031 #define _CLIST_H_
00032 
00033 #include "MdcRecoUtil/AListBase.h"
00034 #include "MdcRecoUtil/AList.h"
00035 #include "MdcRecoUtil/ConstAList.h"
00036 
00037 #ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
00038 #define inline
00039 #endif
00040 
00041 template <class T>
00042 class  HepCList : public HepAListBase {
00043 
00044 public:
00045 
00046   inline HepCList();
00047   // Constructs a list with no objects.
00048 
00049   inline HepCList(const HepCList<T> &);
00050   // copy constructor
00051 
00052   inline HepCList(const HepAList<T> &);
00053   inline HepCList(const HepConstAList<T> &);
00054   // copy from an AList
00055 
00056   inline ~HepCList();
00057   // Destroys the list. All objects are destroyed.
00058 
00059   inline void insert(const T &);
00060   // Inserts an object first in the list.
00061 
00062   inline void insert(const T & e, const T & r);
00063   // Inserts the object e just before the first occurence of
00064   // object r in the list. 
00065 
00066   inline void insert(const T & e, unsigned pos);
00067   // Inserts the object e at the position pos in the list. If pos is outside
00068   // the list, the object will be appended.
00069 
00070   inline void append(const T &);
00071   inline void operator += (const T &);
00072   // Appends an object in the end of the list
00073 
00074   inline void append(const T & e, const T & r);
00075   // Appends the object e just after the last occurrence of object r
00076   // in the list
00077 
00078   inline void append(const HepCList<T> &);
00079   inline void operator += (const HepCList<T> &);
00080   inline void append(const HepAList<T> &);
00081   inline void operator += (const HepAList<T> &);
00082   inline void append(const HepConstAList<T> &);
00083   inline void operator += (const HepConstAList<T> &);
00084   // Appends copies of all objects of list l to the end of this list.
00085 
00086   inline void remove(const T &);
00087   // Remove and delete all occurencies equal to  the object from the list.
00088 
00089   inline void remove(const HepCList<T> &);
00090   inline void remove(const HepConstAList<T> &);
00091   inline void remove(const HepAList<T> &);
00092   // Remove and delete all occurencies equal to the objects in list l
00093   // from this list.
00094 
00095   inline void remove(unsigned);
00096   // Remove and delete an object in the list.
00097 
00098   inline void removeAll();
00099   // Remove and delete all objects in the list.
00100 
00101   inline void purge();
00102   // Remove and delete all duplicate objects in the list.
00103 
00104   inline HepBoolean member(const T &) const;
00105   inline HepBoolean hasMember(const T &) const;
00106   // Returns true if the object is equal to a member of the list.
00107 
00108   inline void replace(const T & eo, const T & en);
00109   // Replace all occurencies of object eo with object en.
00110 
00111   inline T * operator[] (unsigned i) const;
00112   // Returns the i:th object in the list.
00113   // NOTE! the objects are numbered 0 to n-1.
00114 
00115   inline int index(const T &) const;
00116   // Returns the index of the last occurrence equal to the object.
00117   // NOTE! the objects are numbered 0 to n-1.
00118 
00119   inline int fIndex(const T &) const;
00120   // Returns the index of the first occurence of the object.
00121   // NOTE! the objects are numbered 0 to n-1.
00122 
00123   inline T * first() const;
00124   inline T * last() const;
00125   // Returns a pointer to the first and last object in the list.
00126 
00127   inline void operator = (const HepCList<T> &);
00128   inline void operator = (const HepAList<T> &);
00129   inline void operator = (const HepConstAList<T> &);
00130   // Assignment.
00131 
00132 protected:
00133 
00134   inline T * Nth(unsigned i) const;
00135   // Returns the i:th object in the list.
00136   
00137 };
00138 
00139 #ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
00140 #undef inline
00141 #endif
00142 
00143 #ifdef HEP_SHORT_NAMES
00144 #define CList HepCList
00145 #endif
00146 
00147 #include "MdcRecoUtil/CList.icc"
00148 
00149 #endif
00150 

Generated on Tue Nov 29 23:13:31 2016 for BOSS_7.0.2 by  doxygen 1.4.7