6.2. C++

The official C++ API is defined in the header file SpectralWaveData.h. It defines the generic class SpectralWaveData to be applied in applications. All member functions and input arguments are explained in that header file.

The data types real_swd, vector_swd, vector_2nd_phi_swd and vector_2nd_elev_swd are defined in the C-header file spectral_wave_data.h.

If your C++ application apply float (not double) for the SWD API interface you need to:

  1. Set the macro SWD_API_FLOAT before the header file is included.

  2. The fortran library should be compiled with kind_swd_c = c_float in the file kind_values.f90.

By default it is assumed that the C/C++ interface apply double. Hence kind_swd_c = c_double in the file kind_values.f90 and the macro SWD_API_FLOAT should be unset.

C++ Exceptions

Usage

SwdException

Base class for all SWD specific exceptions

SwdFileCantOpenException

Typical if SWD file is not an existing file.

SwdFileBinaryException

SWD file does not apply float/little-endian

SwdFileDataException

Error during reading and checking SWD data

SwdInputValueException

Input arguments for class methods are not sound

SwdAllocateException

Not able to allocate internal SWD storage

6.2.3. Implementation

In the current version the implementation of the class SpectralWaveData is obtained by wrapping the C-implementation as done in the file SpectralWaveData.cpp.