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

#include <popback_op.h>

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

Public Member Functions

 PopOpHelper (Vector< T > *vec, PopOp< T > *op)
 
 PopOpHelper (Vector< T > *vec)
 
 ~PopOpHelper ()
 
void set_prev_spot (std::atomic< T > *prev_spot)
 
bool in_progress ()
 
bool result (T &val)
 
bool result ()
 
void fail ()
 
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 associate (PopOpSubHelper< T > *child)
 
bool on_watch (std::atomic< void * > *address, void *value)
 This method is optional to implement for each sub class. More...
 
void on_unwatch ()
 This method must be implemented if on_watch is implemented, and is optional otherwise. More...
 
bool on_is_watched ()
 This method is optional to implement for each sub class. More...
 
void set_control_word ()
 
- Public Member Functions inherited from tervel::util::Descriptor
 Descriptor ()
 
virtual ~Descriptor ()
 

Static Public Attributes

static constexpr PopOpSubHelper< T > * fail_const {reinterpret_cast<PopOpSubHelper<T> *>(0x1L)}
 

Private Attributes

Vector< T > * vec_
 
PopOp< T > * op_ {nullptr}
 
std::atomic< T > * prev_spot_ {nullptr}
 
std::atomic< PopOpSubHelper< T > * > child_ {nullptr}
 

Constructor & Destructor Documentation

template<typename T>
tervel::containers::wf::vector::PopOpHelper< T >::PopOpHelper ( Vector< T > *  vec,
PopOp< T > *  op 
)
inline
template<typename T>
tervel::containers::wf::vector::PopOpHelper< T >::PopOpHelper ( Vector< T > *  vec)
inlineexplicit
template<typename T>
tervel::containers::wf::vector::PopOpHelper< T >::~PopOpHelper ( )
inline

Member Function Documentation

template<typename T>
bool tervel::containers::wf::vector::PopOpHelper< T >::associate ( PopOpSubHelper< T > *  child)
inline
template<typename T>
void* tervel::containers::wf::vector::PopOpHelper< 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::PopOpHelper< T >::fail ( )
inline
template<typename T>
void* tervel::containers::wf::vector::PopOpHelper< 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::PopOpHelper< T >::in_progress ( )
inline
template<typename T>
bool tervel::containers::wf::vector::PopOpHelper< T >::on_is_watched ( )
inlinevirtual

This method is optional to implement for each sub class.

This function must be implemented if on_watch is implemented.

Returns
true if the item is watched by another thread

Reimplemented from tervel::util::Descriptor.

template<typename T>
void tervel::containers::wf::vector::PopOpHelper< T >::on_unwatch ( )
inlinevirtual

This method must be implemented if on_watch is implemented, and is optional otherwise.

It must unwatch any object watched by on_watch. It should not unwatch itself. It is called when this descriptor is unwatched.

Reimplemented from tervel::util::Descriptor.

template<typename T>
bool tervel::containers::wf::vector::PopOpHelper< 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>
bool tervel::containers::wf::vector::PopOpHelper< T >::result ( T &  val)
inline
template<typename T>
bool tervel::containers::wf::vector::PopOpHelper< T >::result ( )
inline
template<typename T>
void tervel::containers::wf::vector::PopOpHelper< T >::set_control_word ( )
inline
template<typename T>
void tervel::containers::wf::vector::PopOpHelper< T >::set_prev_spot ( std::atomic< T > *  prev_spot)
inline

Member Data Documentation

template<typename T>
std::atomic<PopOpSubHelper<T> *> tervel::containers::wf::vector::PopOpHelper< T >::child_ {nullptr}
private
template<typename T>
constexpr PopOpSubHelper<T>* tervel::containers::wf::vector::PopOpHelper< T >::fail_const {reinterpret_cast<PopOpSubHelper<T> *>(0x1L)}
static
template<typename T>
PopOp<T>* tervel::containers::wf::vector::PopOpHelper< T >::op_ {nullptr}
private
template<typename T>
std::atomic<T>* tervel::containers::wf::vector::PopOpHelper< T >::prev_spot_ {nullptr}
private
template<typename T>
Vector<T>* tervel::containers::wf::vector::PopOpHelper< T >::vec_
private

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