VTK
dox/Infovis/Core/vtkStringToNumeric.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkStringToNumeric.h
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 -------------------------------------------------------------------------*/
00034 #ifndef __vtkStringToNumeric_h
00035 #define __vtkStringToNumeric_h
00036 
00037 #include "vtkInfovisCoreModule.h" // For export macro
00038 #include "vtkDataObjectAlgorithm.h"
00039 
00040 class VTKINFOVISCORE_EXPORT vtkStringToNumeric : public vtkDataObjectAlgorithm
00041 {
00042 public:
00043   static vtkStringToNumeric* New();
00044   vtkTypeMacro(vtkStringToNumeric,vtkDataObjectAlgorithm);
00045   void PrintSelf(ostream& os, vtkIndent indent);
00046 
00048 
00050   vtkSetMacro(ForceDouble, bool);
00051   vtkGetMacro(ForceDouble, bool);
00052   vtkBooleanMacro(ForceDouble, bool);
00054 
00056 
00057   vtkSetMacro(DefaultIntegerValue, int);
00058   vtkGetMacro(DefaultIntegerValue, int);
00060 
00062 
00063   vtkSetMacro(DefaultDoubleValue, double);
00064   vtkGetMacro(DefaultDoubleValue, double);
00066 
00068 
00077   vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
00078   vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
00079   vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
00081 
00083 
00084   vtkSetMacro(ConvertFieldData, bool);
00085   vtkGetMacro(ConvertFieldData, bool);
00086   vtkBooleanMacro(ConvertFieldData, bool);
00088 
00090 
00091   vtkSetMacro(ConvertPointData, bool);
00092   vtkGetMacro(ConvertPointData, bool);
00093   vtkBooleanMacro(ConvertPointData, bool);
00095 
00097 
00098   vtkSetMacro(ConvertCellData, bool);
00099   vtkGetMacro(ConvertCellData, bool);
00100   vtkBooleanMacro(ConvertCellData, bool);
00102 
00104 
00105   virtual void SetConvertVertexData(bool b)
00106     { this->SetConvertPointData(b); }
00107   virtual bool GetConvertVertexData()
00108     { return this->GetConvertPointData(); }
00109   vtkBooleanMacro(ConvertVertexData, bool);
00111 
00113 
00114   virtual void SetConvertEdgeData(bool b)
00115     { this->SetConvertCellData(b); }
00116   virtual bool GetConvertEdgeData()
00117     { return this->GetConvertCellData(); }
00118   vtkBooleanMacro(ConvertEdgeData, bool);
00120 
00122 
00123   virtual void SetConvertRowData(bool b)
00124     { this->SetConvertPointData(b); }
00125   virtual bool GetConvertRowData()
00126     { return this->GetConvertPointData(); }
00127   vtkBooleanMacro(ConvertRowData, bool);
00129 
00131 
00132   virtual int ProcessRequest(vtkInformation* request,
00133                              vtkInformationVector** inputVector,
00134                              vtkInformationVector* outputVector);
00136 
00137 protected:
00138   vtkStringToNumeric();
00139   ~vtkStringToNumeric();
00140 
00142 
00143   virtual int RequestDataObject(vtkInformation* request,
00144                                 vtkInformationVector** inputVector,
00145                                 vtkInformationVector* outputVector);
00147 
00149   void ConvertArrays(vtkFieldData* fieldData);
00150 
00151   bool ConvertFieldData;
00152   bool ConvertPointData;
00153   bool ConvertCellData;
00154   bool ForceDouble;
00155   int DefaultIntegerValue;
00156   double DefaultDoubleValue;
00157   bool TrimWhitespacePriorToNumericConversion;
00158 
00162   int CountItemsToConvert(vtkFieldData *fieldData);
00163 
00164   // These keep track of our progress
00165   int ItemsToConvert;
00166   int ItemsConverted;
00167 
00168   int RequestData(
00169     vtkInformation*,
00170     vtkInformationVector**,
00171     vtkInformationVector*);
00172 
00173 private:
00174   vtkStringToNumeric(const vtkStringToNumeric&); // Not implemented
00175   void operator=(const vtkStringToNumeric&);   // Not implemented
00176 };
00177 
00178 #endif
00179