00001 // 00002 // null_tss_ptr.hpp 00003 // ~~~~~~~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 // 00010 00011 #ifndef ASIO_DETAIL_NULL_TSS_PTR_HPP 00012 #define ASIO_DETAIL_NULL_TSS_PTR_HPP 00013 00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00015 # pragma once 00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 00017 00018 #include "asio/detail/push_options.hpp" 00019 00020 #include "asio/detail/push_options.hpp" 00021 #include <boost/config.hpp> 00022 #include "asio/detail/pop_options.hpp" 00023 00024 #if !defined(BOOST_HAS_THREADS) 00025 00026 #include "asio/detail/noncopyable.hpp" 00027 00028 namespace asio { 00029 namespace detail { 00030 00031 template <typename T> 00032 class null_tss_ptr 00033 : private noncopyable 00034 { 00035 public: 00036 // Constructor. 00037 null_tss_ptr() 00038 : value_(0) 00039 { 00040 } 00041 00042 // Destructor. 00043 ~null_tss_ptr() 00044 { 00045 } 00046 00047 // Get the value. 00048 operator T*() const 00049 { 00050 return value_; 00051 } 00052 00053 // Set the value. 00054 void operator=(T* value) 00055 { 00056 value_ = value; 00057 } 00058 00059 private: 00060 T* value_; 00061 }; 00062 00063 } // namespace detail 00064 } // namespace asio 00065 00066 #endif // !defined(BOOST_HAS_THREADS) 00067 00068 #include "asio/detail/pop_options.hpp" 00069 00070 #endif // ASIO_DETAIL_NULL_TSS_PTR_HPP