Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/back/bag.h
38765 views
/*1* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef JDWP_BAG_H26#define JDWP_BAG_H2728#include <jni.h>2930/* Declare general routines for manipulating a bag data structure.31* Synchronized use is the responsibility of caller.32*/3334struct bag;3536/* Must be used to create a bag. itemSize is the size37* of the items stored in the bag. initialAllocation is a hint38* for the initial number of items to allocate. Returns the39* allocated bag, returns NULL if out of memory.40*/41struct bag *bagCreateBag(int itemSize, int initialAllocation);4243/*44* Copy bag contents to another new bag. The new bag is returned, or45* NULL if out of memory.46*/47struct bag *bagDup(struct bag *);4849/* Destroy the bag and reclaim the space it uses.50*/51void bagDestroyBag(struct bag *theBag);5253/* Find 'key' in bag. Assumes first entry in item is a pointer.54* Return found item pointer, NULL if not found.55*/56void *bagFind(struct bag *theBag, void *key);5758/* Add space for an item in the bag.59* Return allocated item pointer, NULL if no memory.60*/61void *bagAdd(struct bag *theBag);6263/* Delete specified item from bag.64* Does no checks.65*/66void bagDelete(struct bag *theBag, void *condemned);6768/* Delete all items from the bag.69*/70void bagDeleteAll(struct bag *theBag);7172/* Return the count of items stored in the bag.73*/74int bagSize(struct bag *theBag);7576/* Enumerate over the items in the bag, calling 'func' for77* each item. The function is passed the item and the user78* supplied 'arg'. Abort the enumeration if the function79* returns FALSE. Return TRUE if the enumeration completed80* successfully and FALSE if it was aborted.81* Addition and deletion during enumeration is not supported.82*/83typedef jboolean (*bagEnumerateFunction)(void *item, void *arg);8485jboolean bagEnumerateOver(struct bag *theBag,86bagEnumerateFunction func, void *arg);8788#endif899091