Tervel  1.0.0
A collection of wait-free containers and algorithms.
Public Member Functions | Public Attributes | Private Types | List of all members
ShiftHelper< ShiftOp, T > Class Template Reference

#include <shift_helper.h>

Inheritance diagram for ShiftHelper< ShiftOp, T >:
tervel::util::Descriptor

Public Member Functions

 ShiftHelper (ShiftOp *op_rec, helper_t *prev, T replaced_value)
 
bool complete_phase1 (WFVector *vec, int pos)
 
bool complete (WFVector *vec, int pos)
 
bool on_watch (std::atomic< void * > *address, void *value)
 This method is optional to implement for each sub class. More...
 
void * get_logical_value ()
 This method is implemented by each sub class. More...
 
template<>
bool complete (WFVector *vec, int pos)
 
template<>
bool complete (WFVector *vec, int pos)
 
- Public Member Functions inherited from tervel::util::Descriptor
 Descriptor ()
 
virtual ~Descriptor ()
 
virtual void * complete (void *current, std::atomic< void * > *address)=0
 This method is implemented by each sub class and must guarantee that upon return that the descriptor no longer exists at the address it was placed. More...
 
virtual void on_unwatch ()
 This method must be implemented if on_watch is implemented, and is optional otherwise. More...
 
virtual bool on_is_watched ()
 This method is optional to implement for each sub class. More...
 

Public Attributes

const helper_tprev_
 
const ShiftOp * op_rec_
 
const T replaced_value_
 
std::atomic< helper_t * > next_ {nullptr}
 

Private Types

typedef ShiftHelper< ShiftOp, T > helper_t
 

Member Typedef Documentation

template<class ShiftOp, class T>
typedef ShiftHelper<ShiftOp, T> ShiftHelper< ShiftOp, T >::helper_t
private

Constructor & Destructor Documentation

template<class ShiftOp, class T>
ShiftHelper< ShiftOp, T >::ShiftHelper ( ShiftOp *  op_rec,
helper_t prev,
replaced_value 
)
inline

Member Function Documentation

template<class ShiftOp, class T>
bool ShiftHelper< ShiftOp, T >::complete ( WFVector *  vec,
int  pos 
)
template<>
bool ShiftHelper< InsertAt >::complete ( WFVector *  vec,
int  pos 
)
template<>
bool ShiftHelper< EraseAt >::complete ( WFVector *  vec,
int  pos 
)
template<class ParentOp >
bool ShiftHelper< ParentOp >::complete_phase1 ( WFVector *  vec,
int  pos 
)
template<class ShiftOp, class T>
void* ShiftHelper< ShiftOp, T >::get_logical_value ( )
inlinevirtual

This method is implemented by each sub class.

It returns the logical value of the past address. If the associated operation is still in progress then it will generally return the value that was replaced by this descriptor. Otherwise it will generally return the result of the operation for the specified address.

It can only be called from the static function which protects the object from being reused during the function.

Implements tervel::util::Descriptor.

template<class ShiftOp, class T>
bool ShiftHelper< ShiftOp, T >::on_watch ( std::atomic< void * > *  ,
void *   
)
inlinevirtual

This method is optional to implement for each sub class.

In the event there is a complex dependency between descriptor objects, where watching one implies performing other actions, such as watching a parent object, a developer will implement this function to encapsulate that logic

This function is called by the static watch function It should not watch itself.

Parameters
addressThe location to check.
expectedThe expected value for that location
Returns
true if successful, false otherwise

Reimplemented from tervel::util::Descriptor.

Member Data Documentation

template<class ShiftOp, class T>
std::atomic<helper_t *> ShiftHelper< ShiftOp, T >::next_ {nullptr}
template<class ShiftOp, class T>
const ShiftOp* ShiftHelper< ShiftOp, T >::op_rec_
template<class ShiftOp, class T>
const helper_t* ShiftHelper< ShiftOp, T >::prev_
template<class ShiftOp, class T>
const T ShiftHelper< ShiftOp, T >::replaced_value_

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