Bonmin
1.8.9
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Interfaces
BonColReader.hpp
Go to the documentation of this file.
1
// (C) Copyright Carnegie Mellon University 2005
2
// All Rights Reserved.
3
// This code is published under the Eclipse Public License.
4
//
5
// Authors :
6
// Pierre Bonami, Carnegie Mellon University,
7
//
8
// Date : 26/05/2005
9
10
#ifndef NameReader_HPP
11
#define NameReader_HPP
12
#include <string>
13
#include <vector>
14
#include <list>
15
#include <fstream>
16
#include <iostream>
17
#include <
CoinHelperFunctions.hpp
>
18
#include "
OsiSolverInterface.hpp
"
19
//#include <tr1/unordered_map>
20
#include <map>
21
22
namespace
Bonmin
{
25
class
NamesReader
26
{
27
public
:
29
NamesReader
(
const
char
* fileName,
const
char
* suffix);
31
NamesReader
(
const
std::string & fileName=
""
,
const
std::string& suffix=
".col"
);
33
bool
readFile
();
35
bool
readFile
(
const
std::string &file)
36
{
37
file_=file;
38
return
readFile
();
39
}
40
42
void
copyNames
(
OsiSolverInterface::OsiNameVec
& Names);
43
45
const
std::string&
name
(
int
i){
46
return
names_[i];
47
}
48
50
int
index
(
const
char
* str){
51
return
indices_[str];
52
}
53
private
:
55
std::string file_;
56
58
std::string suffix_;
59
61
struct
ltstr
62
{
63
bool
operator()(
const
char
* s1,
const
char
* s2)
const
64
{
65
return
strcmp(s1, s2) < 0;
66
}
67
};
68
70
typedef
std::map<const char *, int, ltstr> namesHash;
72
namesHash indices_;
74
std::vector<std::string> names_;
75
};
76
}
77
#endif
CoinHelperFunctions.hpp
OsiSolverInterface.hpp
Bonmin::NamesReader::NamesReader
NamesReader(const std::string &fileName="", const std::string &suffix=".col")
Constructor with a file name given by a string and also default (empty string).
Bonmin::NamesReader::index
int index(const char *str)
Access index of variable str.
Definition
BonColReader.hpp:50
Bonmin::NamesReader::name
const std::string & name(int i)
Access Names of indexed by i.
Definition
BonColReader.hpp:45
Bonmin::NamesReader::copyNames
void copyNames(OsiSolverInterface::OsiNameVec &Names)
Copy the names to Names.
Bonmin::NamesReader::readFile
bool readFile(const std::string &file)
Reads the .col file fileName.
Definition
BonColReader.hpp:35
Bonmin::NamesReader::readFile
bool readFile()
Reads the .col file.
Bonmin::NamesReader::NamesReader
NamesReader(const char *fileName, const char *suffix)
Constructor with a file name given by a const char *.
OsiSolverInterface::OsiNameVec
std::vector< std::string > OsiNameVec
Bonmin
(C) Copyright International Business Machines Corporation 2007
Definition
BonAmplSetup.hpp:16
Generated by
1.17.0