Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

common/vtkProcessObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkProcessObject.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00075 #ifndef __vtkProcessObject_h
00076 #define __vtkProcessObject_h
00077 
00078 #include "vtkDataObject.h"
00079 
00080 class VTK_EXPORT vtkProcessObject : public vtkObject
00081 {
00082 public:
00084   static vtkProcessObject *New();
00085 
00086   vtkTypeMacro(vtkProcessObject,vtkObject);
00087   void PrintSelf(ostream& os, vtkIndent indent);
00088 
00090   void SetStartMethod(void (*f)(void *), void *arg);
00091 
00093   void SetProgressMethod(void (*f)(void *), void *arg);
00094 
00096   void SetEndMethod(void (*f)(void *), void *arg);
00097 
00099   void SetStartMethodArgDelete(void (*f)(void *));
00100 
00102   void SetProgressMethodArgDelete(void (*f)(void *));
00103 
00105   void SetEndMethodArgDelete(void (*f)(void *));
00106 
00109   vtkSetMacro(AbortExecute,int);
00110   vtkGetMacro(AbortExecute,int);
00111   vtkBooleanMacro(AbortExecute,int);
00112 
00114   vtkSetClampMacro(Progress,float,0.0,1.0);
00115   vtkGetMacro(Progress,float);
00116 
00120   void UpdateProgress(float amount);
00121 
00124   vtkSetStringMacro(ProgressText);
00125   vtkGetStringMacro(ProgressText);
00126 
00127   // left public for performance since it is used in inner loops
00128   int AbortExecute;
00129 
00132   vtkDataObject **GetInputs() {return this->Inputs;}
00133   vtkGetMacro(NumberOfInputs,int);
00134 
00137   void SqueezeInputArray();
00138   
00140   void RemoveAllInputs();
00141 
00142 protected:
00143   vtkProcessObject();
00144   ~vtkProcessObject();
00145   vtkProcessObject(const vtkProcessObject&) {};
00146   void operator=(const vtkProcessObject&) {};
00147 
00148   // Progress/Update handling
00149   unsigned long StartTag;
00150   unsigned long ProgressTag;
00151   unsigned long EndTag;
00152   float Progress;
00153   char  *ProgressText;
00154 
00155   int NumberOfInputs;
00156   int NumberOfRequiredInputs;
00157   vtkDataObject **Inputs;     //An array of the inputs to the filter
00158   // Temporary arrays used internally.  
00159   // It is only valid after SortInputsByLocality is called.
00160   vtkDataObject **SortedInputs;   // Inputs sorted by locality
00161   // We need a second array for an effficeint search.  
00162   // This array is never valid.
00163   vtkDataObject **SortedInputs2;   
00164   void SortInputsByLocality();
00165   // A helper method for quicksort.
00166   void SortMerge(vtkDataObject **a1, int l1,
00167                  vtkDataObject **a2, int l2,
00168                  vtkDataObject **results);
00169 
00170   // Called to allocate the input array.  Copies old inputs.
00171   void SetNumberOfInputs(int num);
00172 
00173   // protected methods for setting inputs.
00174   virtual void SetNthInput(int num, vtkDataObject *input);
00175   virtual void AddInput(vtkDataObject *input);
00176   virtual void RemoveInput(vtkDataObject *input);
00177   
00178 };
00179 
00180 #endif
00181 

Generated on Wed Nov 21 12:26:53 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001