code::Formatter Class Reference

Inheritance diagram for code::Formatter:

code::GeneralSRVFormatter code::LTGFormatter code::XMLDataFormatter List of all members.

Detailed Description

The abstract class Formatter converts information contained in raw buffers to structured data objects.

This interface is implemented by HiresFormatter for example ...

Author:
: Lakshman
Version:
:
Id
code_Formatter.h,v 1.21 2009/06/02 20:17:39 lakshman Exp
See also:
HiresFormatter


Public Member Functions

virtual SmartPtr< DataTypecreateDataObject (const Buffer &buf) const
 Given a buffer of the information in the right format, will convert it into a Data object.
virtual SmartPtr< DataTypecreateDataObject (const Buffer &buf, const Index *) const
 Create a DataType given both a Buffer and an Index to use to extract other Records.
virtual SmartPtr< DataTypecreateDataObject (const std::vector< Buffer > &bufs) const
 In some cases, it is necessary to pass in a multitude of variable-length buffers.
virtual SmartPtr< DataTypecreateDataObject (const std::vector< Buffer > &bufs, const Index *index) const
 The more general purpose way of creating an object.
virtual SmartPtr< DataTypecreateDataObject (const std::vector< std::string > &bufs, const Index *index) const
 The most general purpose way of creating an object.
virtual void getBuffersToBuild (std::vector< std::string > &buffers) const
 The Formatter can tell the Builder what buffers (files) it needs.
virtual Buffer createBuffer (const DataType &obj) const =0
 Given a DataObject, will convert into a buffer of the right format.
virtual ~Formatter ()
 Meant to be subclassed.

Static Public Member Functions

static SmartPtr< FormattergetFormatter (const std::string &sourceType, const std::string &dataType)
 Given the source and data type, returns the appropriate formatter.

Protected Member Functions

 Formatter ()
 Only subclasses should try to construct a Formatter --> others should use getFormatter().

Static Protected Member Functions

static void introduce (const std::string &sourceType, const std::string &dataType, SmartPtr< Formatter > new_subclass)
 Use this to introduce new formatters into the system.


Constructor & Destructor Documentation

virtual code::Formatter::~Formatter (  )  [inline, virtual]

Meant to be subclassed.

code::Formatter::Formatter (  )  [inline, protected]

Only subclasses should try to construct a Formatter --> others should use getFormatter().


Member Function Documentation

virtual Buffer code::Formatter::createBuffer ( const DataType obj  )  const [pure virtual]

Given a DataObject, will convert into a buffer of the right format.

Implemented in code::GeneralSRVFormatter, code::LTGFormatter, and code::XMLDataFormatter.

virtual SmartPtr<DataType> code::Formatter::createDataObject ( const std::vector< std::string > &  bufs,
const Index index 
) const [virtual]

The most general purpose way of creating an object.

Reimplemented in code::GeneralSRVFormatter.

virtual SmartPtr<DataType> code::Formatter::createDataObject ( const std::vector< Buffer > &  bufs,
const Index index 
) const [virtual]

The more general purpose way of creating an object.

virtual SmartPtr<DataType> code::Formatter::createDataObject ( const std::vector< Buffer > &  bufs  )  const [virtual]

In some cases, it is necessary to pass in a multitude of variable-length buffers.

This function is not pure virtual since it is needed only for special cases. This is the version that Hires must use.

virtual SmartPtr<DataType> code::Formatter::createDataObject ( const Buffer buf,
const Index  
) const [virtual]

Create a DataType given both a Buffer and an Index to use to extract other Records.

virtual SmartPtr<DataType> code::Formatter::createDataObject ( const Buffer buf  )  const [virtual]

Given a buffer of the information in the right format, will convert it into a Data object.

Accept return value into a SmartPtr

Bug in egcs prevents the use of DerivedSmartPtr in pure virtual functions. So, till then, return SmartPtr< DataType > and do a dynamic downcast.

Reimplemented in code::LTGFormatter, and code::XMLDataFormatter.

virtual void code::Formatter::getBuffersToBuild ( std::vector< std::string > &  buffers  )  const [virtual]

The Formatter can tell the Builder what buffers (files) it needs.

Hires Formatters must do this.

static SmartPtr< Formatter > code::Formatter::getFormatter ( const std::string &  sourceType,
const std::string &  dataType 
) [static]

Given the source and data type, returns the appropriate formatter.

For example, getFormatter("hires", "VIL") will return the VIL formatter for hires.

Returns:
invalid smart pointer on error.

static void code::Formatter::introduce ( const std::string &  sourceType,
const std::string &  dataType,
SmartPtr< Formatter new_subclass 
) [static, protected]

Use this to introduce new formatters into the system.


Generated on Fri May 4 13:40:13 2012 for WDSS-IIw2 by  doxygen 1.4.7