<commit_before>/**
 * \file
 * \brief StaticFifoQueue class header
 *
 * \author Copyright (C) 2014 <NAME> http://www.distortec.com http://www.freddiechopin.info
 *
 * \par License
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * \date 2014-12-06
 */

#ifndef INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_
#define INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_

#include "FifoQueue.hpp"

namespace distortos
{

/**
 * \brief StaticFifoQueue class is a variant of FifoQueue that has automatic storage for queue's contents.
 *
 * \param T is the type of data in queue
 * \param QueueSize is the maximum number of elements in queue
 */

template<typename T, size_t QueueSize>
class StaticFifoQueue : public FifoQueue<T>
{
public:

	/**
	 * \brief StaticFifoQueue's constructor
	 */

	explicit StaticFifoQueue() :
			FifoQueue<T>{storage_, sizeof(storage_) / sizeof(*storage_)}
	{

	}

private:

	/// storage for queue's contents
	typename FifoQueue<T>::Storage storage_[QueueSize];
};

}	// namespace distortos

#endif	// INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_
<commit_msg>StaticFifoQueue: use std::array for storage and new FifoQueue helper constructor<commit_after>/**
 * \file
 * \brief StaticFifoQueue class header
 *
 * \author Copyright (C) 2014 <NAME> http://www.distortec.com http://www.freddiechopin.info
 *
 * \par License
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * \date 2015-01-02
 */

#ifndef INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_
#define INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_

#include "FifoQueue.hpp"

namespace distortos
{

/**
 * \brief StaticFifoQueue class is a variant of FifoQueue that has automatic storage for queue's contents.
 *
 * \param T is the type of data in queue
 * \param QueueSize is the maximum number of elements in queue
 */

template<typename T, size_t QueueSize>
class StaticFifoQueue : public FifoQueue<T>
{
public:

	/**
	 * \brief StaticFifoQueue's constructor
	 */

	explicit StaticFifoQueue() :
			FifoQueue<T>{storage_}
	{

	}

private:

	/// storage for queue's contents
	std::array<typename FifoQueue<T>::Storage, QueueSize> storage_;
};

}	// namespace distortos

#endif	// INCLUDE_DISTORTOS_STATICFIFOQUEUE_HPP_

{'fraction_non_alphanumeric': 0.10190824198132359, 'fraction_numerical': 0.012992285830288266, 'mean_word_length': 4.038854805725971, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5379505', 'n_tokens_mistral': 898, 'n_tokens_neox': 792, 'n_words': 252}