本文整理汇总了C++中Serializable::unserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializable::unserialize方法的具体用法?C++ Serializable::unserialize怎么用?C++ Serializable::unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serializable
的用法示例。
在下文中一共展示了Serializable::unserialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: string
boost::shared_ptr<Serializable <PDXRecord> > PDXFileReader<FileEnumeratorType>::read() {
using namespace std;
using namespace boost;
Serializable <PDXRecord>* newRecord;
// open the next file to read.
if (!curFile.is_open()) {
if (this->fIt == this->fEnum.end()) {
// Don't bother, no more files.
return shared_ptr<Serializable <PDXRecord> >();
}
const char* filename = (this->fIt)->file_string().c_str();
curFile.open(filename, ios::in | ios::binary);
if (curFile.fail()) {
this->_error = true;
this->_errorMsg = string(" Failed to open file ") + filename;
return shared_ptr<Serializable <PDXRecord> >();
}
arl_file_hdr_t header;
curFile.read((char*) (&header), sizeof (arl_file_hdr_t));
header.base_date = ntohl(header.base_date);
this->base_time.set(header.base_date, 0);
this->fIt++;
}
//do the reading.
newRecord = new PDXRecord(&(this->base_time));
char record[sizeof (pidx_data_t)];
string dataStr;
curFile.read(record, sizeof (record));
if (curFile.eof()) {
curFile.close();
return this->read();
} else {
newRecord->unserialize(dataStr.insert(0, record, sizeof (record)));
}
return shared_ptr<Serializable <PDXRecord> >(newRecord);
}