SbFifo.h Source File

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SbFifo.h
1 #ifndef COIN_SBFIFO_H
2 #define COIN_SBFIFO_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/C/threads/fifo.h>
28
29 class SbFifo {
30 public:
31 SbFifo(void) { this->fifo = cc_fifo_new(); }
32 ~SbFifo(void) { cc_fifo_delete(this->fifo); }
33
34 void assign(void * ptr, uint32_t type)
35 { cc_fifo_assign(this->fifo, ptr, type); }
36 void retrieve(void *& ptr, uint32_t &type)
37 { cc_fifo_retrieve(this->fifo, &ptr, &type); }
38 SbBool tryRetrieve(void *& ptr, uint32_t & type)
39 { return cc_fifo_try_retrieve(this->fifo, &ptr, &type); }
40
41 unsigned int size(void) const { return cc_fifo_size(this->fifo); }
42
43 void lock(void) const { cc_fifo_lock(this->fifo); }
44 void unlock(void) const { cc_fifo_unlock(this->fifo); }
45
46 // lock/unlock only needed around the following operations:
47 SbBool peek(void *& item, uint32_t & type) const
48 { return cc_fifo_peek(this->fifo, &item, &type); }
49 SbBool contains(void * item) const
50 { return cc_fifo_contains(this->fifo, item); }
51 SbBool reclaim(void * item)
52 { return cc_fifo_reclaim(this->fifo, item); }
53
54 private:
55 cc_fifo * fifo;
56 };
57
58 #endif // !COIN_SBFIFO_H
SbFifo::peek
SbBool peek(void *&item, uint32_t &type) const
Definition: SbFifo.h:47
SbFifo::unlock
void unlock(void) const
Definition: SbFifo.h:44
SbFifo::reclaim
SbBool reclaim(void *item)
Definition: SbFifo.h:51
SbFifo::contains
SbBool contains(void *item) const
Definition: SbFifo.h:49
SbFifo::size
unsigned int size(void) const
Definition: SbFifo.h:41
SbFifo::tryRetrieve
SbBool tryRetrieve(void *&ptr, uint32_t &type)
Definition: SbFifo.h:38
SbFifo::retrieve
void retrieve(void *&ptr, uint32_t &type)
Definition: SbFifo.h:36
SbFifo::lock
void lock(void) const
Definition: SbFifo.h:43
SbFifo
A class for managing a pointer first-in, first-out queue.
Definition: SbFifo.h:29
SbFifo::assign
void assign(void *ptr, uint32_t type)
Definition: SbFifo.h:34

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.