/** * Construct a DataObjectLockFree by name. * * @param _name The name of this DataObject. * @param initial_value The initial value of this DataObject. */ DataObjectLockFree( const T& initial_value = T(), unsigned int max_threads = 2 ) : MAX_THREADS(max_threads), BUF_LEN( max_threads + 2), read_ptr(0), write_ptr(0) { data = new DataBuf[BUF_LEN]; read_ptr = &data[0]; write_ptr = &data[1]; data_sample(initial_value); }
/** * Create a buffer of size \a size. */ BufferUnSync( size_type size, const T& initial_value = T(), bool circular = false ) : cap(size), buf(), mcircular(circular), droppedSamples(0) { data_sample(initial_value); }