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

wvmagiccircle.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * A circular queue that can be accessed across fork().
00006  */
00007 #ifndef __WVMAGICCIRCLE_H
00008 #define __WVMAGICCIRCLE_H
00009 
00010 #include "wvshmzone.h"
00011 
00012 
00013 /** A circular queue that can be accessed across fork(). */
00014 class WvMagicCircle : public WvError
00015 {
00016 public:
00017     /**
00018      * Creates a shared memory circular queue.
00019      *
00020      * "size" is the number of elements to store
00021      */
00022     WvMagicCircle(size_t size);
00023     ~WvMagicCircle();
00024     
00025 protected:
00026     WvShmZone shm;
00027     
00028     volatile int &head, &tail;
00029     int size;
00030     char *circle;
00031     
00032 public:
00033     size_t used();
00034     size_t left()
00035         { return size - used() - 1; }
00036     size_t put(const void *data, size_t len);
00037     size_t get(void *data, size_t len);
00038     size_t skip(size_t len);
00039 };
00040 
00041 
00042 #endif // __WVMAGICCIRCLE_H

Generated on Wed Dec 15 15:08:11 2004 for WvStreams by  doxygen 1.3.9.1