A token that can be used to cancel an operation.  
 More...
#include <cancellationtoken.h>
 | 
|   | CancellationToken (const std::function< void()> &cancelFunction={}) noexcept | 
|   | Constructs a CancellationToken.  
  | 
| bool  | isCancelled () const noexcept | 
|   | Gets whether or not the token is cancelled.  
  | 
| const std::function< void()> &  | getCancelFunction () const noexcept | 
|   | Gets the cancel function to be called when the token is cancelled.  
  | 
| void  | setCancelFunction (const std::function< void()> &cancelFunction) noexcept | 
|   | Sets the cancel function to be called when the token is cancelled.  
  | 
| void  | cancel () noexcept | 
|   | Cancels the token.  
  | 
| void  | reset () noexcept | 
|   | Resets the token to its initial state.  
  | 
|   | operator bool () const noexcept | 
|   | Converts the token to a boolean.  
  | 
A token that can be used to cancel an operation. 
 
◆ CancellationToken()
  
  
      
        
          | Nickvision::Helpers::CancellationToken::CancellationToken  | 
          ( | 
          const std::function< void()> & |           cancelFunction = {} | ) | 
           | 
         
       
   | 
  
noexcept   | 
  
 
Constructs a CancellationToken. 
- Parameters
 - 
  
    | cancelFunction | A callback function to call when the token is cancelled  | 
  
   
 
 
◆ cancel()
  
  
      
        
          | void Nickvision::Helpers::CancellationToken::cancel  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
noexcept   | 
  
 
 
◆ getCancelFunction()
  
  
      
        
          | const std::function< void()> & Nickvision::Helpers::CancellationToken::getCancelFunction  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
noexcept   | 
  
 
Gets the cancel function to be called when the token is cancelled. 
- Returns
 - The cancel function 
 
 
 
◆ isCancelled()
  
  
      
        
          | bool Nickvision::Helpers::CancellationToken::isCancelled  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
noexcept   | 
  
 
Gets whether or not the token is cancelled. 
- Returns
 - True if token is cancelled, else false 
 
 
 
◆ operator bool()
  
  
      
        
          | Nickvision::Helpers::CancellationToken::operator bool  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
noexcept   | 
  
 
Converts the token to a boolean. 
- Returns
 - True if token is cancelled, else false 
 
 
 
◆ reset()
  
  
      
        
          | void Nickvision::Helpers::CancellationToken::reset  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
noexcept   | 
  
 
Resets the token to its initial state. 
Removes the cancel function and sets the cancelled state to false. 
 
 
◆ setCancelFunction()
  
  
      
        
          | void Nickvision::Helpers::CancellationToken::setCancelFunction  | 
          ( | 
          const std::function< void()> & |           cancelFunction | ) | 
           | 
         
       
   | 
  
noexcept   | 
  
 
Sets the cancel function to be called when the token is cancelled. 
- Parameters
 - 
  
    | cancelFunction | The cancel function  | 
  
   
 
 
The documentation for this class was generated from the following file: