60 vector < string >
split(
const string & str,
const string & delim)
64 string::size_type len = str.length();
65 string::size_type dlen = delim.length();
66 for (string::size_type i = 0, previ = -dlen;; previ = i) {
67 i = str.find(delim, previ + dlen);
71 if (previ + dlen < len)
73 substr(previ + dlen, (len - previ - dlen)));
76 rv.push_back(str.substr(previ + dlen, (i - previ - dlen)));
83 string join(
const vector < string > &sv,
const string & delim)
88 for (
int i = 1; i < (int) sv.size(); ++i)
89 str += (delim + sv[i]);
94 bool SDSExists(
const char *filename,
const char *sdsname)
98 if ((sd_id = SDstart(filename, DFACC_RDONLY)) < 0) {
99 BESDEBUG(
"h4",
"hcutil:96 SDstart for " << filename <<
" error" << endl);
103 index = SDnametoindex(sd_id, (
char *) sdsname);
104 if (SDend(sd_id) < 0)
105 BESDEBUG(
"h4",
"hcutil: SDend error: " << HEstring((hdf_err_code_t)HEvalue(1)) << endl);
110 bool GRExists(
const char *filename,
const char *grname)
113 int32 file_id, gr_id, index;
114 if ((file_id = Hopen(filename, DFACC_RDONLY, 0)) < 0)
116 if ((gr_id = GRstart(file_id)) < 0)
119 index = GRnametoindex(gr_id, (
char *) grname);
130 if ((file_id = Hopen(filename, DFACC_RDONLY, 0)) < 0)
133 ref = VSfind(file_id, vdname);
bool SDSExists(const char *filename, const char *sdsname)
bool GRExists(const char *filename, const char *grname)
bool VdataExists(const char *filename, const char *vdname)
string join(const vector< string > &sv, const string &delim)
vector< string > & split(const string &s, char delim, vector< string > &elems)
Splits the string on the passed char.
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream