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 (_XSTD 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
 

Private Attributes

_Associated_state< _Ty > * _Assoc_state
 
bool _Get_only_once
 

Constructor & Destructor Documentation

template<class _Ty>
_State_manager< _Ty >::_State_manager ( )
inline
943  : _Assoc_state(0)
944  { // construct with no associated asynchronous state object
945  _Get_only_once = false;
946  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _Associated_state< _Ty > *  _New_state,
bool  _Get_once 
)
inline
949  : _Assoc_state(_New_state)
950  { // construct with _New_state
951  _Get_only_once = _Get_once;
952  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_State_manager< _Ty >::_State_manager ( const _State_manager< _Ty > &  _Other,
bool  _Get_once = false 
)
inline
955  : _Assoc_state(0)
956  { // construct from _Other
957  _Copy_from(_Other);
958  _Get_only_once = _Get_once;
959  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1067
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _State_manager< _Ty > &&  _Other,
bool  _Get_once = false 
)
inline
962  : _Assoc_state(0)
963  { // construct from rvalue _Other
964  _Move_from(_Other);
965  _Get_only_once = _Get_once;
966  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
void _Move_from(_State_manager &_Other)
Definition: future:1084
template<class _Ty>
_State_manager< _Ty >::~_State_manager ( )
inline
969  { // destroy
970  if (_Assoc_state != 0)
971  _Assoc_state->_Release();
972  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102

Member Function Documentation

template<class _Ty>
void _State_manager< _Ty >::_Abandon ( )
inline
1044  { // abandon shared state
1045  if (_Assoc_state)
1046  _Assoc_state->_Abandon();
1047  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Copy_from ( const _State_manager< _Ty > &  _Other)
inline
1068  { // copy stored associated asynchronous state object from _Other
1069  if (this != &_Other)
1070  { // different, copy
1071  if (_Assoc_state)
1072  _Assoc_state->_Release();
1073  if (_Other._Assoc_state == 0)
1074  _Assoc_state = 0;
1075  else
1076  { // do the copy
1077  _Other._Assoc_state->_Retain();
1078  _Assoc_state = _Other._Assoc_state;
1079  _Get_only_once = _Other._Get_only_once;
1080  }
1081  }
1082  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_Ty& _State_manager< _Ty >::_Get_value ( ) const
inline
1020  { // return the stored result or throw stored exception
1021  if (!valid())
1024  return (_Assoc_state->_Get_value(_Get_only_once));
1025  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
bool _State_manager< _Ty >::_Is_ready ( ) const
inline
1097  { // return status
1098  return (_Assoc_state && _Assoc_state->_Is_ready());
1099  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Move_from ( _State_manager< _Ty > &  _Other)
inline
1085  { // move stored associated asynchronous state object from _Other
1086  if (this != &_Other)
1087  { // different, move
1088  if (_Assoc_state)
1089  _Assoc_state->_Release();
1090  _Assoc_state = _Other._Assoc_state;
1091  _Other._Assoc_state = 0;
1092  _Get_only_once = _Other._Get_only_once;
1093  }
1094  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_Associated_state<_Ty>* _State_manager< _Ty >::_Ptr ( ) const
inline
1063  { // return pointer to stored associated asynchronous state object
1064  return (_Assoc_state);
1065  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Set_exception ( _XSTD exception_ptr  _Exc,
bool  _Defer 
)
inline
1050  { // store a result
1051  if (!valid())
1054  _Assoc_state->_Set_exception(_Exc, _Defer);
1055  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( const _Ty &  _Val,
bool  _Defer 
)
inline
1028  { // store a result
1029  if (!valid())
1032  _Assoc_state->_Set_value(_Val, _Defer);
1033  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_In_ int _Val
Definition: vcruntime_string.h:62
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( _Ty &&  _Val,
bool  _Defer 
)
inline
1036  { // store a result
1037  if (!valid())
1040  _Assoc_state->_Set_value(_STD forward<_Ty>(_Val), _Defer);
1041  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_In_ int _Val
Definition: vcruntime_string.h:62
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::_Swap ( _State_manager< _Ty > &  _Other)
inline
1058  { // exchange with _Other
1060  }
void swap(promise< _Ty > &_Left, promise< _Ty > &_Right) _NOEXCEPT
Definition: future:1721
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( const _State_manager< _Ty > &  _Other)
inline
975  { // assign from _Other
976  _Copy_from(_Other);
977  return (*this);
978  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1067
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( _State_manager< _Ty > &&  _Other)
inline
981  { // assign from rvalue _Other
982  _Move_from(_Other);
983  return (*this);
984  }
void _Move_from(_State_manager &_Other)
Definition: future:1084
template<class _Ty>
bool _State_manager< _Ty >::valid ( ) const
inline
987  { // return status
988  return (_Assoc_state != 0
989  && !(_Get_only_once && _Assoc_state->_Already_retrieved()));
990  }
bool _Get_only_once
Definition: future:1103
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
void _State_manager< _Ty >::wait ( ) const
inline
993  { // wait for signal
994  if (!valid())
996  _Assoc_state->_Wait();
997  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
template<class _Ty>
template<class _Rep , class _Per >
_Future_status _State_manager< _Ty >::wait_for ( const chrono::duration< _Rep, _Per > &  _Rel_time) const
inline
1003  { // wait for duration
1004  if (!valid())
1006  return (_Assoc_state->_Wait_for(_Rel_time));
1007  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102
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
1013  { // wait until time point
1014  if (!valid())
1016  return (_Assoc_state->_Wait_until(_Abs_time));
1017  }
bool valid() const _NOEXCEPT
Definition: future:986
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Throw_future_error(const error_code &_Code)
_Associated_state< _Ty > * _Assoc_state
Definition: future:1102

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: