1    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2    	/*                                                                           */
3    	/*                  This file is part of the class library                   */
4    	/*       SoPlex --- the Sequential object-oriented simPlex.                  */
5    	/*                                                                           */
6    	/*    Copyright (C) 1996-2022 Konrad-Zuse-Zentrum                            */
7    	/*                            fuer Informationstechnik Berlin                */
8    	/*                                                                           */
9    	/*  SoPlex is distributed under the terms of the ZIB Academic Licence.       */
10   	/*                                                                           */
11   	/*  You should have received a copy of the ZIB Academic License              */
12   	/*  along with SoPlex; see the file COPYING. If not email to soplex@zib.de.  */
13   	/*                                                                           */
14   	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15   	
16   	#include "soplex/spxout.h"
17   	#include "soplex/exceptions.h"
18   	#include "soplex/spxalloc.h"
19   	
20   	namespace soplex
21   	{
22   	/// constructor
23   	SPxOut::SPxOut()
24   	   : m_verbosity(ERROR)
25   	   , m_streams(0)
26   	{
27   	   spx_alloc(m_streams, INFO3 + 1);
28   	   m_streams = new(m_streams) std::ostream*[INFO3 + 1];
29   	   m_streams[ ERROR ] = m_streams[ WARNING ] = &std::cerr;
30   	
31   	   for(int i = DEBUG; i <= INFO3; ++i)
32   	      m_streams[ i ] = &std::cout;
33   	}
34   	
35   	//---------------------------------------------------
36   	
37   	// destructor
38   	SPxOut::~SPxOut()
39   	{
40   	   spx_free(m_streams);
41   	}
42   	
43   	SPxOut& SPxOut::operator=(const SPxOut& base)
44   	{
(1) Event self_assign: No protection against the object assigning to itself.
45   	   m_verbosity = base.m_verbosity;
46   	
47   	   for(int i = DEBUG; i <= INFO3; ++i)
48   	      m_streams[ i ] = base.m_streams[ i ];
49   	
50   	   return *this;
51   	}
52   	
53   	SPxOut::SPxOut(const SPxOut& rhs)
54   	{
55   	   m_verbosity = rhs.m_verbosity;
56   	   m_streams = 0;
57   	   spx_alloc(m_streams, INFO3 + 1);
58   	   m_streams = new(m_streams) std::ostream*[INFO3 + 1];
59   	   m_streams[ ERROR ] = m_streams[ WARNING ] = rhs.m_streams[ERROR];
60   	
61   	   for(int i = DEBUG; i <= INFO3; ++i)
62   	      m_streams[ i ] = rhs.m_streams[ i ];
63   	}
64   	
65   	} // namespace soplex
66