1    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2    	/*                                                                           */
3    	/*                  This file is part of the class library                   */
4    	/*       SoPlex --- the Sequential object-oriented simPlex.                  */
5    	/*                                                                           */
6    	/*  Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB)                      */
7    	/*                                                                           */
8    	/*  Licensed under the Apache License, Version 2.0 (the "License");          */
9    	/*  you may not use this file except in compliance with the License.         */
10   	/*  You may obtain a copy of the License at                                  */
11   	/*                                                                           */
12   	/*      http://www.apache.org/licenses/LICENSE-2.0                           */
13   	/*                                                                           */
14   	/*  Unless required by applicable law or agreed to in writing, software      */
15   	/*  distributed under the License is distributed on an "AS IS" BASIS,        */
16   	/*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17   	/*  See the License for the specific language governing permissions and      */
18   	/*  limitations under the License.                                           */
19   	/*                                                                           */
20   	/*  You should have received a copy of the Apache-2.0 license                */
21   	/*  along with SoPlex; see the file LICENSE. If not email to soplex@zib.de.  */
22   	/*                                                                           */
23   	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24   	
25   	#include "soplex/spxout.h"
26   	#include "soplex/exceptions.h"
27   	#include "soplex/spxalloc.h"
28   	
29   	namespace soplex
30   	{
31   	/// constructor
32   	SPxOut::SPxOut()
33   	   : m_verbosity(ERROR)
34   	   , m_streams(0)
35   	{
36   	   spx_alloc(m_streams, INFO3 + 1);
37   	   m_streams = new(m_streams) std::ostream*[INFO3 + 1];
38   	   m_streams[ ERROR ] = m_streams[ WARNING ] = &std::cerr;
39   	
40   	   for(int i = DEBUG; i <= INFO3; ++i)
41   	      m_streams[ i ] = &std::cout;
42   	}
43   	
44   	//---------------------------------------------------
45   	
46   	// destructor
47   	SPxOut::~SPxOut()
48   	{
49   	   spx_free(m_streams);
50   	}
51   	
52   	SPxOut& SPxOut::operator=(const SPxOut& base)
53   	{
54   	   if(this != &base)
55   	      m_verbosity = base.m_verbosity;
56   	
57   	   for(int i = DEBUG; i <= INFO3; ++i)
58   	      m_streams[ i ] = base.m_streams[ i ];
59   	
60   	   return *this;
61   	}
62   	
63   	SPxOut::SPxOut(const SPxOut& rhs)
64   	{
65   	   m_verbosity = rhs.m_verbosity;
66   	   m_streams = 0;
67   	   spx_alloc(m_streams, INFO3 + 1);
68   	   m_streams = new(m_streams) std::ostream*[INFO3 + 1];
69   	   m_streams[ ERROR ] = m_streams[ WARNING ] = rhs.m_streams[ERROR];
70   	
71   	   for(int i = DEBUG; i <= INFO3; ++i)
72   	      m_streams[ i ] = rhs.m_streams[ i ];
73   	}
74   	
75   	} // namespace soplex
76