vtkSMReaderFactory.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
23 #ifndef vtkSMReaderFactory_h
24 #define vtkSMReaderFactory_h
25 
26 #include "vtkRemotingServerManagerModule.h" //needed for exports
27 #include "vtkSMObject.h"
28 
29 #include <string>
30 #include <vector>
31 
32 class vtkStringList;
33 class vtkPVXMLElement;
34 class vtkSMProxy;
35 class vtkSMSession;
36 
38 {
39  std::string Description;
40  std::vector<std::string> FilenamePatterns = {};
41  std::string Group;
42  std::string Name;
43 };
44 
46 {
47 public:
48  static vtkSMReaderFactory* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void Initialize();
56 
61  void RegisterPrototype(const char* xmlgroup, const char* xmlname);
62 
70  bool CanReadFile(const char* filename, vtkSMSession* session);
71 
73 
78  vtkGetStringMacro(ReaderName);
80 
82 
87  vtkGetStringMacro(ReaderGroup);
89 
98  vtkStringList* GetPossibleReaders(const char* filename, vtkSMSession* session);
99 
105  vtkStringList* GetReaders(vtkSMSession* session);
106 
113  vtkStringList* GetReaders(const char* filename, vtkSMSession* session);
114 
120  static bool TestFileReadability(const char* filename, vtkSMSession* session);
121 
130  virtual const char* GetSupportedFileTypes(vtkSMSession* session);
131 
138  virtual std::vector<FileTypeDetailed> GetSupportedFileTypesDetailed(vtkSMSession* session);
139 
141 
147  static bool CanReadFile(const char* filename, vtkSMProxy* reader);
148  static bool CanReadFile(const char* filename, const char* readerxmlgroup,
149  const char* readerxmlname, vtkSMSession* session);
151 
155  unsigned int GetNumberOfRegisteredPrototypes();
156 
161  virtual void UpdateAvailableReaders();
162 
164 
167  void AddGroup(const char* groupName);
168  void RemoveGroup(const char* groupName);
169  void GetGroups(vtkStringList* groups);
171 
182  static void AddReaderToWhitelist(const char* readerxmlgroup, const char* readerxmlname);
183 
187  static const std::string SUPPORTED_TYPES_DESCRIPTION;
188 
192  static const std::string ALL_FILES_DESCRIPTION;
193 
194 protected:
196  ~vtkSMReaderFactory() override;
197 
198  // To support legacy configuration files.
199  void RegisterPrototype(
200  const char* xmlgroup, const char* xmlname, const char* extensions, const char* description);
201 
205  static bool GetFilenameIsDirectory(const char* fname, vtkSMSession* session);
206 
207  vtkSetStringMacro(ReaderName);
208  vtkSetStringMacro(ReaderGroup);
209 
210  char* ReaderName;
211  char* ReaderGroup;
213 
214 private:
215  vtkSMReaderFactory(const vtkSMReaderFactory&) = delete;
216  void operator=(const vtkSMReaderFactory&) = delete;
217 
218  class vtkInternals;
219  vtkInternals* Internals;
220 };
221 
222 #endif
static const std::string SUPPORTED_TYPES_DESCRIPTION
Description of the file type used for all supported types.
#define VTKREMOTINGSERVERMANAGER_EXPORT
vtkSMSession is the default ParaView session.
Definition: vtkSMSession.h:22
is a factory for creating a reader proxy based on the filename/extension.
static const std::string ALL_FILES_DESCRIPTION
Description of the file type used for all files.
std::string Description
superclass for most server manager classes
Definition: vtkSMObject.h:17
vtkStringList * Readers
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
std::vector< std::string > FilenamePatterns
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
Manages allocation and freeing for a string list.
Definition: vtkStringList.h:18