// RuntimeForStatic base library | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#pragma once
#include "include_restrictions.h"
namespace RuntimeForStatic {
//==================================================================================================

template<typename T>static T* $tls::GetPointer($A,DWORD volatile* pIndex)
{
   return (T*)$TLS::GetPointer($ci, pIndex );
}
template<typename T>static T* StrictGetPointer($A, DWORD volatile* pIndex ) $not_null
{
   return (T*)$TLS::StrictGetPointer($ci, pIndex );
}
template<typename T>static T* $tls::SetPointer($A, DWORD volatile* pIndex,
                                                   T* pointer $optional ) $ret_target
{
   return (T*)$TLS::SetPointer($ci, pIndex, (PVOID)pointer );
}
template<typename T>static T* $tls::ResetPointer($A, DWORD volatile* pIndex ) $ret_target
{
   return (T*)$TLS::ResetPointer($ci, pIndex );
}

template<typename T>static const T* $tls::GetPointerC($A,DWORD volatile* pIndex)
{
   return (const T*)$TLS::GetPointer($ci, pIndex );
}
template<typename T>static const T* StrictGetPointerC($A, DWORD volatile* pIndex ) $not_null
{
   return (const T*)$TLS::StrictGetPointer($ci, pIndex );
}
template<typename T>static const T* $tls::SetPointerC($A, DWORD volatile* pIndex,
                                                          const T* pointer $optional ) $ret_target
{
   return (const T*)$TLS::SetPointer($ci, pIndex, (PVOID)pointer );
}
template<typename T>static const T* $tls::ResetPointerC($A, DWORD volatile* pIndex ) $ret_target
{
   return (const T*)$TLS::ResetPointer($ci, pIndex );
}

//--------------------------------------------------------------------------------------------------

template<typename T>static T $tls::GetValue($A,DWORD volatile* pIndex)
{
   return (T)(SIZE_T)$TLS::GetPointer($ci, pIndex );
}
template<typename T>static T $tls::SetValue($A,DWORD volatile* pIndex,T value) $ret_target
{
   return (T)(SIZE_T)$TLS::SetPointer($ci, pIndex, (PVOID)(SIZE_T)value );
}
template<typename T>static T $tls::ResetValue($A,DWORD volatile* pIndex) $ret_target
{
   return (T)(SIZE_T)$TLS::ResetPointer($ci, pIndex );
}

//--------------------------------------------------------------------------------------------------

template<typename T>static T* $tls::GetPointerIfInitialized($A,DWORD volatile* pIndex) $or_null
{
   return (T*)$TLS::GetPointerIfInitialized($ci, pIndex );
}
template<typename T>static const T* $tls::GetPointerIfInitializedC($A, DWORD volatile* pIndex )
                                                                       $or_null
{
   return (const T*)$TLS::GetPointerIfInitialized($ci, pIndex );
}
template<typename T>static T $tls::GetValueIfInitialized($A,DWORD volatile* pIndex) $or_zero
{
   return (T)(SIZE_T)$TLS::GetPointerIfInitialized($ci, pIndex );
}

//==================================================================================================
} // RuntimeForStatic
