本文整理汇总了C++中Locator::getElements方法的典型用法代码示例。如果您正苦于以下问题:C++ Locator::getElements方法的具体用法?C++ Locator::getElements怎么用?C++ Locator::getElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locator
的用法示例。
在下文中一共展示了Locator::getElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateLocators
// Update the locators in the vPath object
int Path::PopulateLocators()
{
try{
// Get the global locator
Locator tempLocator = iblob->locateGlobal();
// The tempLocator will finally contain a locator to the object
for(vector<PathComponent>::iterator it = vPath.begin(); it!= vPath.end(); it++)
{
if(tempLocator.getElements() < (uint)it->accessCode)
{
consistent = false;
throw 0;
}
tempLocator = iblob->locate(tempLocator, (*it).accessCode);
(*it).loc = tempLocator;
}
consistent = true;
return 1;
}
catch(...)
{
consistent = false;
cerr<<"Cannot make the path consistent"<<endl;
throw string("Cannot make the path consistent");
return 0;
}
}
示例2: write_to_blob
void write_to_blob(int number)
{
// ESTABLISH CONNECTION TO THE DATABASE
prepareBLOB_In_DB(string("phoenix.cise.ufl.edu:1521/orcl"), string(username), string(password));
//iBlobStore * store = new iBlobOracleStore(mylob, errhp, svchp);
iBlobStore * store = new iBlobOracleStore(mylob, errhp, svchp);
iBlob p (store, false);
// Start the timer
clock_t begin=clock();
/* IBLOB FUNCTIONS USED TO CREATE THE SEGMENT OBJECT */
for(int i = 0; i < number; i++)
{
cout<<i<<endl;
Locator lGlobal = p.locateGlobal();
cout<<"Done 1 "<<endl;
Locator l;
if(lGlobal.getElements() == 0)
{cout<<"Here"<<endl;
l = p.insert(lGlobal, 0);
}
cout<<"Done 2 "<<endl;
Locator lLeftPt = l.insert(0);
cout<<"Done 3 "<<endl;
Locator lRightPt = l.insert(1);
cout<<"Done 4 "<<endl;
Locator lLPTx = lLeftPt.insert(0);
cout<<"Done 5 "<<endl;
Locator lLPTy = lLeftPt.insert(1);
cout<<"Done 6 "<<endl;
Locator lRPTx = lRightPt.insert(0);
cout<<"Done 7 "<<endl;
Locator lRPTy = lRightPt.insert(1);
cout<<"Done 8 "<<endl;
double x1 = fRand(0,MAX);
double y1 = fRand(0,MAX);
double x2 = fRand(0,MAX);
double y2 = fRand(0,MAX);
cout<<"Done 8.5 "<<endl;
p.insertVal(x1, lLeftPt, 0);
cout<<"Done 9 "<<endl;
p.insertVal(y1, lLPTy, 0);
cout<<"Done 10 "<<endl;
p.insertVal(x2, lRPTx, 0);
cout<<"Done 11 "<<endl;
p.insertVal(y2, lRPTy, 0);
cout<<"Done 12 "<<endl;
}
/****************************************************/
clock_t end=clock();
cout << "Time elapsed: " << double(diffclock(end,begin)) << " ms"<< endl;
closeConnection();
}
示例3: gotoBO
Locator Path::gotoBO()
{
makeInconsistent();
Locator l;
try{
l = iblob->locateGlobal();
}
catch(...)
{
cerr<<endl<<"ERROR locating Global"<<endl;
}
vector<PathComponent>::iterator it = vPath.begin();
do
{
try{
if((l.getElements() == (it->accessCode)))
{
l = iblob->insert(l,it->accessCode, OBJECT_LEVEL);
it->loc = l;
}
else
{
l = l.locate(it->accessCode);
}
}
catch(...)
{
cerr<<"Path::gotoBO - Discontinuity detected"<<endl;
throw string("discontinuity");
}
it++;
}while(it!= vPath.end()-1);
if(l.getElements() < (uint)it->accessCode)
throw string("Not Present");
return l;
}