Exception handling

This file defines exception-handling facilities.

The smc::exception class, which is used for exception handling by SMCTC, is defined.

Defines

__SMC_EXCEPT_HH
SMC_EXCEPTION(code, error)

A macro which autocompletes the housekeeping components of an smc::exception.

SMCX_FILE_NOT_FOUND

Exception thrown if a file cannot be accessed.

SMCX_MISSING_HISTORY

Exception thrown if the sampler attempts to access history data which wasn’t stored.

SMCX_MULTIPLE_INSTANTIATION

Exception thrown if an attempt is made to instantiate a class of which a single instance is permitted more than once.

CSMCX_USING_MCMC

Exception thrown if an attempt is made to use facilities of the base sampler class related to MCMC moves.

CSMCX_USING_ADAPTATION

Exception thrown if an attempt is made to use facilities of the base sampler class related to adaptation.

namespace smc

The Sequential Monte Carlo namespace.

The classes and functions within this namespace are intended to be used for producing implemenetations of SMC samplers and related simulation techniques.

class exception
#include <smc-exception.h>

SMC Exception class.

This class holds details of unrecoverable errors which occur within the SMCTC library. An instance of it is thrown whenever such an error occurs.

Public Functions

inline exception(char const *szN, long lL, long lC, char const *szM)

Generate an SMCTC Exception class with the specified initialisation.

This constructor fills the four elements of the class with their specified values. It is used to allow a single-line command to create and throw an exception.

Parameters
  • szN – The name of the source file generating the exception.

  • lL – The line in that file responsible for the exception.

  • lC – The numerical code identifying the exception.

  • szM – An textual explanation of the problem.

Public Members

char const *szFile

The source file from which the code generating the exception was generated.

long lLine

The line of that source file which generates the exception.

long lCode

A numerical code indicating the nature of the exception generated.

char const *szMessage

A human-readable explanation of the cause of the exception.

namespace std

The standard namespace.

The classes provided within the standard libraries reside within this namespace and the TDSMC class library adds a number of additional operator overloads to some of the standard classes to allow them to deal with our structures.

Functions

inline std::ostream &operator<<(std::ostream &os, smc::exception &e)

Produce a human-readable display of the state of an smc::exception class using the stream operator.

Display a human-readable version of an SMC exception.

Parameters
  • os – The stream to write to.

  • e – The exception class to display.

Returns

os