Tervel  1.0.0
A collection of wait-free containers and algorithms.
Public Member Functions | Private Attributes | List of all members
tervel::containers::wf::vector::PopOpSubHelper< T > Class Template Reference

#include <popback_op.h>

Inheritance diagram for tervel::containers::wf::vector::PopOpSubHelper< T >:
tervel::util::Descriptor

Public Member Functions

 PopOpSubHelper (PopOpHelper< T > *parent, T val)
 
void val (T &val)
 
void * get_logical_value ()
 This method is implemented by each sub class. More...
 
void * complete (void *value, std::atomic< void * > *address)
 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...
 
bool on_watch (std::atomic< void * > *address, void *value)
 This method is optional to implement for each sub class. More...
 
- Public Member Functions inherited from tervel::util::Descriptor
 Descriptor ()
 
virtual ~Descriptor ()
 
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...
 

Private Attributes

val_
 
PopOpHelper< T > * parent_
 

Constructor & Destructor Documentation

template<typename T>
tervel::containers::wf::vector::PopOpSubHelper< T >::PopOpSubHelper ( PopOpHelper< T > *  parent,
val 
)
inlineexplicit

Member Function Documentation

template<typename T>
void* tervel::containers::wf::vector::PopOpSubHelper< T >::complete ( void *  current,
std::atomic< void * > *  address 
)
inlinevirtual

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.

Parameters
currentthe reference to this object as it is at the address,
addressthe location this object was read from

Implements tervel::util::Descriptor.

template<typename T>
void* tervel::containers::wf::vector::PopOpSubHelper< 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<typename T>
bool tervel::containers::wf::vector::PopOpSubHelper< 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.

template<typename T>
void tervel::containers::wf::vector::PopOpSubHelper< T >::val ( T &  val)
inline

Member Data Documentation

template<typename T>
PopOpHelper<T>* tervel::containers::wf::vector::PopOpSubHelper< T >::parent_
private
template<typename T>
T tervel::containers::wf::vector::PopOpSubHelper< T >::val_
private

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