本文整理汇总了C++中DataItem::bool_value方法的典型用法代码示例。如果您正苦于以下问题:C++ DataItem::bool_value方法的具体用法?C++ DataItem::bool_value怎么用?C++ DataItem::bool_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataItem
的用法示例。
在下文中一共展示了DataItem::bool_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void PointsDataSeparator::run()
{
// This shambles of a section retrieves all the various inputs.
DataItem *pointsInput = get_dataitem("PointsInputComplete", true, DATAITEM_POINTSVECTORS_CPU_VECTOR);
std::vector<std::vector<Hamtrans::Point> *> *points = (std::vector<std::vector<Hamtrans::Point> *> *) pointsInput->get_data();
DataItem *parametersInput = get_dataitem("ParametersInput");
DataItem *refreshedPoints = get_dataitem("PointsInput");
Hamtrans::SeparationParameters *params;
std::vector<std::vector<Hamtrans::Point> *> *outputPoints;
// Handles the parameters (see if they're pre-existing).
if(parametersInput->get_initialised()) {
params = (Hamtrans::SeparationParameters *) parametersInput->get_data();
outputPoints = (std::vector<std::vector<Hamtrans::Point> *> *) params->dataPointer;
} else {
params = new Hamtrans::SeparationParameters();
outputPoints = new std::vector<std::vector<Hamtrans::Point> *>();
params->dataPointer = outputPoints;
}
size_t perSet = 0 ;
DataItem *maxPointsPerIteration = get_dataitem_optional("MaxPointsPerIteration");
if(maxPointsPerIteration != NULL) {
perSet = maxPointsPerIteration->integer_value();
} else {
perSet = PointsDataSeperatorLimits();
}
std::cerr << perSet << " points per iteration" << std::endl;
std::vector<std::vector<Hamtrans::Point> *> *thisSubsetOut = new std::vector<std::vector<Hamtrans::Point> *>();
// The next section handles the merging back in of new/modified points:
if(parametersInput->get_initialised() && refreshedPoints->get_initialised())
{
std::vector<std::vector<Hamtrans::Point> *> *thisSubsetIn = (std::vector<std::vector<Hamtrans::Point> *> *) refreshedPoints->get_data();
for(size_t i = 0; i < thisSubsetIn->size(); i++) {
std::vector<Hamtrans::Point> *subVector = (*thisSubsetIn)[i];
outputPoints->push_back(subVector);
}
delete thisSubsetIn;
refreshedPoints->uninitialise();
}
// This section handles what happens when the original set has been exhausted.
if(points->size() == 0) {
DataItem *infiniteLoop = get_dataitem_optional("InfiniteLoop");
if(infiniteLoop != NULL && infiniteLoop->bool_value()) {
std::cerr << "INF LOOP" << std::endl;
delete params;
params = new Hamtrans::SeparationParameters;
std::cerr << ">>>>>>>>>>>>>>>>>>>>>>>>>>OUTPUT POINTS HAS " << outputPoints->size() << " sub vectors" << std::endl;
points = outputPoints;
outputPoints = new std::vector<std::vector<Hamtrans::Point> *>();
params->dataPointer = outputPoints;
pointsInput->set_data(points);
} else {
std::cerr << "Separate and merge complete." << std::endl;
delete params;
parametersInput->uninitialise();
delete points;
pointsInput->set_data(outputPoints);
switch_destination_set();
return ;
}
}
// This section dispatches subsets of the original set for the Pipeline.
size_t cummulative = 0;
size_t numVectors = points->size();
std::cout << "Separator has " << points->size() << " vectors." << std::endl;
for(size_t i = 0; i < numVectors; i++)
{
std::cerr << (*points)[0]->size() << " points in the top vector " << i << std::endl;
while((*points)[0]->size() == 0)
{
points->erase(points->begin());
if(points->size() == 0)
break;
}
if(points->size() == 0)
break;
size_t amount = std::min((*points)[0]->size(), perSet);
amount = std::min(amount, perSet - cummulative);
if(amount > 0) {
//.........这里部分代码省略.........