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 <stdlib.h>
26   	#include <assert.h>
27   	
28   	#include "soplex/spxid.h"
29   	#include "soplex/exceptions.h"
30   	
31   	namespace soplex
32   	{
33   	SPxColId::SPxColId(const DataKey& p_key)
34   	   : DataKey(p_key)
35   	{
36   	   info = SPxId::COL_ID;
37   	}
38   	
39   	SPxColId::SPxColId(const SPxId& p_key)
40   	   : DataKey(p_key)
41   	{
42   	   assert(!p_key.isSPxRowId());
43   	
44   	   info = SPxId::COL_ID;
45   	}
46   	
47   	SPxRowId::SPxRowId(const DataKey& p_key)
48   	   : DataKey(p_key)
49   	{
50   	   info = SPxId::ROW_ID;
51   	}
52   	
53   	SPxRowId::SPxRowId(const SPxId& p_key)
54   	   : DataKey(p_key)
55   	{
56   	   assert(!p_key.isSPxColId());
57   	
58   	   info = SPxId::ROW_ID;
59   	}
60   	
61   	std::ostream& operator<<(std::ostream& os, const SPxId& id)
62   	{
63   	   switch(id.type())
64   	   {
65   	   case SPxId::ROW_ID:
66   	      os << "row ";
67   	      break;
68   	
69   	   case SPxId::COL_ID :
70   	      os << "col ";
71   	      break;
72   	
73   	   case SPxId::INVALID :
74   	      os << "Invalid ";
75   	      break;
76   	
77   	   default :
78   	      throw SPxInternalCodeException("XSPXID01 This should never happen.");
79   	   }
80   	
81   	   os << id.idx << " (" << id.info << ")";
82   	
83   	   return os;
84   	}
85   	
86   	} // namespace soplex
87