RaftLib  0.3a
C++ Stream Processing Template Library
Public Member Functions | Static Public Member Functions | List of all members
Pointer Class Reference

#include <pointer.hpp>

Public Member Functions

 Pointer (const size_t cap)
 
 Pointer (const std::size_t cap, const std::int8_t wrap_set)
 
 Pointer (Pointer *other, const size_t new_cap)
 

Static Public Member Functions

static size_t val (Pointer *ptr)
 
static void inc (Pointer *const ptr)
 
static void incBy (const size_t in, Pointer *const ptr)
 
static size_t wrapIndicator (Pointer *ptr)
 

Detailed Description

pointer.hpp -

Author
: Jonathan Beard
Version
: Thu May 15 09:58:51 2014

Copyright 2014 Jonathan Beard

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Constructor & Destructor Documentation

Pointer::Pointer ( const size_t  cap)

Pointer - used to synchronize read and write pointers for the ring buffer. This class encapsulates wrapping.

Pointer::Pointer ( Pointer other,
const size_t  new_cap 
)

Pointer - used to snchronize read and write poitners for the ring buffer, this constructer is a copy constructor that copies an old Pointer object and sets a new max_capacity

Parameters
other,constPointer&, the other pointer to be cpied
new_cap,thenew max cap

Here is the call graph for this function:

Member Function Documentation

void Pointer::inc ( Pointer *const  ptr)
static

inc - increments the pointer, takes care of wrapping the pointers as well so you don't run off the page

Returns
size_t, current value of pointer after increment
void Pointer::incBy ( const size_t  in,
Pointer *const  ptr 
)
static

incBy - increments the current pointer poisition by 'in' increments. To be used for range insertion and removal

Parameters
in- const size_t
Returns
size_t, current increment after adding 'in'
size_t Pointer::val ( Pointer ptr)
static

val - returns the current value of val. Internally the function checks to ensure that any writes to the pointer have fully completed so that the value returned is ensured to be the correct one. This is important as it means the producer will only see a "conservative" estimate of how many items can be written and the consumer will only see a "conservative" estimate of how many items can be read.

Returns
size_t, current 'true' value of the pointer

Here is the caller graph for this function:

size_t Pointer::wrapIndicator ( Pointer ptr)
static

wrapIndiciator - returns the current wrap position, the read should never be ahead of the write, and at best they should be equal. This is used when determining to return max_cap or zero for the current queue size.

Returns
size_t

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