本文整理汇总了C++中DataSource::GetBlockCount方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSource::GetBlockCount方法的具体用法?C++ DataSource::GetBlockCount怎么用?C++ DataSource::GetBlockCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSource
的用法示例。
在下文中一共展示了DataSource::GetBlockCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructionDataBlock
void Package::ConstructionDataBlock(DataSource &Source,unsigned long ConstructionPosition)
{
int BlockCount = Source.GetBlockCount();
int CurrentPoint = ConstructionPosition;
/* Interval Interval1;
Interval1.StartRecord ();
*/
for( int i=0; i<BlockCount; i++)
{
DataPointFromStream FilePoint(m_DataStream,CurrentPoint);
BlockSource Block(FilePoint);
// Interval Interval2;
// Interval2.StartRecord ();
Block.CloneBlockSourceToMe(Source[i]) ;
// Interval2.EndRecord();
// cout <<"部分耗时"<<(Interval2.GetInterval() )<<endl;
m_DataBlock.InsertBlock(Block);
CurrentPoint = CurrentPoint + Block.GetLength();
}
// Interval1.EndRecord();
// cout <<"总循环耗时"<<(Interval1.GetInterval() )<<endl;
}
示例2: exception
Package::Package(DataSource &Source,const string FileName)
{
m_DataStream.open(FileName.c_str(),ios::out|ios::binary );
if(!m_DataStream.is_open())
{
throw exception("File Open Error!!");
}
Interval Interval1;
Interval1.StartRecord ();
unsigned long BlockStartPosition = sizeof(pack_header);
ConstructionDataBlock(Source,BlockStartPosition);
Interval1.EndRecord();
int IntervalSecond = Interval1.GetIntervalBySecond();
unsigned long IndexOffset = m_DataStream.tellg();
m_DataBlock >> m_DataStream;
m_DataStream.seekg(0,ios::beg);
unsigned long CRC32value = 0;
PackageFileHead FileHead(Source.GetBlockCount(), IndexOffset,FileID,BlockStartPosition,CRC32value) ;
FileHead >> m_DataStream;
m_DataStream.clear();
m_DataStream.close();
m_DataStream.seekg(0,ios::beg );
m_DataStream.open(FileName.c_str(),ios::in|ios::binary );
}