How do you interpret this line :
...and how would you use it? Thanks in advance.Code:dataset_loader (const string& filename) : hdf5_file(filename, H5F_ACC_RDONLY), datasets() {}
How do you interpret this line :
...and how would you use it? Thanks in advance.Code:dataset_loader (const string& filename) : hdf5_file(filename, H5F_ACC_RDONLY), datasets() {}
It looks like a line of a constructor for a class called dataset_loader, which takes a string (filename), then calls the base-class constructor with:
hdf5_file(filename, H5F_ACC_RDONLY), datasets()
How you would use that would be something like:
How you would further use the dataset_loader class, you haven't given any information to tell, so I can't even guess.Code:... dataset_loader ds("mydatafile.h5f"); ...
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I should be able to access objects , such as, "mybuf(x,y,z)" . read_data_set returns a reference to dataset_buf. I am confused about which dataset_buf to use, as doing "dataset_buf somebuffer" is valid. This code is in a header file.Code:public: static void Init () { Exception::dontPrint(); } dataset_loader (const string& filename) : hdf5_file(filename, H5F_ACC_RDONLY), datasets() {} ~dataset_loader () {hdf5_file.close(); } const dataset_buf& read_data_set (const string& dataname) {
It is pretty hard to guess how a class should be used without understanding the full class hierarchy of all classes that are involved in the subsystem.
is valid code, but it doesn't mean that's CORRECT code.Code:dataset_buf somebuffer = read_data_set("somename");
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
my code :
My errors:Code:int main(int argc, char* argv[]){ argc--; if ( argc < 1){ cout << "Usage:" << endl << "h5inspect file.h5" << endl; return 0; } //iterate *.h5 in ascending order for (int count = 1; count <= argc; count ++){ char iterchar; const string filename = argv[count]; cout << "HDF5 \"" << filename << "\" { "<< endl; dataset_loader dset( filename); cout << "GROUP \"/\" {" << endl; cout << " DATASET \""; while (iterchar != '\"'){ iterchar = getchar(); if(iterchar != '\"') putchar (iterchar); } cout << endl << endl << iterchar << endl << endl; //cout << "\" {" << endl; dataset_buf& read_data_set(string(iterchar)); cout << dset << "pie"; cout << endl << endl << endl; } return 0;
Code:h5inspect.cpp: In function 'int main(int, char**)': h5inspect.cpp:33: error: no match for 'operator<<' in 'std::cout << dset' /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:67: note: candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>& (*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:78: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>& (*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>] /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:90: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>] /usr/lib/gcc/i486-slackware-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:241: note: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char, _Traits = std::char_traits<char>] etc..
You are trying to output "dset", but you (or anyone else) haven't told the compiler how a dset should be output.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.