00001 /* $Id: CoinShallowPackedVector.hpp 1498 2011-11-02 15:25:35Z mjs $ */ 00002 // Copyright (C) 2000, International Business Machines 00003 // Corporation and others. All Rights Reserved. 00004 // This code is licensed under the terms of the Eclipse Public License (EPL). 00005 00006 #ifndef CoinShallowPackedVector_H 00007 #define CoinShallowPackedVector_H 00008 00009 #if defined(_MSC_VER) 00010 // Turn off compiler warning about long names 00011 # pragma warning(disable:4786) 00012 #endif 00013 00014 #include "CoinError.hpp" 00015 #include "CoinPackedVectorBase.hpp" 00016 00074 class CoinShallowPackedVector : public CoinPackedVectorBase { 00075 friend void CoinShallowPackedVectorUnitTest(); 00076 00077 public: 00078 00081 00082 virtual int getNumElements() const { return nElements_; } 00084 virtual const int * getIndices() const { return indices_; } 00086 virtual const double * getElements() const { return elements_; } 00088 00091 00092 void clear(); 00094 CoinShallowPackedVector& operator=(const CoinShallowPackedVector & x); 00096 CoinShallowPackedVector& operator=(const CoinPackedVectorBase & x); 00098 void setVector(int size, const int * indices, const double * elements, 00099 bool testForDuplicateIndex = true); 00101 00105 CoinShallowPackedVector(bool testForDuplicateIndex = true); 00114 CoinShallowPackedVector(int size, 00115 const int * indices, const double * elements, 00116 bool testForDuplicateIndex = true); 00118 CoinShallowPackedVector(const CoinPackedVectorBase &); 00120 CoinShallowPackedVector(const CoinShallowPackedVector &); 00122 virtual ~CoinShallowPackedVector() {} 00124 void print(); 00126 00127 private: 00130 00131 const int * indices_; 00133 const double * elements_; 00135 int nElements_; 00137 }; 00138 00139 //############################################################################# 00145 void 00146 CoinShallowPackedVectorUnitTest(); 00147 00148 #endif