vtkPVPythonInformation.h 4.79 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*=========================================================================

  Program:   ParaView
  Module:    vtkPVPythonInformation.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18
/**
 * @class   vtkPVPythonInformation
 * @brief   Gets python features.
 *
luz paz's avatar
luz paz committed
19
 * Get details of python availability on the root server.
20
*/
21

22 23
#ifndef vtkPVPythonInformation_h
#define vtkPVPythonInformation_h
24 25 26 27

#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
#include "vtkPVInformation.h"

David C. Lonie's avatar
David C. Lonie committed
28
#include <string> // for string type
29 30 31

class vtkClientServerStream;

Kitware Robot's avatar
Kitware Robot committed
32
class VTKPVCLIENTSERVERCORECORE_EXPORT vtkPVPythonInformation : public vtkPVInformation
33 34 35 36
{
public:
  static vtkPVPythonInformation* New();
  vtkTypeMacro(vtkPVPythonInformation, vtkPVInformation);
Cory Quammen's avatar
Cory Quammen committed
37
  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
38

Kitware Robot's avatar
Kitware Robot committed
39
  void DeepCopy(vtkPVPythonInformation* info);
40

41 42 43
  /**
   * Transfer information about a single object into this object.
   */
44
  void CopyFromObject(vtkObject*) VTK_OVERRIDE;
45

46 47 48
  /**
   * Same as DeepCopy for this object.
   */
49
  void AddInformation(vtkPVInformation*) VTK_OVERRIDE;
50

51 52 53 54
  //@{
  /**
   * Manage a serialized version of the information.
   */
55 56
  void CopyToStream(vtkClientServerStream*) VTK_OVERRIDE;
  void CopyFromStream(const vtkClientServerStream*) VTK_OVERRIDE;
57
  //@}
58

59 60 61 62
  //@{
  /**
   * Whether the server was compiled with python support.
   */
Kitware Robot's avatar
Kitware Robot committed
63 64 65 66 67 68 69 70 71 72
  vtkSetMacro(PythonSupport, bool) vtkGetMacro(PythonSupport, bool)
    vtkBooleanMacro(PythonSupport, bool)
    //@}

    //@{
    /**
     * If GetPythonSupport() is true, returns the version of python detected on
     * the server.
     */
    void SetPythonVersion(const std::string& arg)
73 74
  {
    if (arg != this->PythonVersion)
Kitware Robot's avatar
Kitware Robot committed
75
    {
76 77
      this->PythonVersion = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
78
    }
79
  }
Kitware Robot's avatar
Kitware Robot committed
80
  const std::string& GetPythonVersion() { return this->PythonVersion; }
81
  //@}
82

83 84 85 86 87
  //@{
  /**
   * If GetPythonSupport() is true, returns the path to the python libraries
   * detected on the server.
   */
Kitware Robot's avatar
Kitware Robot committed
88
  void SetPythonPath(const std::string& arg)
89 90
  {
    if (arg != this->PythonPath)
Kitware Robot's avatar
Kitware Robot committed
91
    {
92 93
      this->PythonPath = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
94
    }
95
  }
Kitware Robot's avatar
Kitware Robot committed
96
  const std::string& GetPythonPath() { return this->PythonPath; }
97
  //@}
98

99 100 101 102
  //@{
  /**
   * Whether the numpy module is available on the server.
   */
Kitware Robot's avatar
Kitware Robot committed
103 104 105 106 107 108 109 110 111 112
  vtkSetMacro(NumpySupport, bool) vtkGetMacro(NumpySupport, bool)
    vtkBooleanMacro(NumpySupport, bool)
    //@}

    //@{
    /**
     * If GetNumpySupport() is true, returns the version of numpy detected on the
     * server.
     */
    void SetNumpyVersion(const std::string& arg)
113 114
  {
    if (arg != this->NumpyVersion)
Kitware Robot's avatar
Kitware Robot committed
115
    {
116 117
      this->NumpyVersion = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
118
    }
119
  }
Kitware Robot's avatar
Kitware Robot committed
120
  const std::string& GetNumpyVersion() { return this->NumpyVersion; }
121
  //@}
122

123 124 125 126 127
  //@{
  /**
   * If GetNumpySupport() is true, returns the path to numpy detected on the
   * server.
   */
Kitware Robot's avatar
Kitware Robot committed
128
  void SetNumpyPath(const std::string& arg)
129 130
  {
    if (arg != this->NumpyPath)
Kitware Robot's avatar
Kitware Robot committed
131
    {
132 133
      this->NumpyPath = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
134
    }
135
  }
Kitware Robot's avatar
Kitware Robot committed
136
  const std::string& GetNumpyPath() { return this->NumpyPath; }
137
  //@}
138

139 140 141 142
  //@{
  /**
   * Whether the matplotlib module is available on the server.
   */
Kitware Robot's avatar
Kitware Robot committed
143 144 145 146 147 148 149 150 151 152
  vtkSetMacro(MatplotlibSupport, bool) vtkGetMacro(MatplotlibSupport, bool)
    vtkBooleanMacro(MatplotlibSupport, bool)
    //@}

    //@{
    /**
     * If GetMatplotlibSupport() is true, returns the version of matplotlib
     * detected on the server.
     */
    void SetMatplotlibVersion(const std::string& arg)
153 154
  {
    if (arg != this->MatplotlibVersion)
Kitware Robot's avatar
Kitware Robot committed
155
    {
156 157
      this->MatplotlibVersion = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
158
    }
159
  }
Kitware Robot's avatar
Kitware Robot committed
160
  const std::string& GetMatplotlibVersion() { return this->MatplotlibVersion; }
161
  //@}
162

163 164 165 166 167
  //@{
  /**
   * If GetMatplotlibSupport() is true, returns the path to matplotlib detected
   * on the server.
   */
Kitware Robot's avatar
Kitware Robot committed
168
  void SetMatplotlibPath(const std::string& arg)
169 170
  {
    if (arg != this->MatplotlibPath)
Kitware Robot's avatar
Kitware Robot committed
171
    {
172 173
      this->MatplotlibPath = arg;
      this->Modified();
Kitware Robot's avatar
Kitware Robot committed
174
    }
175
  }
Kitware Robot's avatar
Kitware Robot committed
176
  const std::string& GetMatplotlibPath() { return this->MatplotlibPath; }
177
  //@}
178 179 180

protected:
  vtkPVPythonInformation();
181
  ~vtkPVPythonInformation() override;
182 183 184 185 186 187 188 189 190 191 192 193

  bool PythonSupport;
  std::string PythonPath;
  std::string PythonVersion;
  bool NumpySupport;
  std::string NumpyVersion;
  std::string NumpyPath;
  bool MatplotlibSupport;
  std::string MatplotlibVersion;
  std::string MatplotlibPath;

private:
194 195
  vtkPVPythonInformation(const vtkPVPythonInformation&) = delete;
  void operator=(const vtkPVPythonInformation&) = delete;
196 197 198
};

#endif