3 // Fast lookup table abstraction implemented as an Iteration Number Array
6 * Copyright (C) 1989 Free Software Foundation, Inc.
7 * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu)
9 * This file is part of GNU GPERF.
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "Bool_Array.h"
27 #include "ace/OS_NS_string.h"
28 #include "ace/OS_Memory.h"
30 // Prints out debugging diagnostics.
32 Bool_Array::~Bool_Array ()
34 if (option
[DEBUGGING
])
36 "\ndumping boolean array information\n"
37 "size = %u\niteration number = %u\nend of array dump\n",
40 delete [] this->storage_array_
;
43 Bool_Array::Bool_Array ()
45 generation_number_ (0),
51 Bool_Array::open (u_long s
)
53 this->generation_number_
= 1;
56 ACE_NEW_RETURN (storage_array_
,
60 ACE_OS::memset (storage_array_
,
62 s
* sizeof *storage_array_
);
64 if (option
[DEBUGGING
])
66 "\nbool array size = %u, total bytes = %u\n",
68 size_
* (int) sizeof *storage_array_
));
73 Bool_Array::find (u_long slot
)
75 if (storage_array_
[slot
] == generation_number_
)
79 storage_array_
[slot
] = generation_number_
;
87 if (++generation_number_
== 0)
89 if (option
[DEBUGGING
])
91 "(re-initializing bool_array)..."));
93 this->generation_number_
= 1;
94 ACE_OS::memset (storage_array_
,
96 size_
* sizeof *storage_array_
);
97 if (option
[DEBUGGING
])