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 _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
937  : _Assoc_state(0)
938  { // construct with no associated asynchronous state object
939  _Get_only_once = false;
940  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _Associated_state< _Ty > *  _New_state,
bool  _Get_once 
)
inline
943  : _Assoc_state(_New_state)
944  { // construct with _New_state
945  _Get_only_once = _Get_once;
946  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_State_manager< _Ty >::_State_manager ( const _State_manager< _Ty > &  _Other,
bool  _Get_once = false 
)
inline
949  : _Assoc_state(0)
950  { // construct from _Other
951  _Copy_from(_Other);
952  _Get_only_once = _Get_once;
953  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1055
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_State_manager< _Ty >::_State_manager ( _State_manager< _Ty > &&  _Other,
bool  _Get_once = false 
)
inline
956  : _Assoc_state(0)
957  { // construct from rvalue _Other
958  _Move_from(_Other);
959  _Get_only_once = _Get_once;
960  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
void _Move_from(_State_manager &_Other)
Definition: future:1072
template<class _Ty>
_State_manager< _Ty >::~_State_manager ( )
inline
963  { // destroy
964  if (_Assoc_state != 0)
965  _Assoc_state->_Release();
966  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090

Member Function Documentation

template<class _Ty>
void _State_manager< _Ty >::_Copy_from ( const _State_manager< _Ty > &  _Other)
inline
1056  { // copy stored associated asynchronous state object from _Other
1057  if (this != &_Other)
1058  { // different, copy
1059  if (_Assoc_state)
1060  _Assoc_state->_Release();
1061  if (_Other._Assoc_state == 0)
1062  _Assoc_state = 0;
1063  else
1064  { // do the copy
1065  _Other._Assoc_state->_Retain();
1066  _Assoc_state = _Other._Assoc_state;
1067  _Get_only_once = _Other._Get_only_once;
1068  }
1069  }
1070  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_Ty& _State_manager< _Ty >::_Get_value ( ) const
inline
1014  { // return the stored result or throw stored exception
1015  if (!valid())
1016  _Throw_future_error(
1018  return (_Assoc_state->_Get_value(_Get_only_once));
1019  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
bool _State_manager< _Ty >::_Is_ready ( ) const
inline
1085  { // return status
1086  return (_Assoc_state && _Assoc_state->_Is_ready());
1087  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
void _State_manager< _Ty >::_Move_from ( _State_manager< _Ty > &  _Other)
inline
1073  { // move stored associated asynchronous state object from _Other
1074  if (this != &_Other)
1075  { // different, move
1076  if (_Assoc_state)
1077  _Assoc_state->_Release();
1078  _Assoc_state = _Other._Assoc_state;
1079  _Other._Assoc_state = 0;
1080  _Get_only_once = _Other._Get_only_once;
1081  }
1082  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_Associated_state<_Ty>* _State_manager< _Ty >::_Ptr ( ) const
inline
1051  { // return pointer to stored associated asynchronous state object
1052  return (_Assoc_state);
1053  }
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
void _State_manager< _Ty >::_Set_exception ( _XSTD exception_ptr  _Exc,
bool  _Defer 
)
inline
1038  { // store a result
1039  if (!valid())
1040  _Throw_future_error(
1042  _Assoc_state->_Set_exception(_Exc, _Defer);
1043  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( const _Ty &  _Val,
bool  _Defer 
)
inline
1022  { // store a result
1023  if (!valid())
1024  _Throw_future_error(
1026  _Assoc_state->_Set_value(_Val, _Defer);
1027  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty>
void _State_manager< _Ty >::_Set_value ( _Ty &&  _Val,
bool  _Defer 
)
inline
1030  { // store a result
1031  if (!valid())
1032  _Throw_future_error(
1034  _Assoc_state->_Set_value(_STD forward<_Ty>(_Val), _Defer);
1035  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
_FwdIt const _Ty _Val
Definition: algorithm:1938
template<class _Ty>
void _State_manager< _Ty >::_Swap ( _State_manager< _Ty > &  _Other)
inline
1046  { // exchange with _Other
1048  }
void swap(promise< _Ty > &_Left, promise< _Ty > &_Right) _NOEXCEPT
Definition: future:1697
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( const _State_manager< _Ty > &  _Other)
inline
969  { // assign from _Other
970  _Copy_from(_Other);
971  return (*this);
972  }
void _Copy_from(const _State_manager &_Other)
Definition: future:1055
template<class _Ty>
_State_manager& _State_manager< _Ty >::operator= ( _State_manager< _Ty > &&  _Other)
inline
975  { // assign from rvalue _Other
976  _Move_from(_Other);
977  return (*this);
978  }
void _Move_from(_State_manager &_Other)
Definition: future:1072
template<class _Ty>
bool _State_manager< _Ty >::valid ( ) const
inline
981  { // return status
982  return (_Assoc_state != 0
983  && !(_Get_only_once && _Assoc_state->_Already_retrieved()));
984  }
bool _Get_only_once
Definition: future:1091
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
void _State_manager< _Ty >::wait ( ) const
inline
987  { // wait for signal
988  if (!valid())
989  _Throw_future_error(make_error_code(future_errc::no_state));
990  _Assoc_state->_Wait();
991  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
template<class _Ty>
template<class _Rep , class _Per >
_Future_status _State_manager< _Ty >::wait_for ( const chrono::duration< _Rep, _Per > &  _Rel_time) const
inline
997  { // wait for duration
998  if (!valid())
999  _Throw_future_error(make_error_code(future_errc::no_state));
1000  return (_Assoc_state->_Wait_for(_Rel_time));
1001  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090
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
1007  { // wait until time point
1008  if (!valid())
1009  _Throw_future_error(make_error_code(future_errc::no_state));
1010  return (_Assoc_state->_Wait_until(_Abs_time));
1011  }
bool valid() const _NOEXCEPT
Definition: future:980
error_code make_error_code(_Future_errc _Errno) _NOEXCEPT
Definition: future:120
_Associated_state< _Ty > * _Assoc_state
Definition: future:1090

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: