BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Queue.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef CL_QUEUE_HPP
13#define CL_QUEUE_HPP
14
15#include <queue>
16#include "cl_Cell.hpp"
17
18namespace belfem
19{
26 template< typename T >
27 class Queue
28 {
29 std::queue< T > mQueue;
30
31//------------------------------------------------------------------------------
32 public:
33//------------------------------------------------------------------------------
34
35 Queue() = default ;
36
37 // Copy constructor
38 Queue( const Queue< T > & other ) = default;
39
40 // Move constructor
41 Queue( Queue< T > && other ) noexcept = default;
42
43 // Copy assignment operator
44 Queue< T >& operator=( const Queue< T > & other ) = default;
45
46 // Move assignment operator
47 Queue< T >& operator=( Queue< T > && other ) noexcept = default;
48
49 // special operator for converting a cell
50 Queue( Cell< T > & aCell )
51 {
52 for( auto tValue : aCell )
53 {
54 mQueue.push( tValue );
55 }
56 }
57
58//------------------------------------------------------------------------------
59
60 ~Queue() = default;
61
62//------------------------------------------------------------------------------
63
64 void
65 push( const T & aValue )
66 {
67 mQueue.push( aValue );
68 }
69
70//------------------------------------------------------------------------------
71
72 T
74 {
75 T aPop = mQueue.front();
76 mQueue.pop();
77 return aPop;
78 }
79
80//------------------------------------------------------------------------------
81
82 size_t
83 size() const
84 {
85 return mQueue.size();
86 }
87
88//------------------------------------------------------------------------------
89
90 auto
91 empty()-> decltype( mQueue.empty() ) const
92 {
93 return mQueue.empty();
94 }
95
96//------------------------------------------------------------------------------
97 };
98}
99
100#endif //CL_QUEUE_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Queue(const Queue< T > &other)=default
Queue(Queue< T > &&other) noexcept=default
Queue< T > & operator=(const Queue< T > &other)=default
T pop()
Definition cl_Queue.hpp:73
Queue(Cell< T > &aCell)
Definition cl_Queue.hpp:50
~Queue()=default
auto empty() -> decltype(mQueue.empty()) const
Definition cl_Queue.hpp:91
Queue()=default
void push(const T &aValue)
Definition cl_Queue.hpp:65
size_t size() const
Definition cl_Queue.hpp:83
Queue< T > & operator=(Queue< T > &&other) noexcept=default
USER GUIDES:
Definition cl_Capacitor.cpp:16