summaryrefslogtreecommitdiff
path: root/gnu/lib/libg++/g++-include/gen/OXPBag.hP
blob: 5542a273dc337c3d5bbbea57084e9e4e7abdd3bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _<T>OXPBag_h
#ifdef __GNUG__
#pragma once
#pragma interface
#endif
#define _<T>OXPBag_h 1

#include "<T>.Bag.h"
#include "<T>.XPlex.h"

class <T>OXPBag : public <T>Bag
{
protected:
  <T>XPlex       p;

public:
                <T>OXPBag(int chunksize = DEFAULT_INITIAL_CAPACITY);
                <T>OXPBag(const <T>OXPBag&);

  Pix           add(<T&> item);
  void          del(<T&> item);
  void          remove(<T&>item);
  int           nof(<T&> item);
  int           contains(<T&> item);

  void          clear();

  Pix           first();
  void          next(Pix& i);
  <T>&          operator () (Pix i);
  int           owns(Pix i);
  Pix           seek(<T&> item, Pix from = 0);

  int           OK();
};


#if defined(__OPTIMIZE__) || defined(USE_LIBGXX_INLINES)

inline <T>OXPBag::<T>OXPBag(int chunksize) 
     : p(chunksize) { count = 0; }

inline <T>OXPBag::<T>OXPBag(const <T>OXPBag& s) : p(s.p) { count = s.count; }

inline Pix <T>OXPBag::first()
{
  return p.first();
}

inline void <T>OXPBag::next(Pix  & idx)
{
  p.next(idx);
}

inline <T>& <T>OXPBag::operator ()(Pix   idx)
{
  return p(idx);
}

inline void <T>OXPBag::clear()
{
  count = 0;  p.clear();
}

inline int <T>OXPBag::owns (Pix   idx)
{
  return p.owns(idx);
}

inline int <T>OXPBag::contains(<T&> item)
{
  return seek(item) != 0;
}

#endif
#endif