BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
CList.h
Go to the documentation of this file.
1// -*- C++ -*-
2// CLASSDOC OFF
3// $Id: CList.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 HepCList class.
10//
11// HepCList is a template based list class for storing copies of
12// objects. A HepCList can be made of any class where a copy
13// constructor and a operator== is defined.
14//
15//
16// .SS Usage // A list of eg. integers is declared as
17//
18// .ft B
19// HepCList<int> intlist;
20//
21//
22// .SS See Also
23//
24// AList.h AIterator.h, ConstAList.h, ConstAIterator.h, AListBase.h,
25// AIteratorBase.h
26//
27// Author: Leif Lonnblad
28//
29
30#ifndef _CLIST_H_
31#define _CLIST_H_
32
33#include "MdcRecoUtil/AListBase.h"
34#include "MdcRecoUtil/AList.h"
36
37#ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
38#define inline
39#endif
40
41template <class T>
42class HepCList : public HepAListBase {
43
44public:
45
46 inline HepCList();
47 // Constructs a list with no objects.
48
49 inline HepCList(const HepCList<T> &);
50 // copy constructor
51
52 inline HepCList(const HepAList<T> &);
53 inline HepCList(const HepConstAList<T> &);
54 // copy from an AList
55
56 inline ~HepCList();
57 // Destroys the list. All objects are destroyed.
58
59 inline void insert(const T &);
60 // Inserts an object first in the list.
61
62 inline void insert(const T & e, const T & r);
63 // Inserts the object e just before the first occurence of
64 // object r in the list.
65
66 inline void insert(const T & e, unsigned pos);
67 // Inserts the object e at the position pos in the list. If pos is outside
68 // the list, the object will be appended.
69
70 inline void append(const T &);
71 inline void operator += (const T &);
72 // Appends an object in the end of the list
73
74 inline void append(const T & e, const T & r);
75 // Appends the object e just after the last occurrence of object r
76 // in the list
77
78 inline void append(const HepCList<T> &);
79 inline void operator += (const HepCList<T> &);
80 inline void append(const HepAList<T> &);
81 inline void operator += (const HepAList<T> &);
82 inline void append(const HepConstAList<T> &);
83 inline void operator += (const HepConstAList<T> &);
84 // Appends copies of all objects of list l to the end of this list.
85
86 inline void remove(const T &);
87 // Remove and delete all occurencies equal to the object from the list.
88
89 inline void remove(const HepCList<T> &);
90 inline void remove(const HepConstAList<T> &);
91 inline void remove(const HepAList<T> &);
92 // Remove and delete all occurencies equal to the objects in list l
93 // from this list.
94
95 inline void remove(unsigned);
96 // Remove and delete an object in the list.
97
98 inline void removeAll();
99 // Remove and delete all objects in the list.
100
101 inline void purge();
102 // Remove and delete all duplicate objects in the list.
103
104 inline HepBoolean member(const T &) const;
105 inline HepBoolean hasMember(const T &) const;
106 // Returns true if the object is equal to a member of the list.
107
108 inline void replace(const T & eo, const T & en);
109 // Replace all occurencies of object eo with object en.
110
111 inline T * operator[] (unsigned i) const;
112 // Returns the i:th object in the list.
113 // NOTE! the objects are numbered 0 to n-1.
114
115 inline int index(const T &) const;
116 // Returns the index of the last occurrence equal to the object.
117 // NOTE! the objects are numbered 0 to n-1.
118
119 inline int fIndex(const T &) const;
120 // Returns the index of the first occurence of the object.
121 // NOTE! the objects are numbered 0 to n-1.
122
123 inline T * first() const;
124 inline T * last() const;
125 // Returns a pointer to the first and last object in the list.
126
127 inline void operator = (const HepCList<T> &);
128 inline void operator = (const HepAList<T> &);
129 inline void operator = (const HepConstAList<T> &);
130 // Assignment.
131
132protected:
133
134 inline T * Nth(unsigned i) const;
135 // Returns the i:th object in the list.
136
137};
138
139#ifdef HEP_NO_INLINE_IN_TEMPLATE_DECLARATION
140#undef inline
141#endif
142
143#ifdef HEP_SHORT_NAMES
144#define CList HepCList
145#endif
146
147#include "MdcRecoUtil/CList.icc"
148
149#endif
150
Definition: CList.h:42
void replace(const T &eo, const T &en)
void removeAll()
void insert(const T &e, const T &r)
void remove(const T &)
void operator+=(const T &)
void append(const HepCList< T > &)
T * last() const
T * Nth(unsigned i) const
void insert(const T &e, unsigned pos)
void remove(const HepCList< T > &)
HepBoolean member(const T &) const
int fIndex(const T &) const
int index(const T &) const
void remove(const HepConstAList< T > &)
HepBoolean hasMember(const T &) const
HepCList(const HepAList< T > &)
void purge()
void append(const HepConstAList< T > &)
T * operator[](unsigned i) const
T * first() const
HepCList(const HepCList< T > &)
void insert(const T &)
void remove(unsigned)
void remove(const HepAList< T > &)
void operator=(const HepCList< T > &)
HepCList(const HepConstAList< T > &)
void append(const HepAList< T > &)
void append(const T &)
void append(const T &e, const T &r)