Pointwise Plugin SDK
Public Types | Public Member Functions | Protected Types | Private Member Functions | List of all members
PwpWriterInterface Class Referenceabstract

The abstract PwpWriterInterface class. More...

#include <PwpFileWriter.h>

+ Inheritance diagram for PwpWriterInterface:

Public Types

enum  FormatType {
  FormatG = G_,
  FormatWdPrecG = G_ | Wd_ | Prec_,
  FormatWdG = G_ | Wd_,
  FormatPrecG = G_ | Prec_,
  FormatF = F_,
  FormatWdPrecF = F_ | Wd_ | Prec_,
  FormatWdF = F_ | Wd_,
  FormatPrecF = F_ | Prec_,
  FormatE = E_,
  FormatWdPrecE = E_ | Wd_ | Prec_,
  FormatWdE = E_ | Wd_,
  FormatPrecE = E_ | Prec_
}
 Formatted output types for floating point values. More...
 

Public Member Functions

virtual bool beginRecord ()=0
 Starts an unformatted record. More...
 
virtual bool beginRecord (PWP_UINT32 bytes, PWP_UINT32 count=1)=0
 Starts a fixed size unformatted record. More...
 
virtual bool endRecord ()=0
 Ends an unformatted record. More...
 
virtual void getFmtFieldDouble (int &width, int &prec) const =0
 
virtual void getFmtFieldSingle (int &width, int &prec) const =0
 
virtual FormatType getFmtType () const =0
 
virtual void setFmtFieldDouble (const int width, const int prec)=0
 
virtual void setFmtFieldSingle (const int width, const int prec)=0
 
virtual void setFmtType (FormatType type)=0
 
virtual bool write (const char *val, PWP_INT size=-1, char pad=0)=0
 Writes a string value. More...
 
virtual bool write (PWP_FLOAT val, const char *suffix=0, const char *prefix=0)=0
 Writes a floating point value with proper precision, encoding and byte order. More...
 
virtual bool write (PWP_INT16 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_INT32 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_INT64 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_INT8 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_REAL val, const char *suffix=0, const char *prefix=0)=0
 Writes a floating point value with proper precision, encoding and byte order. More...
 
virtual bool write (PWP_UINT16 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_UINT32 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_UINT64 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
virtual bool write (PWP_UINT8 val, const char *suffix=0, const char *prefix=0)=0
 Writes a integer value with proper encoding and byte order. More...
 
bool writef (const char *fmt,...)
 Writes a formatted string value. More...
 
bool writef (PWP_INT size, char pad, const char *fmt,...)
 Writes a formatted string value. More...
 
virtual ~PwpWriterInterface ()
 Destructor. More...
 

Protected Types

enum  {
  G_ = 0x00,
  F_ = 0x01,
  E_ = 0x02,
  GFEMask_ = 0x0F,
  Wd_ = 0x10,
  Prec_ = 0x20,
  WdPrec_ = Wd_ | Prec_,
  WPMask_ = 0xF0
}
 Bit flags use to build public FormatX enums. More...
 

Private Member Functions

bool writefImpl (PWP_INT size, char pad, const char *fmt, va_list &args)
 Implementation to write a formatted string value. More...
 

Detailed Description

The abstract PwpWriterInterface class.

Inherited by subclasses that implement the PwpWriterInterface.

Definition at line 265 of file PwpFileWriter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Bit flags use to build public FormatX enums.

Enumerator
G_ 
F_ 
E_ 
GFEMask_ 
Wd_ 
Prec_ 
WdPrec_ 
WPMask_ 

Definition at line 269 of file PwpFileWriter.h.

◆ FormatType

Formatted output types for floating point values.

Note
Theses values are only used by the PwpAsciiWriter.
Enumerator
FormatG 

Format "%g".

FormatWdPrecG 

Format "%*.*g".

FormatWdG 

Format "%*g".

FormatPrecG 

Format "%.*g".

FormatF 

Format "%f".

FormatWdPrecF 

Format "%*.*f".

FormatWdF 

Format "%*f".

FormatPrecF 

Format "%.*f".

FormatE 

Format "%e".

FormatWdPrecE 

Format "%*.*e".

FormatWdE 

Format "%*e".

FormatPrecE 

Format "%.*e".

Definition at line 286 of file PwpFileWriter.h.

Constructor & Destructor Documentation

◆ ~PwpWriterInterface()

virtual PwpWriterInterface::~PwpWriterInterface ( )
inlinevirtual

Destructor.

Definition at line 307 of file PwpFileWriter.h.

Member Function Documentation

◆ beginRecord() [1/2]

bool PwpWriterInterface::beginRecord ( )
pure virtual

Starts an unformatted record.

Starts an unformatted record. If a record is already active, it will be closed.

Returns
true on success.
Note
Records are ignored by all modes except pwpUnformatted.

Implemented in PwpFileWriter, PwpFileRecord, PwpFile, and PwpUnformattedWriter.

◆ beginRecord() [2/2]

bool PwpWriterInterface::beginRecord ( PWP_UINT32  bytes,
PWP_UINT32  count = 1 
)
pure virtual

Starts a fixed size unformatted record.

Starts a fixed size unformatted record. If a record is already active, it will be closed.

Fixed size record I/O is significantly faster than variable sized records. Fixed size records should be used, if possible, when there are large numbers (> ~1e6) of records written to an export file.

The call to endRecord() will fail if the number of bytes written to the record is not equal to (bytes * count).

Returns
true on success.
Note
Records are ignored by all modes except pwpUnformatted.

Implemented in PwpFileWriter, PwpFileRecord, PwpFile, and PwpUnformattedWriter.

◆ endRecord()

bool PwpWriterInterface::endRecord ( )
pure virtual

Ends an unformatted record.

Ends an active record for files opened with pwpUnformatted mode.

Returns
true on success.
Note
Records are ignored by all modes except pwpUnformatted.

Implemented in PwpFileWriter, PwpFileRecord, PwpFile, and PwpUnformattedWriter.

◆ getFmtFieldDouble()

virtual void PwpWriterInterface::getFmtFieldDouble ( int &  width,
int &  prec 
) const
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ getFmtFieldSingle()

virtual void PwpWriterInterface::getFmtFieldSingle ( int &  width,
int &  prec 
) const
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ getFmtType()

virtual FormatType PwpWriterInterface::getFmtType ( ) const
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ setFmtFieldDouble()

virtual void PwpWriterInterface::setFmtFieldDouble ( const int  width,
const int  prec 
)
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ setFmtFieldSingle()

virtual void PwpWriterInterface::setFmtFieldSingle ( const int  width,
const int  prec 
)
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ setFmtType()

virtual void PwpWriterInterface::setFmtType ( FormatType  type)
pure virtual

Implemented in PwpFileWriter, PwpFileRecord, and PwpFile.

◆ write() [1/11]

bool PwpWriterInterface::write ( const char *  val,
PWP_INT  size = -1,
char  pad = 0 
)
pure virtual

Writes a string value.

Parameters
valThe string to write.
sizeThe number of string characters to write. If -1, strlen(val) is used.
padIf size > strlen(val), the pad value will be used to fill the remaining characters.
Returns
true on success.
Note
For pwpUnformatted mode, the record byte count is incremented by size or strlen(val) if size is -1.

Implemented in PwpAsciiWriter, PwpFileRecord, PwpFile, PwpUnformattedWriter, and PwpBinaryWriter.

◆ write() [2/11]

bool PwpWriterInterface::write ( PWP_FLOAT  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a floating point value with proper precision, encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, precision and byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof((precision)val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [3/11]

bool PwpWriterInterface::write ( PWP_INT16  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [4/11]

bool PwpWriterInterface::write ( PWP_INT32  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [5/11]

bool PwpWriterInterface::write ( PWP_INT64  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

Referenced by PwpFile::write(), and writefImpl().

◆ write() [6/11]

bool PwpWriterInterface::write ( PWP_INT8  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [7/11]

bool PwpWriterInterface::write ( PWP_REAL  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a floating point value with proper precision, encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, precision and byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof((precision)val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [8/11]

bool PwpWriterInterface::write ( PWP_UINT16  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [9/11]

bool PwpWriterInterface::write ( PWP_UINT32  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [10/11]

bool PwpWriterInterface::write ( PWP_UINT64  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ write() [11/11]

bool PwpWriterInterface::write ( PWP_UINT8  val,
const char *  suffix = 0,
const char *  prefix = 0 
)
pure virtual

Writes a integer value with proper encoding and byte order.

Parameters
valThe value to write.
suffixString written after val (pwpAscii mode only).
prefixString written before val (pwpAscii mode only).
Returns
true on success.
Note
For pwpBinary and pwpUnformatted modes, byte ordering is enforced.
For pwpUnformatted mode, the record byte count is incremented by sizeof(val).
suffix and prefix are ignored by all modes except pwpAscii.

Implemented in PwpFileRecord, PwpFile, PwpUnformattedWriter, PwpBinaryWriter, and PwpAsciiWriter.

◆ writef() [1/2]

bool PwpWriterInterface::writef ( const char *  fmt,
  ... 
)
inline

Writes a formatted string value.

Definition at line 347 of file PwpFileWriter.h.

References writefImpl().

◆ writef() [2/2]

bool PwpWriterInterface::writef ( PWP_INT  size,
char  pad,
const char *  fmt,
  ... 
)
inline

Writes a formatted string value.

Definition at line 327 of file PwpFileWriter.h.

References writefImpl().

◆ writefImpl()

bool PwpWriterInterface::writefImpl ( PWP_INT  size,
char  pad,
const char *  fmt,
va_list &  args 
)
inlineprivate

Implementation to write a formatted string value.

Definition at line 361 of file PwpFileWriter.h.

References write().

Referenced by writef().


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