45 #include <BESNotFoundError.h> 48 void csv_read_attributes(DAS &das,
const string &filename)
51 AttrTable *attr_table_ptr = NULL;
59 auto_ptr<CSV_Obj> csvObj(
new CSV_Obj);
61 if (!csvObj->open(filename)) {
63 string err = (string)
"Unable to open file " + filename;
67 throw BESNotFoundError(
string(
"Unable to open file ").append(filename), __FILE__, __LINE__);
72 BESDEBUG(
"csv",
"File Loaded:" << endl << *csvObj << endl );
74 vector<string> fieldList;
75 csvObj->getFieldList(fieldList);
78 vector<string>::iterator it = fieldList.begin();
79 vector<string>::iterator et = fieldList.end();
80 for (; it != et; it++) {
81 AttrTable *attr_table_ptr = das.get_table((
string(*it)).c_str());
83 if (!attr_table_ptr) attr_table_ptr = das.add_table(
string(*it),
new AttrTable);
86 string type = csvObj->getFieldType(*it);
87 attr_table_ptr->append_attr(
"type",
"String", type);
error thrown if the resource requested cannot be found