VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkStatisticsAlgorithmPrivate.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00033 #ifndef __vtkStatisticsAlgorithmPrivate_h 00034 #define __vtkStatisticsAlgorithmPrivate_h 00035 00036 #include "vtkStdString.h" 00037 00038 #include <vtkstd/set> // used to iterate over internal organs 00039 00040 class vtkStatisticsAlgorithmPrivate 00041 { 00042 public: 00043 vtkStatisticsAlgorithmPrivate() 00044 { 00045 } 00046 ~vtkStatisticsAlgorithmPrivate() 00047 { 00048 } 00049 void SetBufferColumnStatus( const char* colName, int status ) 00050 { 00051 if ( status ) 00052 { 00053 this->Buffer.insert( colName ); 00054 } 00055 else 00056 { 00057 this->Buffer.erase( colName ); 00058 } 00059 } 00060 int AddBufferToRequests() 00061 { 00062 bool result = false; 00063 // Don't add empty selections to the list of requests. 00064 if ( ! this->Buffer.empty() ) 00065 { 00066 result = this->Requests.insert( this->Buffer ).second; 00067 } 00068 return result ? 1 : 0; 00069 } 00070 int AddBufferEntriesToRequests() 00071 { 00072 int count = 0; 00073 vtkstd::set<vtkStdString>::iterator it; 00074 for ( it = this->Buffer.begin(); it != this->Buffer.end(); ++ it ) 00075 { 00076 vtkstd::set<vtkStdString> tmp; 00077 tmp.insert( *it ); 00078 if ( this->Requests.insert( tmp ).second ) 00079 { 00080 ++ count; 00081 } 00082 } 00083 return count; 00084 } 00085 int AddBufferEntryPairsToRequests() 00086 { 00087 int count = 0; 00088 vtkstd::pair<vtkstd::set<vtkstd::set<vtkStdString> >::iterator,bool> result; 00089 vtkstd::set<vtkStdString>::iterator it; 00090 for ( it = this->Buffer.begin(); it != this->Buffer.end(); ++ it ) 00091 { 00092 vtkstd::set<vtkStdString>::iterator it2 = it; 00093 for ( ++ it2; it2 != this->Buffer.end(); ++ it2 ) 00094 { 00095 vtkstd::set<vtkStdString> tmp; 00096 tmp.insert( *it ); 00097 tmp.insert( *it2 ); 00098 if ( this->Requests.insert( tmp ).second ) 00099 { 00100 ++ count; 00101 } 00102 } 00103 } 00104 return count; 00105 } 00106 void ResetRequests() 00107 { 00108 this->Requests.clear(); 00109 } 00110 void ResetBuffer() 00111 { 00112 this->Buffer.clear(); 00113 } 00114 00115 vtkstd::set<vtkstd::set<vtkStdString> > Requests; 00116 vtkstd::set<vtkStdString> Buffer; 00117 }; 00118 00119 #endif // __vtkStatisticsAlgorithmPrivate_h 00120