Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
vtkSMReaderFactory Class Reference

is a factory for creating a reader proxy based on the filename/extension. More...

#include <vtkSMReaderFactory.h>

Inheritance diagram for vtkSMReaderFactory:
Inheritance graph
[legend]
Collaboration diagram for vtkSMReaderFactory:
Collaboration graph
[legend]

Public Types

typedef vtkSMObject Superclass
 
- Public Types inherited from vtkSMObject
typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
void Initialize ()
 Cleanup all registered prototypes. More...
 
void RegisterPrototype (const char *xmlgroup, const char *xmlname)
 Register a prototype. More...
 
bool CanReadFile (const char *filename, vtkSMSession *session)
 Returns true if a reader can be determined that can read the file. More...
 
vtkStringListGetPossibleReaders (const char *filename, vtkSMSession *session)
 Get the list of readers that can possibly read the file. More...
 
vtkStringListGetReaders (vtkSMSession *session)
 Returns a list of 3-tuples where the 1st string is the group, the 2nd string is the reader name and the 3rd string is the reader description This returns all the possible readers with a given connection id. More...
 
vtkStringListGetReaders (const char *filename, vtkSMSession *session)
 Returls list of readers that can read the file using its extension and connection id. More...
 
virtual const char * GetSupportedFileTypes (vtkSMSession *session)
 Returns a formatted string with all supported file types. More...
 
virtual std::vector< FileTypeDetailedGetSupportedFileTypesDetailed (vtkSMSession *session)
 Returns the list of supported file types with details on the corresponding readers and its supported patterns. More...
 
unsigned int GetNumberOfRegisteredPrototypes ()
 Returns the number of registered prototypes. More...
 
virtual void UpdateAvailableReaders ()
 Every time a new proxy definition is added we check to see if it is a reader and then we add it to the list of available readers. More...
 
virtual char * GetReaderName ()
 Returns the xml-name for the reader that can read the file queried by the most recent CanReadFile() call. More...
 
virtual char * GetReaderGroup ()
 Returns the xml-group for the reader that can read the file queried by the most recent CanReadFile() call. More...
 
void AddGroup (const char *groupName)
 Add/remove a group name to look for readers in. More...
 
void RemoveGroup (const char *groupName)
 Add/remove a group name to look for readers in. More...
 
void GetGroups (vtkStringList *groups)
 Add/remove a group name to look for readers in. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual vtkMTimeType GetMTime ()
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void Print (ostream &os)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
void SetReferenceCount (int)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
int GetReferenceCount ()
 
void PrintRevisions (ostream &)
 

Static Public Member Functions

static vtkSMReaderFactoryNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSMReaderFactorySafeDownCast (vtkObject *o)
 
static bool TestFileReadability (const char *filename, vtkSMSession *session)
 Helper method to test is a file is readable on the server side. More...
 
static void AddReaderToWhitelist (const char *readerxmlgroup, const char *readerxmlname)
 This function is for ParaView based applications that only wish to expose a subset of the readers. More...
 
static bool CanReadFile (const char *filename, vtkSMProxy *reader)
 Helper method to check if the reader can read the given file. More...
 
static bool CanReadFile (const char *filename, const char *readerxmlgroup, const char *readerxmlname, vtkSMSession *session)
 Helper method to check if the reader can read the given file. More...
 
- Static Public Member Functions inherited from vtkSMObject
static vtkSMObjectNew ()
 
static int IsTypeOf (const char *type)
 
static vtkSMObjectSafeDownCast (vtkObject *o)
 
static std::string CreatePrettyLabel (const std::string &name)
 Return a well-formated label using provided name by adding spaces between lower cases and upper cases: More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 
static vtkObjectBaseNew ()
 

Static Public Attributes

static const std::string SUPPORTED_TYPES_DESCRIPTION
 Description of the file type used for all supported types. More...
 
static const std::string ALL_FILES_DESCRIPTION
 Description of the file type used for all files. More...
 

Protected Member Functions

 vtkSMReaderFactory ()
 
 ~vtkSMReaderFactory () override
 
void RegisterPrototype (const char *xmlgroup, const char *xmlname, const char *extensions, const char *description)
 
virtual void SetReaderName (const char *)
 
virtual void SetReaderGroup (const char *)
 
- Protected Member Functions inherited from vtkSMObject
 vtkSMObject ()
 
 ~vtkSMObject () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
virtual ~vtkObject ()
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Static Protected Member Functions

static bool GetFilenameIsDirectory (const char *fname, vtkSMSession *session)
 Returns true if the fname refers to a directory or a link to a directory. More...
 

Protected Attributes

char * ReaderName
 
char * ReaderGroup
 
vtkStringListReaders
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

is a factory for creating a reader proxy based on the filename/extension.

vtkSMReaderFactory is a factory for creating a reader that reads a particular file. The reader factory needs to be configured to register the reader prototypes supported by the application. This is done automatically when the reader's proxy definition is registered AND if it has the extensions specified in the Hints section of the XML proxy definition. It is done with the following format:

* <ReaderFactory extensions="[list of expected extensions]"
*     file_description="[description of the file]" />
* 

Once the factory has been configured, the API to create readers, get available readers etc. can be used.

Definition at line 45 of file vtkSMReaderFactory.h.

Member Typedef Documentation

◆ Superclass

Definition at line 49 of file vtkSMReaderFactory.h.

Constructor & Destructor Documentation

◆ vtkSMReaderFactory()

vtkSMReaderFactory::vtkSMReaderFactory ( )
protected

◆ ~vtkSMReaderFactory()

vtkSMReaderFactory::~vtkSMReaderFactory ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkSMReaderFactory* vtkSMReaderFactory::New ( )
static

◆ GetClassName()

virtual const char* vtkSMReaderFactory::GetClassName ( )
virtual

Reimplemented from vtkSMObject.

◆ IsTypeOf()

static int vtkSMReaderFactory::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual int vtkSMReaderFactory::IsA ( const char *  type)
virtual

Reimplemented from vtkSMObject.

◆ SafeDownCast()

static vtkSMReaderFactory* vtkSMReaderFactory::SafeDownCast ( vtkObject o)
static

◆ PrintSelf()

void vtkSMReaderFactory::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Reimplemented from vtkSMObject.

◆ Initialize()

void vtkSMReaderFactory::Initialize ( )

Cleanup all registered prototypes.

◆ RegisterPrototype() [1/2]

void vtkSMReaderFactory::RegisterPrototype ( const char *  xmlgroup,
const char *  xmlname 
)

Register a prototype.

If it is already registered this becomes a no-op.

◆ CanReadFile() [1/3]

bool vtkSMReaderFactory::CanReadFile ( const char *  filename,
vtkSMSession session 
)

Returns true if a reader can be determined that can read the file.

When this returns true, one can use GetReaderGroup() and GetReaderName() to obtain the xmlgroup and xmlname for the reader that can read the file. When this returns false, use GetPossibleReaders() to get the list of readers that can possibly read the file.

◆ GetReaderName()

virtual char* vtkSMReaderFactory::GetReaderName ( )
virtual

Returns the xml-name for the reader that can read the file queried by the most recent CanReadFile() call.

This is valid only if CanReadFile() returned true.

◆ GetReaderGroup()

virtual char* vtkSMReaderFactory::GetReaderGroup ( )
virtual

Returns the xml-group for the reader that can read the file queried by the most recent CanReadFile() call.

This is valid only if CanReadFile() returned true.

◆ GetPossibleReaders()

vtkStringList* vtkSMReaderFactory::GetPossibleReaders ( const char *  filename,
vtkSMSession session 
)

Get the list of readers that can possibly read the file.

This is used when the factory cannot determine which reader to use for reading the file. The user can then choose from the provided options. Returns a list of 3-tuples where the 1st string is the group, the 2nd string is the reader name and the 3rd string is the reader description Note that the extension test is skipped in this case.

◆ GetReaders() [1/2]

vtkStringList* vtkSMReaderFactory::GetReaders ( vtkSMSession session)

Returns a list of 3-tuples where the 1st string is the group, the 2nd string is the reader name and the 3rd string is the reader description This returns all the possible readers with a given connection id.

◆ GetReaders() [2/2]

vtkStringList* vtkSMReaderFactory::GetReaders ( const char *  filename,
vtkSMSession session 
)

Returls list of readers that can read the file using its extension and connection id.

Returns a list of 3-tuples where the 1st string is the group, the 2nd string is the reader name and the 3rd string is the reader description

◆ TestFileReadability()

static bool vtkSMReaderFactory::TestFileReadability ( const char *  filename,
vtkSMSession session 
)
static

Helper method to test is a file is readable on the server side.

This has nothing to do with the whether the file is readable by a reader, just test the file permissions etc. Internally uses the ServerFileListing proxy.

◆ GetSupportedFileTypes()

virtual const char* vtkSMReaderFactory::GetSupportedFileTypes ( vtkSMSession session)
virtual

Returns a formatted string with all supported file types.

cid is not used currently. An example returned string would look like:

* "Supported Files (*.vtk *.pvd);;PVD Files (*.pvd);;VTK Files (*.vtk)"
* 

◆ GetSupportedFileTypesDetailed()

virtual std::vector<FileTypeDetailed> vtkSMReaderFactory::GetSupportedFileTypesDetailed ( vtkSMSession session)
virtual

Returns the list of supported file types with details on the corresponding readers and its supported patterns.

The two first values of this vector are Supported Type and All Files to simplify its use with the pqFileDialog. They do not have a name or group fields.

◆ CanReadFile() [2/3]

static bool vtkSMReaderFactory::CanReadFile ( const char *  filename,
vtkSMProxy reader 
)
static

Helper method to check if the reader can read the given file.

This is a generic method that simply tries to call CanReadFile() on the reader. If the reader des not support CanReadFile() then we assume the reader can read the file, and return true.

◆ CanReadFile() [3/3]

static bool vtkSMReaderFactory::CanReadFile ( const char *  filename,
const char *  readerxmlgroup,
const char *  readerxmlname,
vtkSMSession session 
)
static

Helper method to check if the reader can read the given file.

This is a generic method that simply tries to call CanReadFile() on the reader. If the reader des not support CanReadFile() then we assume the reader can read the file, and return true.

◆ GetNumberOfRegisteredPrototypes()

unsigned int vtkSMReaderFactory::GetNumberOfRegisteredPrototypes ( )

Returns the number of registered prototypes.

◆ UpdateAvailableReaders()

virtual void vtkSMReaderFactory::UpdateAvailableReaders ( )
virtual

Every time a new proxy definition is added we check to see if it is a reader and then we add it to the list of available readers.

◆ AddGroup()

void vtkSMReaderFactory::AddGroup ( const char *  groupName)

Add/remove a group name to look for readers in.

By default "source" is included.

◆ RemoveGroup()

void vtkSMReaderFactory::RemoveGroup ( const char *  groupName)

Add/remove a group name to look for readers in.

By default "source" is included.

◆ GetGroups()

void vtkSMReaderFactory::GetGroups ( vtkStringList groups)

Add/remove a group name to look for readers in.

By default "source" is included.

◆ AddReaderToWhitelist()

static void vtkSMReaderFactory::AddReaderToWhitelist ( const char *  readerxmlgroup,
const char *  readerxmlname 
)
static

This function is for ParaView based applications that only wish to expose a subset of the readers.

If this function is never called, the reader factory will expose all the readers as it has in the past. However, if any readers are specified by passing their group name and reader name to this function, then only those readers will be available in any reader factories created by the application. This is intended to be called at the beginning of the application's execution before any sessions are created.

◆ RegisterPrototype() [2/2]

void vtkSMReaderFactory::RegisterPrototype ( const char *  xmlgroup,
const char *  xmlname,
const char *  extensions,
const char *  description 
)
protected

◆ GetFilenameIsDirectory()

static bool vtkSMReaderFactory::GetFilenameIsDirectory ( const char *  fname,
vtkSMSession session 
)
staticprotected

Returns true if the fname refers to a directory or a link to a directory.

◆ SetReaderName()

virtual void vtkSMReaderFactory::SetReaderName ( const char *  )
protectedvirtual

◆ SetReaderGroup()

virtual void vtkSMReaderFactory::SetReaderGroup ( const char *  )
protectedvirtual

Member Data Documentation

◆ SUPPORTED_TYPES_DESCRIPTION

const std::string vtkSMReaderFactory::SUPPORTED_TYPES_DESCRIPTION
static

Description of the file type used for all supported types.

Definition at line 187 of file vtkSMReaderFactory.h.

◆ ALL_FILES_DESCRIPTION

const std::string vtkSMReaderFactory::ALL_FILES_DESCRIPTION
static

Description of the file type used for all files.

Definition at line 192 of file vtkSMReaderFactory.h.

◆ ReaderName

char* vtkSMReaderFactory::ReaderName
protected

Definition at line 208 of file vtkSMReaderFactory.h.

◆ ReaderGroup

char* vtkSMReaderFactory::ReaderGroup
protected

Definition at line 211 of file vtkSMReaderFactory.h.

◆ Readers

vtkStringList* vtkSMReaderFactory::Readers
protected

Definition at line 212 of file vtkSMReaderFactory.h.


The documentation for this class was generated from the following file: