GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
queuing_policy.h
Go to the documentation of this file.
1// Copyright 2016 The Draco Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// File defining a coherent interface for different queuing strategies.
16
17#ifndef DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_QUEUING_POLICY_H_
18#define DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_QUEUING_POLICY_H_
19
20#include <queue>
21#include <stack>
22#include <utility>
23
24namespace draco {
25
26template <class T>
27class Queue {
28 public:
29 bool empty() const { return q_.empty(); }
30 typename std::queue<T>::size_type size() const { return q_.size(); }
31 void clear() { return q_.clear(); }
32 void push(const T &value) { q_.push(value); }
33 void push(T &&value) { q_.push(std::move(value)); }
34 void pop() { q_.pop(); }
35 typename std::queue<T>::const_reference front() const { return q_.front(); }
36
37 private:
38 std::queue<T> q_;
39};
40
41template <class T>
42class Stack {
43 public:
44 bool empty() const { return s_.empty(); }
45 typename std::stack<T>::size_type size() const { return s_.size(); }
46 void clear() { return s_.clear(); }
47 void push(const T &value) { s_.push(value); }
48 void push(T &&value) { s_.push(std::move(value)); }
49 void pop() { s_.pop(); }
50 typename std::stack<T>::const_reference front() const { return s_.top(); }
51
52 private:
53 std::stack<T> s_;
54};
55
56template <class T, class Compare = std::less<T> >
58 typedef std::priority_queue<T, std::vector<T>, Compare> QType;
59
60 public:
61 bool empty() const { return s_.empty(); }
62 typename QType::size_type size() const { return s_.size(); }
63 void clear() { return s_.clear(); }
64 void push(const T &value) { s_.push(value); }
65 void push(T &&value) { s_.push(std::move(value)); }
66 void pop() { s_.pop(); }
67 typename QType::const_reference front() const { return s_.top(); }
68
69 private:
70 QType s_;
71};
72
73} // namespace draco
74
75#endif // DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_QUEUING_POLICY_H_
Definition Equalizer.hh:245
Definition queuing_policy.h:57
void push(const T &value)
Definition queuing_policy.h:64
void push(T &&value)
Definition queuing_policy.h:65
QType::size_type size() const
Definition queuing_policy.h:62
QType::const_reference front() const
Definition queuing_policy.h:67
void pop()
Definition queuing_policy.h:66
bool empty() const
Definition queuing_policy.h:61
void clear()
Definition queuing_policy.h:63
Definition queuing_policy.h:27
void push(T &&value)
Definition queuing_policy.h:33
std::queue< T >::size_type size() const
Definition queuing_policy.h:30
void push(const T &value)
Definition queuing_policy.h:32
void pop()
Definition queuing_policy.h:34
std::queue< T >::const_reference front() const
Definition queuing_policy.h:35
void clear()
Definition queuing_policy.h:31
bool empty() const
Definition queuing_policy.h:29
Definition queuing_policy.h:42
std::stack< T >::const_reference front() const
Definition queuing_policy.h:50
std::stack< T >::size_type size() const
Definition queuing_policy.h:45
void clear()
Definition queuing_policy.h:46
void pop()
Definition queuing_policy.h:49
bool empty() const
Definition queuing_policy.h:44
void push(const T &value)
Definition queuing_policy.h:47
void push(T &&value)
Definition queuing_policy.h:48
Definition attribute_octahedron_transform.cc:21
Definition GameApi.h:42