STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Attributes | List of all members
_State_manager< _Ty > Class Template Reference
Inheritance diagram for _State_manager< _Ty >:
future< _Ty > shared_future< _Ty >

Public Member Functions

 _State_manager ()
 
 _State_manager (_Associated_state< _Ty > *_New_state, bool _Get_once)
 
 _State_manager (const _State_manager &_Other, bool _Get_once=false)
 
 _State_manager (_State_manager &&_Other, bool _Get_once=false)
 
 ~_State_manager () _NOEXCEPT
 
_State_manageroperator= (const _State_manager &_Other)
 
_State_manageroperator= (_State_manager &&_Other)
 
bool valid () const _NOEXCEPT
 
void wait () const
 
template<class _Rep , class _Per >
_Future_status wait_for (const chrono::duration< _Rep, _Per > &_Rel_time) const
 
template<class _Clock , class _Dur >
_Future_status wait_until (const chrono::time_point< _Clock, _Dur > &_Abs_time) const
 
_Ty & _Get_value () const
 
void _Set_value (const _Ty &_Val, bool _Defer)
 
void _Set_value (_Ty &&_Val, bool _Defer)
 
void _Abandon ()
 
void _Set_exception (exception_ptr _Exc, bool _Defer)
 
void _Swap (_State_manager &_Other)
 
_Associated_state< _Ty > * _Ptr () const
 
void _Copy_from (const _State_manager &_Other)
 
void _Move_from (_State_manager &_Other)
 
bool _Is_ready () const
 
bool _Is_ready_at_thread_exit () const
 

Private Attributes

_Associated_state< _Ty > * _Assoc_state
 
bool _Get_only_once
 

Constructor & Destructor Documentation

template<class _Ty>
_State_manager< _Ty >::_State_manager ( )
inline
929  : _Assoc_state(0)
930  { // construct with no associated asynchronous state object
931  _Get_only_once = false;
932  }
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _Associated_state< _Ty > *  _New_state,
bool  _Get_once 
)
inline
935  : _Assoc_state(_New_state)
936  { // construct with _New_state
937  _Get_only_once = _Get_once;
938  }
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_State_manager< _Ty >::_State_manager ( const _State_manager< _Ty > &  _Other,
bool  _Get_once = false 
)
inline
941  : _Assoc_state(0)
942  { // construct from _Other
943  _Copy_from(_Other);
944  _Get_only_once = _Get_once;
945  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1053
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _State_manager< _Ty > &&  _Other,
bool  _Get_once = false 
)
inline
948  : _Assoc_state(0)
949  { // construct from rvalue _Other
950  _Move_from(_Other);
951  _Get_only_once = _Get_once;
952  }
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
void _Move_from(_State_manager &_Other)
Definition: future:1070
template<class _Ty>
_State_manager< _Ty >::~_State_manager ( )
inline
955  { // destroy
956  if (_Assoc_state != 0)
957  _Assoc_state->_Release();
958  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093

Member Function Documentation

template<class _Ty>
void _State_manager< _Ty >::_Abandon ( )
inline
1030  { // abandon shared state
1031  if (_Assoc_state)
1032  _Assoc_state->_Abandon();
1033  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
void _State_manager< _Ty >::_Copy_from ( const _State_manager< _Ty > &  _Other)
inline
1054  { // copy stored associated asynchronous state object from _Other
1055  if (this != _STD addressof(_Other))
1056  { // different, copy
1057  if (_Assoc_state)
1058  _Assoc_state->_Release();
1059  if (_Other._Assoc_state == 0)
1060  _Assoc_state = 0;
1061  else
1062  { // do the copy
1063  _Other._Assoc_state->_Retain();
1064  _Assoc_state = _Other._Assoc_state;
1065  _Get_only_once = _Other._Get_only_once;
1066  }
1067  }
1068  }
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_Ty& _State_manager< _Ty >::_Get_value ( ) const
inline
1006  { // return the stored result or throw stored exception
1007  if (!valid())
1010  return (_Assoc_state->_Get_value(_Get_only_once));
1011  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
bool _State_manager< _Ty >::_Is_ready ( ) const
inline
1083  { // return ready status
1084  return (_Assoc_state && _Assoc_state->_Is_ready());
1085  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
bool _State_manager< _Ty >::_Is_ready_at_thread_exit ( ) const
inline
1088  { // return ready at thread exit status
1089  return (_Assoc_state && _Assoc_state->_Is_ready_at_thread_exit());
1090  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
void _State_manager< _Ty >::_Move_from ( _State_manager< _Ty > &  _Other)
inline
1071  { // move stored associated asynchronous state object from _Other
1072  if (this != _STD addressof(_Other))
1073  { // different, move
1074  if (_Assoc_state)
1075  _Assoc_state->_Release();
1076  _Assoc_state = _Other._Assoc_state;
1077  _Other._Assoc_state = 0;
1078  _Get_only_once = _Other._Get_only_once;
1079  }
1080  }
_STD_BEGIN constexpr _Ty * addressof(_Ty &_Val) _NOEXCEPT
Definition: xstddef:628
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_Associated_state<_Ty>* _State_manager< _Ty >::_Ptr ( ) const
inline
1049  { // return pointer to stored associated asynchronous state object
1050  return (_Assoc_state);
1051  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
void _State_manager< _Ty >::_Set_exception ( exception_ptr  _Exc,
bool  _Defer 
)
inline
1036  { // store a result
1037  if (!valid())
1040  _Assoc_state->_Set_exception(_Exc, _Defer);
1041  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( const _Ty &  _Val,
bool  _Defer 
)
inline
1014  { // store a result
1015  if (!valid())
1018  _Assoc_state->_Set_value(_Val, _Defer);
1019  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( _Ty &&  _Val,
bool  _Defer 
)
inline
1022  { // store a result
1023  if (!valid())
1026  _Assoc_state->_Set_value(_STD forward<_Ty>(_Val), _Defer);
1027  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty>
void _State_manager< _Ty >::_Swap ( _State_manager< _Ty > &  _Other)
inline
1044  { // exchange with _Other
1046  }
void swap(promise< _Ty > &_Left, promise< _Ty > &_Right) _NOEXCEPT
Definition: future:1717
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( const _State_manager< _Ty > &  _Other)
inline
961  { // assign from _Other
962  _Copy_from(_Other);
963  return (*this);
964  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1053
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( _State_manager< _Ty > &&  _Other)
inline
967  { // assign from rvalue _Other
968  _Move_from(_Other);
969  return (*this);
970  }
void _Move_from(_State_manager &_Other)
Definition: future:1070
template<class _Ty>
bool _State_manager< _Ty >::valid ( ) const
inline
973  { // return status
974  return (_Assoc_state != 0
975  && !(_Get_only_once && _Assoc_state->_Already_retrieved()));
976  }
bool _Get_only_once
Definition: future:1094
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
void _State_manager< _Ty >::wait ( ) const
inline
979  { // wait for signal
980  if (!valid())
982  _Assoc_state->_Wait();
983  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
template<class _Rep , class _Per >
_Future_status _State_manager< _Ty >::wait_for ( const chrono::duration< _Rep, _Per > &  _Rel_time) const
inline
989  { // wait for duration
990  if (!valid())
992  return (_Assoc_state->_Wait_for(_Rel_time));
993  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093
template<class _Ty>
template<class _Clock , class _Dur >
_Future_status _State_manager< _Ty >::wait_until ( const chrono::time_point< _Clock, _Dur > &  _Abs_time) const
inline
999  { // wait until time point
1000  if (!valid())
1002  return (_Assoc_state->_Wait_until(_Abs_time));
1003  }
bool valid() const _NOEXCEPT
Definition: future:972
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:119
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1093

Member Data Documentation

template<class _Ty>
_Associated_state<_Ty>* _State_manager< _Ty >::_Assoc_state
private
template<class _Ty>
bool _State_manager< _Ty >::_Get_only_once
private

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