AGENT++
4.0.3
Main Page
Related Pages
Classes
Files
File List
File Members
include
agent_pp
map.h
Go to the documentation of this file.
1
/*_############################################################################
2
_##
3
_## AGENT++ 4.0 - map.h
4
_##
5
_## Copyright (C) 2000-2013 Frank Fock and Jochen Katz (agentpp.com)
6
_##
7
_## Licensed under the Apache License, Version 2.0 (the "License");
8
_## you may not use this file except in compliance with the License.
9
_## You may obtain a copy of the License at
10
_##
11
_## http://www.apache.org/licenses/LICENSE-2.0
12
_##
13
_## Unless required by applicable law or agreed to in writing, software
14
_## distributed under the License is distributed on an "AS IS" BASIS,
15
_## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
_## See the License for the specific language governing permissions and
17
_## limitations under the License.
18
_##
19
_##########################################################################*/
20
// This may look like C code, but it is really -*- C++ -*-
21
/*
22
Copyright (C) 1988 Free Software Foundation
23
written by Doug Lea (dl@rocky.oswego.edu)
24
25
This file is part of the GNU C++ Library. This library is free
26
software; you can redistribute it and/or modify it under the terms of
27
the GNU Library General Public License as published by the Free
28
Software Foundation; either version 2 of the License, or (at your
29
option) any later version. This library is distributed in the hope
30
that it will be useful, but WITHOUT ANY WARRANTY; without even the
31
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
32
PURPOSE. See the GNU Library General Public License for more details.
33
You should have received a copy of the GNU Library General Public
34
License along with this library; if not, write to the Free Software
35
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36
*/
37
38
#include <
agent_pp/agent++.h
>
39
#include <
agent_pp/oidx_defs.h
>
40
#include <
agent_pp/entry.h
>
41
42
#ifndef _OidxPtrEntryPtrMap_h
43
#ifdef __GNUG__
44
#pragma interface
45
#endif
46
#define _OidxPtrEntryPtrMap_h 1
47
48
#ifdef AGENTPP_NAMESPACE
49
namespace
Agentpp {
50
#endif
51
52
typedef
void
*
Pix
;
53
54
55
56
class
AGENTPP_DECL
OidxPtrEntryPtrMap
57
{
58
protected
:
59
int
count
;
60
EntryPtr
def
;
61
62
public
:
63
OidxPtrEntryPtrMap
(
EntryPtr
deflt)
64
: count(0), def(deflt) {};
65
virtual
~OidxPtrEntryPtrMap
() {};
66
67
int
length
()
const
{
return
count; };
// current number of items
68
bool
empty
()
const
{
return
(count == 0);};
69
70
virtual
int
contains(
OidxPtr
key)
const
;
// is key mapped?
71
72
virtual
void
clear();
// delete all items
73
74
virtual
EntryPtr
& operator [] (
OidxPtr
key) = 0;
// access contents by key
75
76
virtual
void
del(
OidxPtr
key) = 0;
// delete entry
77
78
virtual
Pix
first()
const
= 0;
// Pix of first item or 0
79
virtual
void
next(
Pix
& i)
const
= 0;
// advance to next or 0
80
virtual
OidxPtr
& key(
Pix
i)
const
= 0;
// access key at i
81
virtual
EntryPtr
& contents(
Pix
i) = 0;
// access contents at i
82
83
virtual
int
owns(
Pix
i);
// is i a valid Pix ?
84
virtual
Pix
seek(
OidxPtr
key)
const
;
// Pix of key
85
86
EntryPtr
&
dflt
() {
return
def; };
// access default val
87
88
void
error(
const
char
* msg)
const
;
89
virtual
int
OK() = 0;
// rep invariant
90
};
91
92
#ifdef AGENTPP_NAMESPACE
93
}
94
#endif
95
#endif
Generated by
1.8.2