HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TIL_HoldingQueue.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: TIL_HoldingQueue.C (TIL Library, C++)
7  *
8  * COMMENTS:
9  * Queue with constant time head addition, tail removal and
10  * internal removal.
11  */
12 #ifndef TIL_HOLDING_QUEUE_H
13 #define TIL_HOLDING_QUEUE_H
14 
15 #include "TIL_API.h"
16 #include <UT/UT_NonCopyable.h>
17 
18 class TIL_HoldingQueue;
19 
21 {
22 public:
23  TIL_HoldingNode() : myPrev(0), myNext(0), myQueue(0) { }
24 
25  TIL_HoldingNode *&prev() { return myPrev; }
26  TIL_HoldingNode *&next() { return myNext; }
27 
28  TIL_HoldingNode *prev() const { return myPrev; }
29  TIL_HoldingNode *next() const { return myNext; }
30 
31  void setQueue(TIL_HoldingQueue *q, bool update_queues=true);
32  TIL_HoldingQueue *queue() const { return myQueue; }
33 
34 private:
35  TIL_HoldingNode *myPrev;
36  TIL_HoldingNode *myNext;
37  TIL_HoldingQueue *myQueue;
38 };
39 
40 
42 {
43 public:
44  TIL_HoldingQueue() : myHead(0), myTail(0), myEntries(0) {}
46 
48 
49  // adds to head.
50  void add(TIL_HoldingNode *newtile);
51 
52  // removes an arbitrary tile.
53  void remove(TIL_HoldingNode *tile);
54 
55  // returns the last node off at the tail & removes it from the queue.
56  TIL_HoldingNode * pop();
57 
58  // queries.
59  TIL_HoldingNode * head() { return myHead; }
60  bool isEmpty() const { return myHead == 0; }
61  unsigned int entries() const { return myEntries; }
62 
63  // clears out the queue and deletes the holding nodes if delete_nodes is
64  // true.
65  void empty(bool delete_nodes = true);
66 
67  int traverse(int (*tfunc)(TIL_HoldingNode *, void *),
68  void *data);
69 private:
70  TIL_HoldingNode *myHead;
71  TIL_HoldingNode *myTail;
72  unsigned int myEntries;
73 };
74 
75 
76 #endif
77 
void
Definition: png.h:1083
UT_StringArray JOINTS head
OIIO_UTIL_API bool remove(string_view path, std::string &err)
TIL_HoldingNode *& next()
TIL_HoldingNode * next() const
GLdouble GLdouble GLdouble q
Definition: glad.h:2445
TIL_HoldingNode *& prev()
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
TIL_HoldingQueue * queue() const
unsigned int entries() const
TIL_HoldingNode * prev() const
GU_API ComputeHierarchyResult traverse(const GU_Detail *gdp, GA_OffsetArray &roots, GA_OffsetArray &nodes, GA_OffsetArray &parents, UT_Map< GA_Offset, GA_OffsetArray > *children=nullptr)
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define TIL_API
Definition: TIL_API.h:10
Definition: format.h:895
bool isEmpty() const