45 FILE *f = fopen(fname,
"r");
49 ERRORMSG(
"DiscMeta: Could not open file '" << fname <<
"' on node ");
55 std::string *words = 0;
62 if (words != 0 && numtokens > 0) {
79 if ((*a).second.second != 0)
80 delete [] ((*a).second.second);
94 while (i !=
n && iter !=
end()) {
100 return (*iter).first;
123 while (i !=
n && iter !=
end()) {
129 return (*iter).second.first;
141 while (i !=
n && iter !=
end()) {
147 return (*iter).second.second;
158 const int bufferSize = 1024*128;
159 char bufferstore[bufferSize];
165 if (fgets(bufferstore, bufferSize, f) == 0)
167 unsigned int len = strlen(bufferstore);
168 if (len > 0 && bufferstore[len-1] ==
'\n')
169 bufferstore[len - 1] =
'\0';
172 buffer = bufferstore;
173 while (*buffer ==
' ' || *buffer ==
'\t')
175 if (*buffer ==
'#' || *buffer ==
'\n' || *buffer ==
'\0')
191 msg <<
"Lines in file = " <<
size() <<
endl;
192 for (
unsigned int i=0; i <
size(); ++i) {
193 msg <<
" Line " << i <<
": '" <<
getKeyword(i) <<
"' =";
195 msg <<
" '" <<
getWords(i)[j] <<
"'";
Inform & endl(Inform &inf)
static int dc_tokenize_string(const char *s, const char *tok, std::string *&)
container_t::value_type value_type
void printDebug(Inform &)
unsigned int size() const
int getNumWords(unsigned int) const
container_t::const_iterator const_iterator
DiscMeta(const char *fname)
container_t::iterator iterator
int getLineNumber(unsigned int) const
bool read_meta_line(FILE *, std::string *&, int &)
const std::string & getKeyword(unsigned int)
std::pair< int, std::string * > element_t
std::string * getWords(unsigned int)
static void abort(const char *=0)
std::pair< iterator, bool > insert(const value_type &x)