NEST main@caf0ae8
 
Loading...
Searching...
No Matches
ring_buffer_impl.h
Go to the documentation of this file.
1/*
2 * ring_buffer_impl.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef RING_BUFFER_IMPL_H
24#define RING_BUFFER_IMPL_H
25
26#include "ring_buffer.h"
27
28namespace nest
29{
30
31template < unsigned int num_channels >
33 : buffer_( kernel().connection_manager.get_min_delay() + kernel().connection_manager.get_max_delay(),
34 std::array< double, num_channels >() )
35{
36}
37
38template < unsigned int num_channels >
39void
41{
43 if ( buffer_.size() != size )
44 {
45 buffer_.resize( size, std::array< double, num_channels >() );
46 }
47}
48
49template < unsigned int num_channels >
50void
52{
53 resize(); // does nothing if size is fine
54 // set all elements to 0.0
55 for ( size_t slot = 0; slot < buffer_.size(); ++slot )
56 {
57 reset_values_all_channels( slot );
58 }
59}
60
61} // namespace nest
62
63#endif
long get_min_delay() const
Return minimal connection delay, which is precomputed by update_delay_extrema_().
Definition connection_manager.h:728
long get_max_delay() const
Return maximal connection delay, which is precomputed by update_delay_extrema_().
Definition connection_manager.h:734
MultiChannelInputBuffer()
Definition ring_buffer_impl.h:32
void resize()
Definition ring_buffer_impl.h:40
void clear()
Definition ring_buffer_impl.h:51
ConnectionManager connection_manager
Definition kernel_manager.h:239
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
KernelManager & kernel()
Definition kernel_manager.h:311