00001 // (C) Copyright Carnegie Mellon University 2005 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Pierre Bonami, Carnegie Mellon University, 00007 // 00008 // Date : 26/05/2005 00009 00010 #ifndef IpCbcColReader_HPP 00011 #define IpCbcColReader_HPP 00012 #include <string> 00013 #include <list> 00014 #include <fstream> 00015 #include <iostream> 00016 #include <CoinHelperFunctions.hpp> 00017 #include <map> 00018 #include <vector> 00019 00022 class IpCbcColReader 00023 { 00024 public: 00026 IpCbcColReader(const char * fileName); 00028 IpCbcColReader(const std::string & fileName=""); 00030 bool readFile(); 00032 bool readFile(const std::string &fileName) 00033 { 00034 fileName_=fileName; 00035 return readFile(); 00036 } 00037 00039 void copyNames(std::string *varNames, int n_var); 00040 private: 00042 std::string fileName_; 00043 00045 struct ltstr 00046 { 00047 bool operator()(const char* s1, const char* s2) const 00048 { 00049 return strcmp(s1, s2) < 0; 00050 } 00051 }; 00052 00054 //typedef __gnu_cxx::hash_map<const char *, int> namesHash;//, __gnu_cxx::hash <const char *>, eqstr > namesHash; 00055 typedef std::map< const char *, int, ltstr > namesStorage; 00056 00058 namesStorage varIndices_; 00060 std::vector<std::string> varNames_; 00061 }; 00062 00063 #endif