BSD 4_3_Net_2 release
[unix-history] / usr / src / lib / libg++ / g++-include / gen / OSLBag.hP
CommitLineData
936f52d6
C
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of GNU CC.
7
8GNU CC is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY. No author or distributor
10accepts responsibility to anyone for the consequences of using it
11or for whether it serves any particular purpose or works at all,
12unless he says so in writing. Refer to the GNU CC General Public
13License for full details.
14
15Everyone is granted permission to copy, modify and redistribute
16GNU CC, but only under the conditions described in the
17GNU CC General Public License. A copy of this license is
18supposed to have been given to you along with GNU CC so you
19can know your rights and responsibilities. It should be in a
20file named COPYING. Among other things, the copyright notice
21and this notice must be preserved on all copies.
22*/
23
24
25#ifndef _<T>OSLBag_h
26#ifdef __GNUG__
27#pragma once
28#pragma interface
29#endif
30#define _<T>OSLBag_h 1
31
32#include "<T>.Bag.h"
33#include "<T>.SLList.h"
34
35class <T>OSLBag : public <T>Bag
36{
37protected:
38 <T>SLList p;
39
40public:
41 <T>OSLBag();
42 <T>OSLBag(const <T>OSLBag&);
43
44 Pix add(<T&> item);
45 void del(<T&> item);
46 void remove(<T&>item);
47
48 int contains(<T&> item);
49 int nof(<T&> item);
50
51 void clear();
52
53 Pix first();
54 void next(Pix& i);
55 <T>& operator () (Pix i);
56 int owns(Pix i);
57 Pix seek(<T&> item, Pix from = 0);
58
59 int OK();
60};
61
62#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)
63
64inline <T>OSLBag::<T>OSLBag() : p() { count = 0; }
65
66inline <T>OSLBag::<T>OSLBag(const <T>OSLBag& s) : p(s.p) { count = s.count; }
67
68inline Pix <T>OSLBag::first()
69{
70 return p.first();
71}
72
73inline void <T>OSLBag::next(Pix & idx)
74{
75 p.next(idx);
76}
77
78inline <T>& <T>OSLBag::operator ()(Pix idx)
79{
80 return p(idx);
81}
82
83inline void <T>OSLBag::clear()
84{
85 count = 0; p.clear();
86}
87
88inline int <T>OSLBag::owns (Pix idx)
89{
90 return p.owns(idx);
91}
92
93inline int <T>OSLBag::contains(<T&> item)
94{
95 return seek(item) != 0;
96}
97
98
99#endif
100#endif