Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

SimpleQueue.h

Go to the documentation of this file.
00001 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
00002 ////////////////////////////////////////////////////////////////////
00003 //
00004 // Filename : SimpleQueue.h (base)
00005 //
00006 // This file is a part of the UPPAAL toolkit.
00007 // Copyright (c) 1995 - 2003, Uppsala University and Aalborg University.
00008 // All right reserved.
00009 //
00010 // $Id: SimpleQueue.h,v 1.5 2004/09/08 09:02:57 johanb Exp $
00011 //
00012 ///////////////////////////////////////////////////////////////////
00013 
00014 #ifndef INCLUDE_BASE_SIMPLEQUEUE_H
00015 #define INCLUDE_BASE_SIMPLEQUEUE_H
00016 
00017 #include "base/linkable.h"
00018 #include "base/inttypes.h"
00019 
00020 namespace base
00021 {
00022     /** Simple queue for linkable objects,
00023      * no allocation, very simple.
00024      */
00025     class SimpleQueue
00026     {
00027     public:
00028         virtual ~SimpleQueue();
00029 
00030         /** Kinds of queue.
00031          */
00032         enum { FIFO, LIFO };
00033 
00034         /** Get instances. You need to
00035          * delete them afterwards.
00036          * @param kind: kind of queue.
00037          */
00038         static SimpleQueue* newInstance(uint32_t kind);
00039 
00040         /** put an object in the queue.
00041          * @param o: object to put in
00042          */
00043         virtual void put(SingleLinkable_t *o) = 0;
00044 
00045         /** get an object from the queue.
00046          * @return NULL if queue is empty,
00047          * or !=NULL object that was put previously.
00048          */
00049         virtual SingleLinkable_t* get() = 0;
00050 
00051         /** reset the queue.
00052          * Resets the queue without deallocating any queue objects.
00053          */
00054         virtual void reset() = 0;
00055     };
00056 
00057 } // namespace base
00058 
00059 #endif // INCLUDE_BASE_SIMPLEQUEUE_H

Generated on Fri Jun 30 00:02:30 2006 for Module base by  doxygen 1.4.2