Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::math_opt::MessageCallbackData Class Reference

#include <message_callback_data.h>

Public Member Functions

 MessageCallbackData ()=default
 
 MessageCallbackData (const MessageCallbackData &)=delete
 
MessageCallbackDataoperator= (const MessageCallbackData &)=delete
 
std::vector< std::string > Parse (absl::string_view message)
 
std::vector< std::string > Flush ()
 

Detailed Description

Buffer for solvers messages that enforces the contract of MessageCallback.

This contract mandates that each message is a full finished line. As a consequence, if the solver calls the callback with a partial last line, this one must not be passed immediately to MessageCallback but kept until the end of the line is reached (or the solve is done).

To implement that this class has two methods:

  • Parse() that is to be called for each received message from the solver.
  • Flush() that must be called at the end of the solve to generate the data corresponding the last message sent by the solver if it was an unfinished - line.

Definition at line 41 of file message_callback_data.h.

Constructor & Destructor Documentation

◆ MessageCallbackData() [1/2]

operations_research::math_opt::MessageCallbackData::MessageCallbackData ( )
default

◆ MessageCallbackData() [2/2]

operations_research::math_opt::MessageCallbackData::MessageCallbackData ( const MessageCallbackData & )
delete

Member Function Documentation

◆ Flush()

std::vector< std::string > operations_research::math_opt::MessageCallbackData::Flush ( )

Returns a vector with the last unfinished line if it exists, else an empty vector.

Definition at line 55 of file message_callback_data.cc.

◆ operator=()

MessageCallbackData & operations_research::math_opt::MessageCallbackData::operator= ( const MessageCallbackData & )
delete

◆ Parse()

std::vector< std::string > operations_research::math_opt::MessageCallbackData::Parse ( absl::string_view message)

Parses the input message, returning a vector with all finished lines. Returns an empty vector if the input message did not contain any '
'.

It updates this object with the last unfinished line to use it to complete the next message.

Iterate on all complete lines (lines ending with a '
').

At the end of the loop, the remainder may contain the last unfinished line. This could be the first line too if the entire message does not contain '
'.

Definition at line 28 of file message_callback_data.cc.


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