本文整理汇总了C++中KeySet::Unify方法的典型用法代码示例。如果您正苦于以下问题:C++ KeySet::Unify方法的具体用法?C++ KeySet::Unify怎么用?C++ KeySet::Unify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeySet
的用法示例。
在下文中一共展示了KeySet::Unify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool QueryProcessor::
DoQuery( Rectangles &window, KeySet &result )
{
AllDimensions::iterator aitr;
OneDimension::iterator oitr;
Indexes::iterator iitr;
KeySet deviantExportedSet;
KeySet tmpResult;
QueryOutcome qo;
string demangled;
DimRectangleMap::iterator ditr, daxitr;
KeySet::iterator ksitr;
int tmp;
Rectangles *rec = summarize ? &summaries : rectangles;
numQueries++;
//printf( "Doing query\n" );
// Phase 0: Initialize
for( int i = 0; i <= window.rId ; i++ ) {
qo[i].MakeUniversal( );
}
// Phase 1: Process imported intervals
for( aitr=window.importedBoxes.begin( ); aitr!=window.importedBoxes.end( );
aitr++ ) {
demangled.assign( aitr->first, 2, aitr->first.size( ) - 2 );
ditr = rec->unexported.find( demangled );
for( oitr=aitr->second.begin( ); oitr!=aitr->second.end( ); oitr++ ) {
tmpResult.Clear( );
// include all rectangles whose constraints are satisfied
if( ( iitr = exported.find( aitr->first ) ) != exported.end( ) ) {
if( !iitr->second->Filter( oitr->second, tmpResult ) ) {
printf( "Failed exported index lookup\n" );
return( false );
}
}
// include deviant exported rectangles and all rectangles
// which do not constrain this attribute (if any)
if( ditr == rec->unexported.end( ) ) {
qo[oitr->first].IntersectWithUnionOf( tmpResult,
rec->deviantExported );
} else {
qo[oitr->first].IntersectWithUnionOf( tmpResult, ditr->second,
rec->deviantExported );
}
}
}
// Phase 2: Remove candidates which constrain absent attributes
for(ditr=window.unimported.begin();ditr!=window.unimported.end();ditr++) {
// find all rectangles which constrain this particular attribute
daxitr = rec->allExported.find( ditr->first );
if( daxitr == rec->allExported.end( ) ) continue;
// remove this set from the solution for each query rectangle
ksitr.Initialize( ditr->second );
while( ksitr.Next( tmp ) ) {
qo[tmp].Subtract( daxitr->second );
}
}
// Phase 3: Process exported dimensions
for( aitr=window.exportedBoxes.begin( ); aitr!=window.exportedBoxes.end( );
aitr++ ) {
// need to include rectangles which are deviant on this attribute
demangled.assign( aitr->first, 2, aitr->first.size( ) - 2 );
ditr = rec->deviantImported.find( demangled );
for( oitr=aitr->second.begin( ); oitr!=aitr->second.end( ); oitr++ ) {
tmpResult.Clear( );
// include all rectangles which satisfy this constraint
if( ( iitr = imported.find( aitr->first ) ) != imported.end( ) ) {
if( !iitr->second->Filter( oitr->second, tmpResult ) ) {
printf( "Failed imported index lookup\n" );
return( false );
}
}
// check if there are relevant deviant imported rectangles
if( ditr == rec->deviantImported.end( ) ) {
// ... if not, just intersect with filtered results
qo[oitr->first].Intersect( tmpResult );
} else {
// ... otherwise, include deviant imported rectangles
qo[oitr->first].IntersectWithUnionOf(ditr->second,tmpResult);
}
}
}
// Phase 4: Aggregate results for all query rectangles
result.Clear( );
for( int i = 0 ; i <= window.rId ; i++ ) {
result.Unify( qo[i] );
}
// done
return( true );
}