Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 76fe5f8f6d7918fa2ca4a5db7c62050f91e0e85a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*******************************************************************************
 * Copyright (c) 2016 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * CONTRIBUTORS:
 * 		Jan Belle (initial contribution)
 *
 *******************************************************************************/

#ifndef SRC_COMMON_CONTAINERS_STATICQUEUE_H_
#define SRC_COMMON_CONTAINERS_STATICQUEUE_H_

#include "common/containers/StaticDeque.h"

/**
 * Queue implementation with a circular buffer
 * The type T must implement the copy constructor
 */
template<class T, int maxSize>
class StaticQueue : private StaticDeque<T, maxSize> {
public:
	StaticQueue(void) : StaticDeque<T, maxSize>() {}

	int size(void) const { return StaticDeque<T, maxSize>::size(); }
	bool empty(void) const { return StaticDeque<T, maxSize>::empty(); }
	T& front(void) const { return StaticDeque<T, maxSize>::front(); }
	void pop(void) { StaticDeque<T, maxSize>::pop_front(); }
	void push(const T& object) { StaticDeque<T, maxSize>::push_back(object); }
};

#endif /* SRC_COMMON_CONTAINERS_STATICQUEUE_H_ */

Back to the top