netcdfpp
Header-only NetCDF C++ wrapper
Loading...
Searching...
No Matches
Public Member Functions | List of all members
netCDF::Maybe< T > Class Template Referencefinal

Optional result returned by object lookup functions. More...

#include <netcdfpp.h>

Public Member Functions

 Maybe (std::shared_ptr< detail::Path > path_p)
 
require () const
 Returns the object or throws netCDF::Exception if the lookup failed.
 
bool valid () const
 Returns true when the lookup found an object.
 
 operator bool () const
 Returns true when the lookup found an object.
 

Detailed Description

template<typename T>
class netCDF::Maybe< T >

Optional result returned by object lookup functions.

Maybe<T> is false when the requested object does not exist. Call require() to either receive the object or throw netCDF::Exception with a not-found message.

Constructor & Destructor Documentation

◆ Maybe()

template<typename T >
netCDF::Maybe< T >::Maybe ( std::shared_ptr< detail::Path path_p)
inlineexplicit

Member Function Documentation

◆ operator bool()

template<typename T >
netCDF::Maybe< T >::operator bool ( ) const
inline

Returns true when the lookup found an object.

◆ require()

template<typename T >
T netCDF::Maybe< T >::require ( ) const
inline

Returns the object or throws netCDF::Exception if the lookup failed.

◆ valid()

template<typename T >
bool netCDF::Maybe< T >::valid ( ) const
inline

Returns true when the lookup found an object.


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