本文整理汇总了C++中table::Ptr::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::reset方法的具体用法?C++ Ptr::reset怎么用?C++ Ptr::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table::Ptr
的用法示例。
在下文中一共展示了Ptr::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: solveOptimalMinMax
//-------------------------------------------------------------------------------
Table::Ptr solveOptimalMinMax(aq::verb::VerbNode::Ptr spTree,
Base& BaseDesc,
Settings& Settings )
{
if( !spTree->getLeftChild() )
{
return NULL;
// throw generic_error(generic_error::INVALID_QUERY, "");
}
aq::verb::VerbNode::Ptr verb1 = spTree->getLeftChild();
aq::verb::VerbNode::Ptr verb2 = NULL;
if( !verb1 )
return NULL;
if ((verb1->getVerbType() == K_MIN) || (verb1->getVerbType() == K_MAX))
verb2 = verb1->getLeftChild();
else if ((verb1->getVerbType() == K_AS) && ((verb1->getLeftChild()->getVerbType() == K_MIN) || (verb1->getLeftChild()->getVerbType() == K_MAX)))
verb2 = verb1->getLeftChild()->getLeftChild();
else
return NULL;
if( verb2->getVerbType() != K_PERIOD )
return NULL;
if( spTree->getBrother() == NULL )
return NULL;
aq::verb::VerbNode::Ptr spNode = spTree;
do
{
if( spNode->getVerbType() == K_WHERE )
return NULL;
spNode = spNode->getBrother();
} while( spNode->getBrother() );
aq::verb::ColumnVerb::Ptr columnVerb = boost::dynamic_pointer_cast<aq::verb::ColumnVerb>( verb2 );
Table::Ptr table = BaseDesc.getTable( columnVerb->getTableName() );
size_t colIdx = table->getColumnIdx( columnVerb->getColumnOnlyName() );
Column::Ptr column = table->Columns[colIdx];
ColumnItem::Ptr minMax = NULL;
bool min = verb1->getVerbType() == K_MIN;
for( int partIdx = 0; ; ++partIdx )
{
ColumnItem::Ptr item = getMinMaxFromThesaurus( table->ID, colIdx, partIdx, min, BaseDesc, Settings );
if( !item )
break;
if( !minMax )
minMax = item;
else
if( min == ColumnItem::lessThan(item.get(), minMax.get(), column->Type) )
minMax = item;
}
table.reset(new Table());
Column::Ptr newColumn(new Column(*column));
newColumn->Items.push_back( minMax );
table->Columns.push_back( newColumn );
table->TotalCount = 1;
return table;
}