QueueingAlgorithm.cci
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief QueueingSocketSink inline non-template implementation */
16 
17 //#include "QueueingSocketSink.ih"
18 
19 // Custom includes
20 
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::ppi::QueueingAlgorithm
26 
27 prefix_ unsigned senf::ppi::QueueingAlgorithm::size()
28  const
29 {
30  return v_size();
31 }
32 
33 prefix_ unsigned senf::ppi::QueueingAlgorithm::peek(unsigned maxSize)
34  const
35 {
36  return v_peek(maxSize);
37 }
38 
39 prefix_ void senf::ppi::QueueingAlgorithm::clear()
40 {
41  v_clear();
42 }
43 
44 prefix_ bool senf::ppi::QueueingAlgorithm::empty()
45  const
46 {
47  return v_empty();
48 }
49 
50 prefix_ senf::Packet const & senf::ppi::QueueingAlgorithm::front()
51  const
52 {
53  return v_front();
54 }
55 
56 prefix_ bool senf::ppi::QueueingAlgorithm::enqueue(Packet const & packet, bool force)
57 {
58  return v_enqueue( packet, force);
59 }
60 
61 prefix_ void senf::ppi::QueueingAlgorithm::pop()
62 {
63  return v_pop();
64 }
65 
66 
67 //-/////////////////////////////////////////////////////////////////////////////////////////////////
68 // senf::ppi::FIFOQueueingAlgorithm
69 
70 prefix_ unsigned senf::ppi::FIFOQueueingAlgorithm::v_size()
71  const
72 {
73  return queue_.size();
74 }
75 
76 prefix_ unsigned senf::ppi::FIFOQueueingAlgorithm::v_peek(unsigned maxSize)
77  const
78 {
79  if (!queue_.empty() and (queue_.front().size() <= maxSize))
80  return queue_.front().size();
81  return 0;
82 }
83 
84 prefix_ senf::Packet const & senf::ppi::FIFOQueueingAlgorithm::v_front()
85  const
86 {
87  return queue_.front();
88 }
89 
90 
91 prefix_ void senf::ppi::FIFOQueueingAlgorithm::v_pop()
92 {
93  queue_.pop();
94 }
95 
96 prefix_ bool senf::ppi::FIFOQueueingAlgorithm::v_empty()
97  const
98 {
99  return queue_.empty();
100 }
101 
102 //-/////////////////////////////////////////////////////////////////////////////////////////////////
103 // senf::ppi::NoneQueueingAlgorithm
104 
105 prefix_ unsigned senf::ppi::NoneQueueingAlgorithm::v_size()
106  const
107 {
108  return 0u;
109 }
110 
111 prefix_ unsigned senf::ppi::NoneQueueingAlgorithm::v_peek(unsigned maxSize)
112  const
113 {
114  return 0;
115 }
116 
117 prefix_ senf::Packet const & senf::ppi::NoneQueueingAlgorithm::v_front()
118  const
119 {
120  static senf::Packet _pkt_;
121  return _pkt_;
122 }
123 
124 prefix_ void senf::ppi::NoneQueueingAlgorithm::v_pop()
125 {
126 }
127 
128 prefix_ void senf::ppi::NoneQueueingAlgorithm::v_clear()
129 {}
130 
131 prefix_ bool senf::ppi::NoneQueueingAlgorithm::v_enqueue(Packet const & packet, bool force)
132 {
133  return false;
134 }
135 
136 prefix_ bool senf::ppi::NoneQueueingAlgorithm::v_empty()
137  const
138 {
139  return true;
140 }
141 
142 prefix_ senf::ppi::QueueingAlgorithm::ptr senf::ppi::NoneQueueingAlgorithm::create()
143 {
144  return QueueingAlgorithm::ptr(new NoneQueueingAlgorithm());
145 }
146 
147 //-/////////////////////////////////////////////////////////////////////////////////////////////////
148 #undef prefix_
149 
150 
151 // Local Variables:
152 // mode: c++
153 // fill-column: 100
154 // comment-column: 40
155 // c-file-style: "senf"
156 // indent-tabs-mode: nil
157 // ispell-local-dictionary: "american"
158 // compile-command: "scons -u test"
159 // End: