Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Plugins / TableReader / plugin / TableReaderModule / vtkVisuTableReader.h
1 // Copyright (C) 2010-2022  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __vtkVisuTableReader_h_
21 #define __vtkVisuTableReader_h_
22
23 #include <vtkTableAlgorithm.h>
24
25 class vtkStringArray;
26
27 class VTK_EXPORT vtkVisuTableReader : public vtkTableAlgorithm
28 {
29 public:
30   static vtkVisuTableReader* New();
31   vtkTypeMacro(vtkVisuTableReader, vtkTableAlgorithm);
32   void PrintSelf(ostream& os, vtkIndent indent) override;
33
34   // Description:
35   // Specifies the name of the file
36   vtkGetStringMacro(FileName);
37   vtkSetStringMacro(FileName);
38
39   // Description:
40   // When set to true, the reader will detect numeric columns and create
41   // vtkDoubleArray or vtkIntArray for those instead of vtkStringArray.
42   vtkSetMacro(DetectNumericColumns, bool);
43   vtkGetMacro(DetectNumericColumns, bool);
44   vtkBooleanMacro(DetectNumericColumns, bool);
45
46   // Description:
47   // When set to true, the reader will interpret the first string as
48   // column titles.
49   vtkSetMacro(FirstStringAsTitles, bool);
50   vtkGetMacro(FirstStringAsTitles, bool);
51   vtkBooleanMacro(FirstStringAsTitles, bool);
52
53   // Description:
54   // Specifies the number of the table
55   vtkSetMacro(TableNumber, int);
56   vtkGetMacro(TableNumber, int);
57
58   // Description:
59   // Specifies string that will be used to separate values
60   vtkSetStringMacro(ValueDelimiter);
61   vtkGetStringMacro(ValueDelimiter);
62
63   // Description:
64   // Determine whether the given file can be read
65   virtual int CanReadFile(const char* fname);
66
67   // Description:
68   // Returns the available table names.
69   virtual vtkStringArray* GetAvailableTables();
70
71 protected:
72   vtkVisuTableReader();
73   ~vtkVisuTableReader() override;
74
75   // Description:
76   // This is called by the superclass.
77   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
78
79   // name of the file to read from
80   char* FileName;
81
82   // defines whether to detect numeric columns
83   bool DetectNumericColumns;
84
85   // defines whether to treat first string as column titles
86   bool FirstStringAsTitles;
87
88   // number of the table to read
89   int TableNumber;
90
91   // string that will be used to separate values
92   char* ValueDelimiter;
93
94   // Available table names
95   vtkStringArray* AvailableTables;
96
97 private:
98   vtkVisuTableReader(const vtkVisuTableReader&) = delete;
99   void operator=(const vtkVisuTableReader&) = delete;
100 };
101
102 #endif //__vtkVisuTableReader_h_