NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nest::RingBuffer Class Reference

Buffer Layout. More...

#include <ring_buffer.h>

Public Member Functions

 RingBuffer ()
 
void add_value (const long_t offs, const double_t)
 Add a value to the ring buffer. More...
 
void set_value (const long_t offs, const double_t)
 Set a ring buffer entry to a given value. More...
 
double get_value (const long_t offs)
 Read one value from ring buffer. More...
 
void clear ()
 Initialize the buffer with noughts. More...
 
void resize ()
 Resize the buffer according to max_thread and max_delay. More...
 
size_t size () const
 Returns buffer size, for memory measurement. More...
 

Private Member Functions

size_t get_index_ (const delay d) const
 Obtain buffer index. More...
 

Private Attributes

std::valarray< double_tbuffer_
 Buffered data. More...
 

Detailed Description

Buffer Layout.

MODIFICATION 2005-06-19: The explanation below no longer holds if we allow direct delivery of events from devices such as the Poisson generator. The reasoning below applies only to events in the central queue, which are held in that queue until the beginning of the next slice, when system time has been advance from T to T + min_delay. Direct delivery events, in contrast are delivered when system time is still T. Their earliest delivery time is

min T_d = T + min_del

and the latest

max T_d = T + (min_del-1) + max_del = T + min_del + max_del - 1

Since we still need to keep the entries 0..min_del-1 for readout during the time slice beginning at T, we need a buffer with min_del+max_del elements.

SUPERSEEDED: Let S be the time at the beginning of the present time slice (from). All spikes arriving during this time slice, must have been emitted during the previous time slice, which started at S - min_del. Then, the earliest spike delivery time (compare Time Memo) is

min T_d = S-min_del + min_del = S

and the latest

max T_d = S-1 + max_del = S + (max_del - 1)

Thus,

0 <= S - T_d <= max_del - 1

so that the ring buffer needs max_del elements.

Each field represents an entry in the valarray.

Constructor & Destructor Documentation

nest::RingBuffer::RingBuffer ( )

Member Function Documentation

void nest::RingBuffer::add_value ( const long_t  offs,
const double_t  v 
)
inline

Add a value to the ring buffer.

Parameters
offsArrival time relative to beginning of slice.
double_tValue to add.

References buffer_, and get_index_().

Referenced by nest::iaf_psc_exp_multisynapse::handle(), nest::iaf_psc_alpha_multisynapse::handle(), nest::parrot_neuron::handle(), nest::aeif_cond_alpha_multisynapse::handle(), nest::iaf_psc_alpha::handle(), and nest::iaf_psc_delta_canon::handle().

void nest::RingBuffer::clear ( )
size_t nest::RingBuffer::get_index_ ( const delay  d) const
inlineprivate

Obtain buffer index.

Parameters
delaydelivery delay for event
Returns
index to buffer element into which event should be recorded.

References assert(), buffer_, and nest::Scheduler::get_modulo().

Referenced by add_value(), get_value(), and set_value().

double nest::RingBuffer::get_value ( const long_t  offs)
inline
void nest::RingBuffer::resize ( )

Resize the buffer according to max_thread and max_delay.

New elements are filled with noughts.

Note
resize() has no effect if the buffer has the correct size.

References nest::Scheduler::get_max_delay(), and nest::Scheduler::get_min_delay().

void nest::RingBuffer::set_value ( const long_t  offs,
const double_t  v 
)
inline

Set a ring buffer entry to a given value.

Parameters
offsArrival time relative to beginning of slice.
double_tValue to set.

References buffer_, and get_index_().

size_t nest::RingBuffer::size ( void  ) const
inline

Returns buffer size, for memory measurement.

References buffer_.

Member Data Documentation

std::valarray<double_t> nest::RingBuffer::buffer_
private

Buffered data.

Referenced by add_value(), get_index_(), get_value(), set_value(), and size().


The documentation for this class was generated from the following files: