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 =========================================================================*/
00079 #ifndef __vtkProcessObject_h
00080 #define __vtkProcessObject_h
00081 
00082 #include "vtkDataObject.h"
00083 
00084 class VTK_COMMON_EXPORT vtkProcessObject : public vtkObject
00085 {
00086 public:
00088   static vtkProcessObject *New();
00089 
00090   vtkTypeMacro(vtkProcessObject,vtkObject);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00094   void SetStartMethod(void (*f)(void *), void *arg);
00095 
00097   void SetProgressMethod(void (*f)(void *), void *arg);
00098 
00100   void SetEndMethod(void (*f)(void *), void *arg);
00101 
00103   void SetStartMethodArgDelete(void (*f)(void *));
00104 
00106   void SetProgressMethodArgDelete(void (*f)(void *));
00107 
00109   void SetEndMethodArgDelete(void (*f)(void *));
00110 
00112 
00114   vtkSetMacro(AbortExecute,int);
00115   vtkGetMacro(AbortExecute,int);
00116   vtkBooleanMacro(AbortExecute,int);
00118 
00120 
00121   vtkSetClampMacro(Progress,float,0.0,1.0);
00122   vtkGetMacro(Progress,float);
00124 
00128   void UpdateProgress(float amount);
00129 
00131 
00133   vtkSetStringMacro(ProgressText);
00134   vtkGetStringMacro(ProgressText);
00136 
00137   // left public for performance since it is used in inner loops
00138   int AbortExecute;
00139 
00141 
00143   vtkDataObject **GetInputs() {return this->Inputs;}
00144   vtkGetMacro(NumberOfInputs,int);
00146 
00149   void SqueezeInputArray();
00150   
00152   void RemoveAllInputs();
00153 
00154 protected:
00155   vtkProcessObject();
00156   ~vtkProcessObject();
00157 
00158   // Progress/Update handling
00159   unsigned long StartTag;
00160   unsigned long ProgressTag;
00161   unsigned long EndTag;
00162   float Progress;
00163   char  *ProgressText;
00164 
00165   int NumberOfInputs;
00166   int NumberOfRequiredInputs;
00167   vtkDataObject **Inputs;     //An array of the inputs to the filter
00168   // Temporary arrays used internally.  
00169   // It is only valid after SortInputsByLocality is called.
00170   vtkDataObject **SortedInputs;   // Inputs sorted by locality
00171   // We need a second array for an effficeint search.  
00172   // This array is never valid.
00173   vtkDataObject **SortedInputs2;   
00174   void SortInputsByLocality();
00175   // A helper method for quicksort.
00176   void SortMerge(vtkDataObject **a1, int l1,
00177                  vtkDataObject **a2, int l2,
00178                  vtkDataObject **results);
00179 
00180   // Called to allocate the input array.  Copies old inputs.
00181   void SetNumberOfInputs(int num);
00182 
00183   // protected methods for setting inputs.
00184   virtual void SetNthInput(int num, vtkDataObject *input);
00185   virtual void AddInput(vtkDataObject *input);
00186   virtual void RemoveInput(vtkDataObject *input);
00187   
00188 private:
00189   vtkProcessObject(const vtkProcessObject&);  // Not implemented.
00190   void operator=(const vtkProcessObject&);  // Not implemented.
00191 };
00192 
00193 #endif
00194 

Generated on Thu Mar 28 14:19:16 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001