Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/net/queuedReturn.h

Go to the documentation of this file.
00001 // Filename: queuedReturn.h
00002 // Created by:  drose (25Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef QUEUEDRETURN_H
00020 #define QUEUEDRETURN_H
00021 
00022 #include <pandabase.h>
00023 
00024 #include "connectionListener.h"
00025 #include "connection.h"
00026 #include "netAddress.h"
00027 
00028 #include <prlock.h>
00029 #include "pdeque.h"
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : QueuedReturn
00033 // Description : This is the implementation of a family of things that
00034 //               queue up their return values for later retrieval by
00035 //               client code, like QueuedConnectionReader,
00036 //               QueuedConnectionListener, QueuedConnectionManager.
00037 ////////////////////////////////////////////////////////////////////
00038 template<class Thing>
00039 class QueuedReturn {
00040 PUBLISHED:
00041   void set_max_queue_size(int max_size);
00042   int get_max_queue_size() const;
00043   int get_current_queue_size() const;
00044 
00045 protected:
00046   QueuedReturn();
00047   ~QueuedReturn();
00048 
00049   INLINE bool thing_available() const;
00050   bool get_thing(Thing &thing);
00051 
00052   bool enqueue_thing(const Thing &thing);
00053   bool enqueue_unique_thing(const Thing &thing);
00054 
00055 private:
00056   PRLock *_mutex;
00057   pdeque<Thing> _things;
00058   bool _available;
00059   int _max_queue_size;
00060 };
00061 
00062 #include "queuedReturn.I"
00063 
00064 #endif
00065 

Generated on Fri May 2 00:40:36 2003 for Panda by doxygen1.3