Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method PollOptimizerRunController (Boolean canstart) const as stream[Boolean] 
 | 
{ 
 | 
  Description: 
 | 
  [* 
 | 
    This method is called every `LibOpt_OptimizerRunController.PollingDuration` milliseconds. 
 | 
    This continues until the `LibOpt_Run` is stopped or until the `CanStart` method returns true. (The `CanStart` method returns true if `LibOpt_Run` receives approval from the `LibOpt_OptimizerRunController` that it is allowed to start).  
 | 
    Note: This method is Const and only depends on objects from the `LibOpt_OptimizerRunController` dataset.  
 | 
    This is intentional to ensure that the polling only requires read access to the `LibOpt_OptimizerRunController` dataset. We don't want this method to depend on any other dataset for performance reasons. 
 | 
  *] 
 | 
  TextBody: 
 | 
  [* 
 | 
    // evr3 Apr-26-2022 (created) 
 | 
     
 | 
    canstartstream := emit( canstart ); 
 | 
     
 | 
    // The run can be aborted before it is actually started. In this case, we should also stop polling the optimizer controller 
 | 
    if( not canstart and not this.HasStopped() ) 
 | 
    { 
 | 
      pollingduration := Duration::Millis( this.OptimizerRunController().PollingDuration() ); 
 | 
      canstartstream := stream[Void]::Wait( pollingduration ) 
 | 
                        ->|this->CanStart(); 
 | 
      canstartstream := this->PollOptimizerRunController( canstartstream ); 
 | 
    } 
 | 
     
 | 
    return canstartstream; 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |