//**************************************************************************************************
//
// INTERLOCKED OPERATIONS FOR UNSIGNED 32-BIT INTEGER:
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RuntimeForStatic base library | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#pragma once
#include "include_restrictions.h"
namespace RuntimeForStatic {

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// "$Interlocked" STATIC CLASS:
//
//==================================================================================================
class $Interlocked
{
$STATIC_CLASS( $Interlocked )
public:
   static int Read($A, int volatile* pSource );
   static int Write($A, int volatile* pTarget, int value ) $ret_target;
   static int Exchange($A, int volatile* pLocation, int value ) $ret_previous;
   static int CompareExchange($A, int volatile* pLocation, int exchange,
                                                           int comparand ) $ret_initial;
public:
   static DWORD Read($A, DWORD volatile* pSource );
   static DWORD Write($A, DWORD volatile* pTarget, DWORD value ) $ret_target;
   static DWORD Exchange($A, DWORD volatile* pLocation, DWORD value ) $ret_previous;
   static DWORD CompareExchange($A, DWORD volatile* pLocation,
                                    DWORD exchange, DWORD comparand ) $ret_initial;
public:
   static PVOID ReadPointer($A, PVOID volatile* pPointer );
   static PVOID WritePointer($A, PVOID volatile* pTargetPtr, PVOID pointerValue ) $ret_target;
   static PVOID ExchangePointer($A, PVOID volatile* pPointer,
                                    PVOID pointerValue ) $ret_previous;
   static PVOID CompareExchangePointer($A, PVOID volatile* pPointer,
                                           PVOID exchangePtr, PVOID comparandPtr ) $ret_initial;
   static PVOID ResetPointer($A, PVOID volatile* pPointer ) $ret_previous;
public:
   static bool GetAsBool($A, DWORD volatile* pSource );
   static bool SetAsBool($A, DWORD volatile* pTarget ) $imaginary_param("value",true)
                                                       $ret_target;
   static bool SetAsBool($A, DWORD volatile* pTarget, bool value ) $ret_target;
   static bool ResetAsBool($A, DWORD volatile* pTarget ) $ret_target;
   static bool ExchangeAsBool($A, DWORD volatile* pLocation, bool value ) $ret_previous;
   static bool CompareExchangeAsBool($A, DWORD volatile* pLocation,
                                         bool exchange, bool comparand ) $ret_initial;
}; // $Interlocked
//==================================================================================================

} // RuntimeForStatic
