Initial Import from SVN
This commit is contained in:
50
tools/configsys/device.cpp
Normal file
50
tools/configsys/device.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#include "util.h"
|
||||
#include "device.h"
|
||||
#include "cluster.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool device::load(const char *filename)
|
||||
{
|
||||
ifstream f;
|
||||
char line[1024];
|
||||
|
||||
f.open(filename,ios::in);
|
||||
if(!f.is_open())
|
||||
{
|
||||
cout << "Unable to open device " << filename << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
while(f.getline(line,1023))
|
||||
{
|
||||
stringstream temp(line);
|
||||
string in;
|
||||
temp >> in;
|
||||
uc(in);
|
||||
if(in.substr(0,1) == "#")
|
||||
continue;
|
||||
|
||||
if(in == "ALWAYS")
|
||||
{
|
||||
this->always.read(f);
|
||||
}
|
||||
if(in == "OPTION")
|
||||
{
|
||||
temp >> in;
|
||||
uc(in);
|
||||
this->options[in].read(f);
|
||||
}
|
||||
}
|
||||
|
||||
f.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user