Apache Mesos
Classes | Macros | Functions
check.hpp File Reference
#include <ostream>
#include <sstream>
#include <string>
#include <glog/logging.h>
#include <stout/abort.hpp>
#include <stout/error.hpp>
#include <stout/none.hpp>
#include <stout/option.hpp>
#include <stout/some.hpp>

Go to the source code of this file.

Classes

class  Result< T >
 
class  Try< T, E >
 
struct  _CheckFatal
 

Macros

#define CHECK_STATE(name, check, expression)
 
#define CHECK_SOME(expression)   CHECK_STATE(CHECK_SOME, _check_some, expression)
 
#define CHECK_NONE(expression)   CHECK_STATE(CHECK_NONE, _check_none, expression)
 
#define CHECK_ERROR(expression)   CHECK_STATE(CHECK_ERROR, _check_error, expression)
 
#define CHECK_NOTNONE(expression)
 
#define CHECK_NOTERROR(expression)
 
#define CHECK_CONTAINS(container, key)
 
#define CHECK_NOT_CONTAINS(container, key)
 

Functions

template<typename T >
T && _check_not_none (const char *file, int line, const char *message, Option< T > &&t)
 
template<typename T >
T & _check_not_none (const char *file, int line, const char *message, Option< T > &t)
 
template<typename T >
const T & _check_not_none (const char *file, int line, const char *message, const Option< T > &t)
 
template<typename T , typename E >
T && _check_not_error (const char *file, int line, const char *message, Try< T, E > &&t)
 
template<typename T , typename E >
T & _check_not_error (const char *file, int line, const char *message, Try< T, E > &t)
 
template<typename T , typename E >
const T & _check_not_error (const char *file, int line, const char *message, const Try< T, E > &t)
 
template<typename T >
Option< Error_check_some (const Option< T > &o)
 
template<typename T , typename E >
Option< Error_check_some (const Try< T, E > &t)
 
template<typename T >
Option< Error_check_some (const Result< T > &r)
 
template<typename T >
Option< Error_check_none (const Option< T > &o)
 
template<typename T >
Option< Error_check_none (const Result< T > &r)
 
template<typename T , typename E >
Option< Error_check_error (const Try< T, E > &t)
 
template<typename T >
Option< Error_check_error (const Result< T > &r)
 

Macro Definition Documentation

#define CHECK_CONTAINS (   container,
  key 
)
Value:
if (!(container).contains(key)) \
google::LogMessageFatal(__FILE__, __LINE__).stream() \
<< "Check failed: " << #container << " does not contain " << (key) \
bool contains(const Resource &left, const Resource &right)
#define CHECK_ERROR (   expression)    CHECK_STATE(CHECK_ERROR, _check_error, expression)
#define CHECK_NONE (   expression)    CHECK_STATE(CHECK_NONE, _check_none, expression)
#define CHECK_NOT_CONTAINS (   container,
  key 
)
Value:
if ((container).contains(key)) \
google::LogMessageFatal(__FILE__, __LINE__).stream() \
<< "Check failed: " << #container << " already contains " << (key) \
bool contains(const Resource &left, const Resource &right)
#define CHECK_NOTERROR (   expression)
Value:
__FILE__, \
__LINE__, \
"'" #expression "' Must be SOME", \
(expression))
T && _check_not_error(const char *file, int line, const char *message, Try< T, E > &&t)
Definition: check.hpp:114
#define CHECK_NOTNONE (   expression)
Value:
__FILE__, \
__LINE__, \
"'" #expression "' Must be SOME", \
(expression))
T && _check_not_none(const char *file, int line, const char *message, Option< T > &&t)
Definition: check.hpp:65
#define CHECK_SOME (   expression)    CHECK_STATE(CHECK_SOME, _check_some, expression)
#define CHECK_STATE (   name,
  check,
  expression 
)
Value:
for (const Option<Error> _error = check(expression); _error.isSome();) \
_CheckFatal(__FILE__, \
__LINE__, \
#name, \
#expression, \
_error.get()).stream()
Try< Nothing > check()
Definition: check.hpp:264
constexpr const char * name
Definition: shell.hpp:41

Function Documentation

template<typename T , typename E >
Option<Error> _check_error ( const Try< T, E > &  t)
template<typename T >
Option<Error> _check_error ( const Result< T > &  r)
template<typename T >
Option<Error> _check_none ( const Option< T > &  o)
template<typename T >
Option<Error> _check_none ( const Result< T > &  r)
template<typename T , typename E >
T&& _check_not_error ( const char *  file,
int  line,
const char *  message,
Try< T, E > &&  t 
)
template<typename T , typename E >
T& _check_not_error ( const char *  file,
int  line,
const char *  message,
Try< T, E > &  t 
)
template<typename T , typename E >
const T& _check_not_error ( const char *  file,
int  line,
const char *  message,
const Try< T, E > &  t 
)
template<typename T >
T&& _check_not_none ( const char *  file,
int  line,
const char *  message,
Option< T > &&  t 
)
template<typename T >
T& _check_not_none ( const char *  file,
int  line,
const char *  message,
Option< T > &  t 
)
template<typename T >
const T& _check_not_none ( const char *  file,
int  line,
const char *  message,
const Option< T > &  t 
)
template<typename T >
Option<Error> _check_some ( const Option< T > &  o)
template<typename T , typename E >
Option<Error> _check_some ( const Try< T, E > &  t)
template<typename T >
Option<Error> _check_some ( const Result< T > &  r)