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

exporter used by certain views to export data as a CSV file. More...

#include <vtkCSVExporter.h>

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

Public Types

enum  ExporterModes { STREAM_ROWS, STREAM_COLUMNS }
 
typedef vtkObject Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
bool Open (ExporterModes mode=STREAM_ROWS)
 Open the file and set mode in which the exporter is operating. More...
 
void Close ()
 Closes the file cleanly. More...
 
void Abort ()
 Same as Close except deletes the file, if created. More...
 
void AddColumn (vtkAbstractArray *yarray, const char *yarrayname=NULL, vtkDataArray *xarray=NULL)
 In STREAM_COLUMNS mode, use this method to add a column (yarray). More...
 
std::string GetOutputString ()
 Get the exported data as string. More...
 
virtual void SetFileName (const char *)
 Get/Set the filename for the file. More...
 
virtual char * GetFileName ()
 Get/Set the filename for the file. More...
 
virtual void SetFieldDelimiter (const char *)
 Get/Set the delimiter use to separate fields ("," by default.) More...
 
virtual char * GetFieldDelimiter ()
 Get/Set the delimiter use to separate fields ("," by default.) More...
 
void SetColumnLabel (const char *name, const char *label)
 In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More...
 
void ClearColumnLabels ()
 In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More...
 
const char * GetColumnLabel (const char *name)
 In STREAM_ROWS mode, this API can be used to change columns labels when exporting. More...
 
void WriteHeader (vtkFieldData *)
 In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows. More...
 
void WriteData (vtkFieldData *)
 In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows. More...
 
virtual void SetWriteToOutputString (bool)
 Whether to output to a string instead of to a file, which is the default. More...
 
virtual bool GetWriteToOutputString ()
 Whether to output to a string instead of to a file, which is the default. More...
 
virtual void WriteToOutputStringOn ()
 Whether to output to a string instead of to a file, which is the default. More...
 
virtual void WriteToOutputStringOff ()
 Whether to output to a string instead of to a file, which is the default. 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 vtkCSVExporterNew ()
 
static int IsTypeOf (const char *type)
 
static vtkCSVExporterSafeDownCast (vtkObject *o)
 
- 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 ()
 

Protected Member Functions

 vtkCSVExporter ()
 
 ~vtkCSVExporter () 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 &)
 

Protected Attributes

char * FileName
 
char * FieldDelimiter
 
std::ostream * OutputStream
 
ExporterModes Mode
 
bool WriteToOutputString
 
std::string OutputString
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

exporter used by certain views to export data as a CSV file.

This is used by vtkSMCSVExporterProxy to export the data shown in the spreadsheet view or chart views as a CSV. The reason this class simply doesn't use a vtkCSVWriter is that vtkCSVWriter is designed to write out a single vtkTable as CSV. For exporting data from views, generating this single vtkTable that can be exported is often time consuming or memory consuming or both. Having a special exporter helps us with that. It provides two sets of APIs:

One has to pick which mode the exporter is operating in during the OpenFile() call.

Definition at line 51 of file vtkCSVExporter.h.

Member Typedef Documentation

◆ Superclass

Definition at line 55 of file vtkCSVExporter.h.

Member Enumeration Documentation

◆ ExporterModes

Enumerator
STREAM_ROWS 
STREAM_COLUMNS 

Definition at line 74 of file vtkCSVExporter.h.

Constructor & Destructor Documentation

◆ vtkCSVExporter()

vtkCSVExporter::vtkCSVExporter ( )
protected

◆ ~vtkCSVExporter()

vtkCSVExporter::~vtkCSVExporter ( )
overrideprotected

Member Function Documentation

◆ New()

static vtkCSVExporter* vtkCSVExporter::New ( )
static

◆ GetClassName()

virtual const char* vtkCSVExporter::GetClassName ( )
virtual

◆ IsTypeOf()

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

◆ IsA()

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

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

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

◆ PrintSelf()

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

Reimplemented from vtkObject.

◆ SetFileName()

virtual void vtkCSVExporter::SetFileName ( const char *  )
virtual

Get/Set the filename for the file.

◆ GetFileName()

virtual char* vtkCSVExporter::GetFileName ( )
virtual

Get/Set the filename for the file.

◆ SetFieldDelimiter()

virtual void vtkCSVExporter::SetFieldDelimiter ( const char *  )
virtual

Get/Set the delimiter use to separate fields ("," by default.)

◆ GetFieldDelimiter()

virtual char* vtkCSVExporter::GetFieldDelimiter ( )
virtual

Get/Set the delimiter use to separate fields ("," by default.)

◆ SetColumnLabel()

void vtkCSVExporter::SetColumnLabel ( const char *  name,
const char *  label 
)

In STREAM_ROWS mode, this API can be used to change columns labels when exporting.

◆ ClearColumnLabels()

void vtkCSVExporter::ClearColumnLabels ( )

In STREAM_ROWS mode, this API can be used to change columns labels when exporting.

◆ GetColumnLabel()

const char* vtkCSVExporter::GetColumnLabel ( const char *  name)

In STREAM_ROWS mode, this API can be used to change columns labels when exporting.

◆ Open()

bool vtkCSVExporter::Open ( ExporterModes  mode = STREAM_ROWS)

Open the file and set mode in which the exporter is operating.

◆ Close()

void vtkCSVExporter::Close ( )

Closes the file cleanly.

Call this at the end to close the file and dump out any cached data.

◆ Abort()

void vtkCSVExporter::Abort ( )

Same as Close except deletes the file, if created.

This is useful to interrupt the exporting on failure.

◆ WriteHeader()

void vtkCSVExporter::WriteHeader ( vtkFieldData )

In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows.

◆ WriteData()

void vtkCSVExporter::WriteData ( vtkFieldData )

In STREAM_ROWS mode, use these methods to write column headers once using WriteHeader and then use WriteData as many times as needed to write out rows.

◆ AddColumn()

void vtkCSVExporter::AddColumn ( vtkAbstractArray yarray,
const char *  yarrayname = NULL,
vtkDataArray xarray = NULL 
)

In STREAM_COLUMNS mode, use this method to add a column (yarray).

One can assign it a name different the the name of the array using yarrayname. If xarray is not NULL, then is used as the row-id. This makes it possible to add multiple columns with varying number of samples. The final output will have empty cells for missing values.

◆ SetWriteToOutputString()

virtual void vtkCSVExporter::SetWriteToOutputString ( bool  )
virtual

Whether to output to a string instead of to a file, which is the default.

◆ GetWriteToOutputString()

virtual bool vtkCSVExporter::GetWriteToOutputString ( )
virtual

Whether to output to a string instead of to a file, which is the default.

◆ WriteToOutputStringOn()

virtual void vtkCSVExporter::WriteToOutputStringOn ( )
virtual

Whether to output to a string instead of to a file, which is the default.

◆ WriteToOutputStringOff()

virtual void vtkCSVExporter::WriteToOutputStringOff ( )
virtual

Whether to output to a string instead of to a file, which is the default.

◆ GetOutputString()

std::string vtkCSVExporter::GetOutputString ( )

Get the exported data as string.

If WriteToOutputString is OFF, returned string is empty. If Close() was not called, returned string is empty.

Member Data Documentation

◆ FileName

char* vtkCSVExporter::FileName
protected

Definition at line 147 of file vtkCSVExporter.h.

◆ FieldDelimiter

char* vtkCSVExporter::FieldDelimiter
protected

Definition at line 148 of file vtkCSVExporter.h.

◆ OutputStream

std::ostream* vtkCSVExporter::OutputStream
protected

Definition at line 149 of file vtkCSVExporter.h.

◆ Mode

ExporterModes vtkCSVExporter::Mode
protected

Definition at line 150 of file vtkCSVExporter.h.

◆ WriteToOutputString

bool vtkCSVExporter::WriteToOutputString
protected

Definition at line 152 of file vtkCSVExporter.h.

◆ OutputString

std::string vtkCSVExporter::OutputString
protected

Definition at line 153 of file vtkCSVExporter.h.


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