BDataWriter Class Reference

#include <BDataWriter.h>

Inheritance diagram for BDataWriter:

Inheritance graph
[legend]

List of all members.


Detailed Description

Abstract base class that represents a single sink to which vector or raster data can be written.

Public Member Functions

bool AddLayer (BLayerPtr pLayer)
 Adds a BLayer to the collection of layers that will be written to the data sink.
bool AddLayers (const BLayers &layers)
 Adds a BLayers collection to the collection of layers that will be writen to the data sink.
virtual void Close ()
 Closes the underlying data sink and frees resources.
virtual void Open (const BString &dsName, const BParamList &parms)=0
 Opens the underlying data sink.
virtual void Write ()
 Writes the BLayers to the data sink.
virtual ~BDataWriter ()
 Destructor.

Static Public Member Functions

static BDataWriterCreate (const BString &dataType, const BParamList &parms, BLogger *pLogger=0)
 Creates a BDataWriter to write the specified data format.

Protected Member Functions

 BDataWriter (const BString &type, const BParamList &parms)
 Constructor.
 BDataWriter ()
 Default constructor.
virtual void BeginWrite (void)
 This method will be called at the beginning of the execution of the Write method.
virtual void EndWrite (void)
 This method will be called at the end of the execution of the Write method.
BString MakeFileName (const BString &dsName, const BString &layerName, const BString &fileExt)
 Determines the output file name based on the data sink specified on the Open method.
virtual void StoreLayer (const BLayerPtr &pLayer)=0
 Writes the contents of a single BLayer in the data sink.
BString TestFileCapabilities (const BString &dsName)
 Determine if the writer's capabilities allow it to write to the specified file or directory.

Protected Attributes

BString m_defaultWriteFileExt
 Default file extension to be used if the specified data set is a file and has no extension.

Constructor & Destructor Documentation

virtual ~BDataWriter (  )  [virtual]

Destructor.

BDataWriter (  )  [inline, protected]

Default constructor.

This is protected to prevent instantiation of abstract BDataWriter objects. To construct a BDataWriter, use the BDataWriter::Create method.

BDataWriter ( const BString type,
const BParamList parms 
) [inline, protected]

Constructor.

This is protected to prevent instantiation of abstract BDataWriter objects. To construct a BDataWriter, use the BDataWriter::Create method.

Parameters:
type The type of the data sink. Possible values for this parameter are defined as BString constants in DSType.h.
parms A set of format-specific parameters that describe the BDataWriter that shall be created.


Member Function Documentation

bool AddLayer ( BLayerPtr  pLayer  ) 

Adds a BLayer to the collection of layers that will be written to the data sink.

Parameters:
pLayer The BLayer to be added.
Returns:
True if the BLayer is successfully added and false otherwise.

bool AddLayers ( const BLayers layers  )  [inline]

Adds a BLayers collection to the collection of layers that will be writen to the data sink.

Parameters:
layers The BLayers to be added.
Returns:
True if the BLayers is successfully added and false otherwise.

virtual void BeginWrite ( void   )  [inline, protected, virtual]

This method will be called at the beginning of the execution of the Write method.

Derived classes should override this method to perform initialization required at the beginning of the Write method.

Reimplemented in BVectorDataWriter.

virtual void Close ( void   )  [inline, virtual]

Closes the underlying data sink and frees resources.

Derived classes should call the Close method in base class implementation.

Reimplemented from BDataManager.

Reimplemented in BVectorDataWriter.

static BDataWriter* Create ( const BString dataType,
const BParamList parms,
BLogger pLogger = 0 
) [static]

Creates a BDataWriter to write the specified data format.

Parameters:
dataType The format of data that will be written with this BDataWriter. The possible values for this parameter are defined as BString constants in DSType.h.
parms Format-specific parameters.
pLogger Instance of BLogger that will be used to log messages from the writer. This allows the use of a single log file to log messages from all readers and writers in an application. Set this to 0 if you want to allow the writer to create its own log file.
Returns:
A BDataWriter that will write the specified format.

virtual void EndWrite ( void   )  [inline, protected, virtual]

This method will be called at the end of the execution of the Write method.

Derived classes should override this method to perform cleanup required at the end of the Write method.

BString MakeFileName ( const BString dsName,
const BString layerName,
const BString fileExt 
) [protected]

Determines the output file name based on the data sink specified on the Open method.

Parameters:
dsName The data sink name. Can be a file or a directory.
layerName The name of the BLayer that will be written to the file.
fileExt The extension for the output file.

virtual void Open ( const BString dsName,
const BParamList parms 
) [pure virtual]

Opens the underlying data sink.

Parameters:
dsName The name of the underlying data sink. For a file-based data sink, this would be the path and file name.
parms Format specific parameters.

Implements BDataManager.

Implemented in BVectorDataWriter.

virtual void StoreLayer ( const BLayerPtr pLayer  )  [protected, pure virtual]

Writes the contents of a single BLayer in the data sink.

Parameters:
pLayer The BLayer to write.

Implemented in BVectorDataWriter.

BString TestFileCapabilities ( const BString dsName  )  [protected]

Determine if the writer's capabilities allow it to write to the specified file or directory.

If the writer can not write to it, this method will throw an exception.

Parameters:
dsName The data sink name. Can be a file or a directory.
Exceptions:
BUnsupportedCapabilityException This exception will be thrown if dsName refers to a file, but this BDataWriter is intended to write to a directory. Alternatively, this exception will be thrown if dsName refers to a directory, but this BDataWriter is intended to write to a file.
BFileNotFoundException This exception will be thrown if the file or directory specified by dsName cannot be found.

virtual void Write (  )  [virtual]

Writes the BLayers to the data sink.


Member Data Documentation

BString m_defaultWriteFileExt [protected]

Default file extension to be used if the specified data set is a file and has no extension.

Derived classes must initialize this in their constructor.


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

GeoTranslate 5.0 From Blue Marble Geographics