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/didxset.h" 26 #include "soplex/spxalloc.h" 27 28 namespace soplex 29 { 30 31 void DIdxSet::setMax(int newmax) 32 { 33 assert(idx != 0); 34 assert(max() > 0); 35 36 len = (newmax < size()) ? size() : newmax; 37 len = (len < 1) ? 1 : len; 38 39 assert(len > 0); 40 41 spx_realloc(idx, len); 42 } 43 44 DIdxSet::DIdxSet(const IdxSet& old) 45 : IdxSet() 46 { 47 len = old.size(); 48 len = (len < 1) ? 1 : len; 49 spx_alloc(idx, len); 50 51 IdxSet::operator= (old); 52 } 53 54 DIdxSet::DIdxSet(const DIdxSet& old) 55 : IdxSet() 56 { 57 len = old.size(); 58 len = (len < 1) ? 1 : len; 59 spx_alloc(idx, len); 60 61 IdxSet::operator= (old); 62 } 63 64 DIdxSet::DIdxSet(int n) 65 : IdxSet() 66 { 67 len = (n < 1) ? 1 : n; 68 spx_alloc(idx, len); 69 } 70 71 DIdxSet::~DIdxSet() 72 { 73 if(idx) 74 spx_free(idx); 75 } 76 } // namespace soplex 77