MCPcopy Create free account
hub / github.com/NetSys/bess / Queue

Class Queue

core/utils/queue.h:39–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37// Takes Template argument T that is the type to be enqueued and dequeued.
38template <typename T>
39class Queue {
40 public:
41 virtual ~Queue(){};
42
43 // Enqueue one object. Takes object to be added. Returns 0 on
44 // success.
45 virtual int Push(T) = 0;
46
47 // Enqueue multiple objects. Takes a pointer to a table of objects, the
48 // number of objects to be added. Returns the number of objects enqueued
49 virtual int Push(T*, size_t) = 0;
50
51 // Dequeue one object. Takes an object to set to the dequeued object. returns
52 // zero on success
53 virtual int Pop(T&) = 0;
54
55
56 // Dequeue several objects. Takes table to put objects and the number of objects
57 // to be dequeued into the table returns the number of objects dequeued into the
58 // table
59 virtual int Pop(T*, size_t) = 0;
60
61 // Returns the total capacity of the queue
62 virtual size_t Capacity() = 0;
63
64 // Returns the number of objects in the queue
65 virtual size_t Size() = 0;
66
67 // Returns true if queue is empty
68 virtual bool Empty() = 0;
69
70 // Returns true if full and false otherwise
71 virtual bool Full() = 0;
72
73 // Resizes the queue to the specified new capacity which must be larger than
74 // the current size. Returns 0 on success.
75 virtual int Resize(size_t) = 0;
76};
77
78} // namespace utils
79} // namespace bess

Callers 2

test_queueMethod · 0.50
test_nat_queueMethod · 0.50

Calls

no outgoing calls

Tested by 2

test_queueMethod · 0.40
test_nat_queueMethod · 0.40