Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvutil::PlugInCallback Class Reference

PlugInCallback base class. More...

#include <PlugInCallback.h>

Inheritance diagram for nvutil::PlugInCallback:

Inheritance graph
[legend]
Collaboration diagram for nvutil::PlugInCallback:

Collaboration graph
[legend]
List of all members.

Public Types

enum  PIC_ERROR {
  PICE_UNEXPECTED_EOF, PICE_UNEXPECTED_TOKEN, PICE_UNKNOWN_TOKEN, PICE_FILE_ACCESS_FAILED,
  PICE_FILE_MAPPING_FAILED, PICE_INCOMPATIBLE_FILE, PICE_INVALID_FILE
}
 Enumeration of PlugInCallback errors. More...
enum  PIC_WARNING {
  PICW_FILE_EMPTY, PICW_FILE_NOT_FOUND, PICW_FILES_NOT_FOUND, PICW_EMPTY_TOKEN,
  PICW_INCOMPATIBLE_VALUES, PICW_INVALID_VALUE, PICW_UNDEFINED_TOKEN, PICW_UNSUPPORTED_TOKEN
}
 Enumeration of PlugInCallback warnings. More...
enum  PIC_TYPE_ID { PICT_INT, PICT_FLOAT }
 Enumeration of value types used in warnings/errors. More...

Public Member Functions

 PlugInCallback ()
 Constructor.
void setThrowExceptionOnError (bool set)
 Set whether an exception should be thrown on error.
virtual void onError (PIC_ERROR eid, const void *info) const
 General callback on error.
virtual bool onWarning (PIC_WARNING wid, const void *info) const
 General callback on warning.
virtual void onUnexpectedEndOfFile (size_t position) const
 Specialized callback on error: PICE_UNEXPECTED_EOF.
virtual void onUnexpectedToken (size_t position, const std::string &expected, const std::string &encountered) const
 Specialized callback on error: PICE_UNEXPECTED_TOKEN.
virtual void onUnknownToken (size_t position, const std::string &context, const std::string &token) const
 Specialized callback on error: PICE_UNKNOWN_TOKEN.
virtual bool onEmptyToken (size_t position, const std::string &context, const std::string &token) const
 Specialized callback on warning: PICW_EMPTY_TOKEN.
virtual bool onFileEmpty (const std::string &file) const
 Specialized callback on warning: PICW_FILE_EMPTY.
virtual bool onFileNotFound (const std::string &file) const
 Specialized callback on warning: PICW_FILE_NOT_FOUND.
virtual bool onFilesNotFound (const std::vector< std::string > &files) const
 Specialized callback on warning: PICW_FILES_NOT_FOUND.
virtual bool onUndefinedToken (size_t position, const std::string &context, const std::string &token) const
 Specialized callback on warning: PICW_UNDEFINED_TOKEN.
virtual bool onIncompatibleValues (size_t position, const std::string &context, const std::string &value0Name, int value0, const std::string &value1Name, int value1) const
 Specialized callback on warning: PICW_INCOMPATIBLE_VALUES.
virtual bool onIncompatibleValues (size_t position, const std::string &context, const std::string &value0Name, float value0, const std::string &value1Name, float value1) const
 Specialized callback on warning: PICW_INCOMPATIBLE_VALUES.
virtual bool onInvalidValue (size_t position, const std::string &context, const std::string &valueName, int value) const
 Specialized callback on warning: PICW_INVALID_VALUE.
virtual bool onInvalidValue (size_t position, const std::string &context, const std::string &valueName, float value) const
 Specialized callback on warning: PICW_INVALID_VALUE.
virtual bool onUnsupportedToken (size_t position, const std::string &context, const std::string &token) const
 Specialized callback on warning: PICW_UNSUPPORTED_TOKEN.
virtual void onFileAccessFailed (const std::string &file, unsigned int systemSpecificErrorCode) const
 Error callback on PICE_FILE_ACCESS_FAILED error.
virtual void onFileMappingFailed (unsigned int systemSpecificErrorCode) const
 Error callback on PICE_FILE_MAPPING_FAILED error.
virtual void onImcompatibleFile (const std::string &file, const std::string &context, unsigned int expectedVersion, unsigned int detectedVersion) const
 Error callback on PICE_INCOMPATIBLE_FILE error.
virtual void onInvalidFile (const std::string &file, const std::string &context) const
 Error callback on PICE_INVALID_FILE error.

Protected Member Functions

virtual ~PlugInCallback ()
 Protected destructor to prevent explicit creation on stack.

Classes

struct  EmptyTokenInfo
 Information structure used for warning PICW_EMPTY_TOKEN. More...
struct  FileAccessFailedInfo
 Information structure used for error PICE_FILE_ACCESS_ERROR. More...
struct  FileMappingFailedInfo
 Information structure used for error PICE_FILE_MAPPING_ERROR. More...
struct  IncompatibleFileInfo
 Information structure used for error PICE_INCOMPATIBLE_FILE. More...
struct  IncompatibleValueInfo
 Information structure used for warning PICW_INCOMPATIBLE_VALUES. More...
struct  InvalidFileInfo
 Information structure used for error PICE_INVALID_FILE. More...
struct  InvalidValueInfo
 Information structure used for warning PICW_INVALID_VALUE. More...
struct  UndefinedTokenInfo
 Information structure used for warning PICW_UNDEFINED_TOKEN. More...
struct  UnexpectedTokenInfo
 Information structure used for error PICE_UNEXPECTED_TOKEN. More...
struct  UnknownTokenInfo
 Information structure used for error PICE_UNKNOWN_TOKEN. More...
struct  UnsupportedTokenInfo
 Information structure used for warning PICW_UNSUPPORTED_TOKEN. More...

Detailed Description

PlugInCallback base class.

A PlugInCallback object can be used to report warnings and errors that happen while using a PlugIn. It is applied to a PlugIn via PlugIn::setCallback(). A PlugInCallback object consists of a set of virtual functions that can be overloaded by an application specific PlugInCallback object. It has two generic callbacks onError and onWarning, that can be called with any error/warning code. And it has two families of specific error and warning functions that are called on specific error/warning conditions.


Member Enumeration Documentation

enum nvutil::PlugInCallback::PIC_ERROR
 

Enumeration of PlugInCallback errors.

enum nvutil::PlugInCallback::PIC_WARNING
 

Enumeration of PlugInCallback warnings.

enum nvutil::PlugInCallback::PIC_TYPE_ID
 

Enumeration of value types used in warnings/errors.


Constructor & Destructor Documentation

nvutil::PlugInCallback::PlugInCallback  )  [inline]
 

Constructor.

nvutil::PlugInCallback::~PlugInCallback  )  [inline, protected, virtual]
 

Protected destructor to prevent explicit creation on stack.


Member Function Documentation

void nvutil::PlugInCallback::setThrowExceptionOnError bool  set  )  [inline]
 

Set whether an exception should be thrown on error.

void nvutil::PlugInCallback::onError PIC_ERROR  eid,
const void *  info
const [inline, virtual]
 

General callback on error.

This general error callback is called with every error that isn't completely handled in a specialized error callback. If throwExceptionOnError is set (default), onError throws an PIC_ERROR exception. The specific error callbacks fall back to this function. This callback can be overloaded to support new error conditions.

Parameters:
eid  error ID
info  pointer to information structure corresponding to eid

bool nvutil::PlugInCallback::onWarning PIC_WARNING  wid,
const void *  info
const [inline, virtual]
 

General callback on warning.

This general warning callback is called with every warning that isn't completely handled in a specialized warning callback. In this base implemetation, onWarning just returns true, meaning the PlugIn operation can be continued without danger. The specific warning callbacks fall back to this function. This callback can be overloaded to support new warning conditions.

Parameters:
wid  waringing ID
info  pointer to information structure corresponding to wid

void nvutil::PlugInCallback::onUnexpectedEndOfFile size_t  position  )  const [inline, virtual]
 

Specialized callback on error: PICE_UNEXPECTED_EOF.

This error callback is called, when the end of a file was reached unexpectedly. In this base implementation, the general callback onError is called. Overload this callback to implement special handling on unexpected end of file errors.

Parameters:
position  position in file, where error occured

void nvutil::PlugInCallback::onUnexpectedToken size_t  position,
const std::string &  expected,
const std::string &  encountered
const [inline, virtual]
 

Specialized callback on error: PICE_UNEXPECTED_TOKEN.

This error callback is called, when an unexpected token is encountered. In this base implementation, a struct UnexpectedTokenInfo is constructed out of the arguments, and the general callback onError is called. Overlaod this callback to implement special handling on unexpected token errors.

Parameters:
position  position in file, where error occured
expected  expected token
encountered  encountered token

void nvutil::PlugInCallback::onUnknownToken size_t  position,
const std::string &  context,
const std::string &  token
const [inline, virtual]
 

Specialized callback on error: PICE_UNKNOWN_TOKEN.

This error callback is called, when an unknown token is encountered. In this base implementation, a struct UnknownTokenInfo is constructed out of the arguments, and the general callback onError is called. Overload this callback to implement special handling on unknown token errors.

Parameters:
position  position in file, where the error occured
context  context of the unknown token
token  unknown token

bool nvutil::PlugInCallback::onEmptyToken size_t  position,
const std::string &  context,
const std::string &  token
const [inline, virtual]
 

Specialized callback on warning: PICW_EMPTY_TOKEN.

This warning callback is called, when a token proved to be empty. In this base implementation, a struct EmptyTokenInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on empty token warnings.

Parameters:
position  position in file, where the warning occured
context  context of the empty token
token  name of the empty token

bool nvutil::PlugInCallback::onFileEmpty const std::string &  file  )  const [inline, virtual]
 

Specialized callback on warning: PICW_FILE_EMPTY.

This warning callback is called, when a file proved to be empty. In this base implementation, the general callback onWarning is called. Overload this callback to implement special handling on empty file warnings.

Parameters:
file  name of the empty file

bool nvutil::PlugInCallback::onFileNotFound const std::string &  file  )  const [inline, virtual]
 

Specialized callback on warning: PICW_FILE_NOT_FOUND.

This warning callback is called, when a file wasn't found. In this base implementation, the general callback onWarning is called. Overload this callback to implement special handling on file not found warnings.

Parameters:
file  name of the file, that wasn't found

bool nvutil::PlugInCallback::onFilesNotFound const std::vector< std::string > &  files  )  const [inline, virtual]
 

Specialized callback on warning: PICW_FILES_NOT_FOUND.

This warning callback is called, when none of a number of files was found. In this base implementation, the general callback onWarning is called. Overload this callback to implement special handling on file not found warnings.

Parameters:
files  vector of files, where none was found

bool nvutil::PlugInCallback::onUndefinedToken size_t  position,
const std::string &  context,
const std::string &  token
const [inline, virtual]
 

Specialized callback on warning: PICW_UNDEFINED_TOKEN.

This warning callback is called, a named token is used that wasn't defined before. In this base implementation, a struct UndefinedTokenInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on undefined token warnings.

Parameters:
position  position in file, where the warning occured
context  context of the undefined token
token  undefined token

bool nvutil::PlugInCallback::onIncompatibleValues size_t  position,
const std::string &  context,
const std::string &  value0Name,
int  value0,
const std::string &  value1Name,
int  value1
const [inline, virtual]
 

Specialized callback on warning: PICW_INCOMPATIBLE_VALUES.

This warning callback is called, when two incompatible values of type int are found in the file. In this base implementation, a struct IncompatibleValueInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on incompatible values warnings.

Parameters:
position  position in file, where the warning occured
context  context of the incompatible values
value0Name  name of the first value
value0  first value
value1Name  name of the second value
value1  second value

bool nvutil::PlugInCallback::onIncompatibleValues size_t  position,
const std::string &  context,
const std::string &  value0Name,
float  value0,
const std::string &  value1Name,
float  value1
const [inline, virtual]
 

Specialized callback on warning: PICW_INCOMPATIBLE_VALUES.

This warning callback is called, when two incompatible values of type float are found in the file. In this base implementation, a struct IncompatibleValueInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on incompatible values warnings.

Parameters:
position  position in file, where the warning occured
context  context of the incompatible values
value0Name  name of the first value
value0  first value
value1Name  name of the second value
value1  second value

bool nvutil::PlugInCallback::onInvalidValue size_t  position,
const std::string &  context,
const std::string &  valueName,
int  value
const [inline, virtual]
 

Specialized callback on warning: PICW_INVALID_VALUE.

This warning callback is called, when an invalid value of type int is found in the file. In this base implementatino, a struct InvalidValueInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on incompatible values warnings.

Parameters:
position  position in file, where the warning occured
context  context of the invalid value
valueName  name of the invalid value
value  invalid value

bool nvutil::PlugInCallback::onInvalidValue size_t  position,
const std::string &  context,
const std::string &  valueName,
float  value
const [inline, virtual]
 

Specialized callback on warning: PICW_INVALID_VALUE.

This warning callback is called, when an invalid value of type float is found in the file. In this base implementatino, a struct InvalidValueInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on incompatible values warnings.

Parameters:
position  position in file, where the warning occured
context  context of the invalid value
valueName  name of the invalid value
value  invalid value

bool nvutil::PlugInCallback::onUnsupportedToken size_t  position,
const std::string &  context,
const std::string &  token
const [inline, virtual]
 

Specialized callback on warning: PICW_UNSUPPORTED_TOKEN.

This warning callback is called, when an unsupported token is found in the file. In this base implementatino, a struct UnsupportedTokenInfo is constructed out of the arguments, and the general callback onWarning is called. Overload this callback to implement special handling on unsupported token warnings.

Parameters:
position  position in file, where the warning occured
context  context of the unsupported token
token  unsupported token

void nvutil::PlugInCallback::onFileAccessFailed const std::string &  file,
unsigned int  systemSpecificErrorCode
const [inline, virtual]
 

Error callback on PICE_FILE_ACCESS_FAILED error.

This callback should be invoked from within a plug-in if a file access error occured. The default implementation simply calls onError.
It is advisable to overload this function if more customized error handling is requested for file access errors.

Parameters:
file  Specifies the name of the file
systemSpecificErrorCode  Specifies a system specific error code.

void nvutil::PlugInCallback::onFileMappingFailed unsigned int  systemSpecificErrorCode  )  const [inline, virtual]
 

Error callback on PICE_FILE_MAPPING_FAILED error.

This callback should be invoked from within a plug-in if a file mapping error occured. The default implementation simply calls onError.
It is advisable to overload this function if more customized error handling is requested for file mapping errors.

Parameters:
systemSpecificErrorCode  Specifies a system specific error code.

void nvutil::PlugInCallback::onImcompatibleFile const std::string &  file,
const std::string &  context,
unsigned int  expectedVersion,
unsigned int  detectedVersion
const [inline, virtual]
 

Error callback on PICE_INCOMPATIBLE_FILE error.

This callback should be invoked from within a plug-in if a file is detected to be incompatible. The default implementation simply calls onError.
It is advisable to overload this function if more customized error handling is requested when detecting incompatible files.

Parameters:
file  Specifies the name of the file.
context  Specifies the context of detected incompatibility.
expectedVersion  Specifies the expected version. The high-order 16-bits specify the major version; the low-order 16-bits specify the compatibility level.
detectedVersion  Specifies the detected version. The high-order 16-bits specify the major version; the low-order 16-bits specify the compatibility level.

void nvutil::PlugInCallback::onInvalidFile const std::string &  file,
const std::string &  context
const [inline, virtual]
 

Error callback on PICE_INVALID_FILE error.

This callback should be invoked from within a plug-in if a file is detected to be invalid. The default implementation simply calls onError.
It is advisable to overload this function if more customized error handling is requested when detecting invalid files.

Parameters:
file  Specifies the name of the file.
context  Specifies the context of detected invalidity.


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:21:13 2005 for NVSGSDK by NVIDIA