0N/A/*
2362N/A * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef JDWP_BAG_H
0N/A#define JDWP_BAG_H
0N/A
0N/A#include <jni.h>
0N/A
0N/A/* Declare general routines for manipulating a bag data structure.
0N/A * Synchronized use is the responsibility of caller.
0N/A */
0N/A
0N/Astruct bag;
0N/A
0N/A/* Must be used to create a bag. itemSize is the size
0N/A * of the items stored in the bag. initialAllocation is a hint
0N/A * for the initial number of items to allocate. Returns the
0N/A * allocated bag, returns NULL if out of memory.
0N/A */
0N/Astruct bag *bagCreateBag(int itemSize, int initialAllocation);
0N/A
0N/A/*
0N/A * Copy bag contents to another new bag. The new bag is returned, or
0N/A * NULL if out of memory.
0N/A */
0N/Astruct bag *bagDup(struct bag *);
0N/A
0N/A/* Destroy the bag and reclaim the space it uses.
0N/A */
0N/Avoid bagDestroyBag(struct bag *theBag);
0N/A
0N/A/* Find 'key' in bag. Assumes first entry in item is a pointer.
0N/A * Return found item pointer, NULL if not found.
0N/A */
0N/Avoid *bagFind(struct bag *theBag, void *key);
0N/A
0N/A/* Add space for an item in the bag.
0N/A * Return allocated item pointer, NULL if no memory.
0N/A */
0N/Avoid *bagAdd(struct bag *theBag);
0N/A
0N/A/* Delete specified item from bag.
0N/A * Does no checks.
0N/A */
0N/Avoid bagDelete(struct bag *theBag, void *condemned);
0N/A
0N/A/* Delete all items from the bag.
0N/A */
0N/Avoid bagDeleteAll(struct bag *theBag);
0N/A
0N/A/* Return the count of items stored in the bag.
0N/A */
0N/Aint bagSize(struct bag *theBag);
0N/A
0N/A/* Enumerate over the items in the bag, calling 'func' for
0N/A * each item. The function is passed the item and the user
0N/A * supplied 'arg'. Abort the enumeration if the function
0N/A * returns FALSE. Return TRUE if the enumeration completed
0N/A * successfully and FALSE if it was aborted.
0N/A * Addition and deletion during enumeration is not supported.
0N/A */
0N/Atypedef jboolean (*bagEnumerateFunction)(void *item, void *arg);
0N/A
0N/Ajboolean bagEnumerateOver(struct bag *theBag,
0N/A bagEnumerateFunction func, void *arg);
0N/A
0N/A#endif