CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
ConstAList.h
Go to the documentation of this file.
1// -*- C++ -*-
2// CLASSDOC OFF
3// $Id: ConstAList.h,v 1.2 2010/03/25 09:55:57 zhangy Exp $
4// CLASSDOC ON
5//
6// This file is a part of what might become CLHEP -
7// a Class Library for High Energy Physics.
8//
9// This is the definition of the HepConstAList class. It is used in the same
10// way as the HepAList class but the object are stored as const pointers.
11// HepAListIterator cannot be used for this list, use HepConstAListIterator
12// instead.
13//
14// .SS See Also
15// AIterator.h, List.h, ConstAIterator.h, AListBase.h, AIteratorBase.h
16//
17// .SS History
18// HepConstAList was developed from an original (non-template) list class
19// written by Dag Bruck.
20//
21// Author: Leif Lonnblad
22//
23
24#ifndef _CONSTALIST_H_
25#define _CONSTALIST_H_
26
27#include "MdcRecoUtil/AList.h"
28
29#ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
30#define inline
31#endif
32
33template <class T>
34class HepConstAList : public HepAListBase {
35
36public:
37
38 inline HepConstAList();
39 // Constructs a list with no objects.
40
41 inline HepConstAList(const HepAList<T> &);
42 // Copy constructor from non-const HepAList
43
45 // Copy constructor
46
48 // Destroys the list. The objects in the list are not destroyed.
49
50 inline void insert(const T *);
51 inline void insert(const T &);
52 // Inserts an object first in the list.
53
54 inline void insert(const T * e, const T * r);
55 inline void insert(const T & e, const T & r);
56 // Inserts the object e just before the first occurence of
57 // object r in the list.
58
59 inline void insert(const T * e, unsigned pos);
60 inline void insert(const T & e, unsigned pos);
61 // Inserts the object e at the position pos in the list. If pos is outside
62 // the list, the object will be appended.
63
64 inline void append(const T *);
65 inline void append(const T & e);
66 inline void operator += (const T *);
67 inline void operator += (const T &);
68 // Appends an object in the end of the list
69
70 inline void append(const T * e, const T * r);
71 inline void append(const T & e, const T & r);
72 // Appends the object e just after the last occurrence of object r
73 // in the list
74
75 inline void append(const HepAList<T> & l);
76 inline void append(const HepConstAList<T> & l);
77 inline void operator += (const HepAList<T> & l);
78 inline void operator += (const HepConstAList<T> & l);
79 // Appends all objects of list l to the end of this list.
80
81 inline void remove(const T *);
82 inline void remove(const T &);
83 // Remove all occurencies of the object from the list.
84
85 inline void remove(unsigned);
86 // Remove an object from the list.
87
88 inline void remove(const HepAList<T> &);
89 inline void remove(const HepConstAList<T> &);
90 // Remove all occurencies of the objects in list l from this list.
91
92 inline HepBoolean member(const T *) const;
93 inline HepBoolean member(const T &) const;
94 inline HepBoolean hasMember(const T *) const;
95 inline HepBoolean hasMember(const T &) const;
96 // Returns true if the object is a member of the list.
97
98 inline void replace(const T * eo, const T * en);
99 inline void replace(const T & eo, const T & en);
100 // Replace all occurencies of object eo with object en.
101
102 inline const T * operator[] (unsigned i) const;
103 // Returns the i:th object in the list.
104 // NOTE! the objects are numbered 0 to n-1.
105
106 inline int index(const T *) const;
107 inline int index(const T &) const;
108 // Returns the index of the last occurrence of the object.
109 // NOTE! the objects are numbered 0 to n-1.
110
111 inline int fIndex(const T *) const;
112 inline int fIndex(const T &) const;
113 // Returns the index of the first occurence of the object.
114 // NOTE! the objects are numbered 0 to n-1.
115
116 inline const T * first() const;
117 inline const T * last() const;
118 // Returns a pointer to the first and last object in the list.
119
120 inline void operator = (const HepAList<T> &);
121 inline void operator = (const HepConstAList<T> &);
122 // Assignment.
123
124 inline void sort(int (*compfunc)(const T **, const T **) );
125 // sort the list according to the function.
126 // the function is the same as one used by the C standard routine qsort.
127
128};
129
130#ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
131#undef inline
132#endif
133
134#ifdef HEP_SHORT_NAMES
135#define CAList HepConstAList
136#endif
137
138#include "MdcRecoUtil/ConstAList.icc"
139
140#endif
void remove(const T *)
const T * operator[](unsigned i) const
void append(const T &e, const T &r)
int index(const T &) const
void insert(const T &e, const T &r)
void operator+=(const T *)
void remove(unsigned)
void append(const HepAList< T > &l)
void replace(const T &eo, const T &en)
HepConstAList(const HepConstAList< T > &)
void insert(const T *)
void append(const T &e)
int fIndex(const T *) const
void append(const T *)
HepBoolean member(const T &) const
int fIndex(const T &) const
void operator=(const HepAList< T > &)
void append(const T *e, const T *r)
HepBoolean member(const T *) const
void remove(const HepConstAList< T > &)
const T * first() const
void insert(const T &)
HepBoolean hasMember(const T *) const
void remove(const T &)
const T * last() const
void insert(const T *e, const T *r)
void insert(const T *e, unsigned pos)
HepConstAList(const HepAList< T > &)
void replace(const T *eo, const T *en)
void append(const HepConstAList< T > &l)
HepBoolean hasMember(const T &) const
void remove(const HepAList< T > &)
void sort(int(*compfunc)(const T **, const T **))
void insert(const T &e, unsigned pos)
int index(const T *) const