1/* $Id: MyMessageHandler.hpp 1665 2011-01-04 17:55:54Z lou $ */
2// Copyright (C) 2003, International Business Machines
3// Corporation and others. All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef MyMessageHandler_H
7#define MyMessageHandler_H
8
9#include <deque>
10
11#include "CoinPragma.hpp"
12#include <stdio.h>
13#include "CoinMessageHandler.hpp"
14
15/** This just adds a model to CoinMessage and a void pointer so
16 user can trap messages and do useful stuff.
17 This is used in Clp/Test/unitTest.cpp
18
19 The file pointer is just there as an example of user stuff.
20 In practice you might have
21
22*/
23class ClpSimplex;
24
25
26typedef std::vector<double> StdVectorDouble;
27
28class MyMessageHandler : public CoinMessageHandler {
29
30public:
31 /**@name Overrides */
32 //@{
33 virtual int print() override;
34 //@}
35 /**@name set and get */
36 //@{
37 /// Model
38 const ClpSimplex * model() const;
39 void setModel(ClpSimplex * model);
40 /// Get queue of feasible extreme points
41 const std::deque<StdVectorDouble> & getFeasibleExtremePoints() const;
42 /// Empty queue of feasible extreme points
43 void clearFeasibleExtremePoints();
44 //@}
45
46 /**@name Constructors, destructor */
47 //@{
48 /** Default constructor. */
49 MyMessageHandler();
50 /// Constructor with pointer to model
51 MyMessageHandler(ClpSimplex * model,
52 FILE * userPointer = nullptr);
53 /** Destructor */
54 virtual ~MyMessageHandler();
55 //@}
56
57 /**@name Copy method */
58 //@{
59 /** The copy constructor. */
60 MyMessageHandler(const MyMessageHandler&);
61 /** The copy constructor from an CoinSimplexMessageHandler. */
62 MyMessageHandler(const CoinMessageHandler&);
63
64 MyMessageHandler& operator=(const MyMessageHandler&);
65 /// Clone
66 virtual CoinMessageHandler * clone() const override ;
67 //@}
68
69
70protected:
71 /**@name Data members
72 The data members are protected to allow access for derived classes. */
73 //@{
74 /// Pointer back to model
75 ClpSimplex * model_;
76 /// Saved extreme points
77 std::deque<StdVectorDouble> feasibleExtremePoints_;
78 /// Iteration number so won't do same one twice
79 int iterationNumber_;
80 //@}
81};
82
83#endif
84