//**************************************************************************************************
//
// THREAD LOCAL STORAGE HELPERS (TEMPLATES):
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RuntimeForStatic base library | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#pragma once
#include "include_restrictions.h"
namespace RuntimeForStatic {
//==================================================================================================
class $tls { $STATIC_CLASS_PUBLIC( $tls )
//--------------------------------------------------------------------------------------------------

template<typename T>static T* GetPointer($A, DWORD volatile* pIndex );
template<typename T>static T* StrictGetPointer($A, DWORD volatile* pIndex ) $not_null;
template<typename T>static T* SetPointer($A, DWORD volatile* pIndex,
                                             T* pointer $optional ) $ret_target;
template<typename T>static T* ResetPointer($A,DWORD volatile* pIndex) $ret_target;

template<typename T>static const T* GetPointerC($A, DWORD volatile* pIndex );
template<typename T>static const T* StrictGetPointerC($A, DWORD volatile* pIndex ) $not_null;
template<typename T>static const T* SetPointerC($A, DWORD volatile* pIndex,
                                                    const T* pointer $optional ) $ret_target;
template<typename T>static const T* ResetPointerC($A, DWORD volatile* pIndex ) $ret_target;

template<typename T>static T GetValue($A,DWORD volatile* pIndex);
template<typename T>static T SetValue($A,DWORD volatile* pIndex,T value) $ret_target;
template<typename T>static T ResetValue($A,DWORD volatile* pIndex) $ret_target;

template<typename T>static T* GetPointerIfInitialized($A,DWORD volatile* pIndex) $or_null;
template<typename T>static const T* GetPointerIfInitializedC($A, DWORD volatile* pIndex ) $or_null;
template<typename T>static T GetValueIfInitialized($A,DWORD volatile* pIndex) $or_zero;

//--------------------------------------------------------------------------------------------------
}; // $tls
//==================================================================================================
} // RuntimeForStatic
