Thrill  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
die.hpp File Reference
#include <cstring>
#include <sstream>
#include <string>
+ Include dependency graph for die.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 tlx
 

Macros

#define assert_equal(X, Y)   die_unequal(X, Y)
 
#define die(msg)
 Instead of abort(), throw the output the message via an exception. More...
 
#define die_if(X)
 
#define die_unequal(X, Y)
 
#define die_unless(X)
 
#define die_unless_throws(code, exception_type)
 Define to check that [code] throws and exception of given type. More...
 
#define die_with_sstream(msg)
 Instead of abort(), throw the output the message via an exception. More...
 

Functions

template<typename TypeA , typename TypeB >
bool die_equal_compare (TypeA a, TypeB b)
 helper method to compare two values in die_unequal() More...
 
template<>
bool die_equal_compare (const char *a, const char *b)
 
template<>
bool die_equal_compare (float a, float b)
 
template<>
bool die_equal_compare (double a, double b)
 
void die_with_message (const std::string &msg)
 die with message - either throw an exception or die via abort() More...
 
void die_with_message (const char *msg, const char *file, size_t line)
 die with message - either throw an exception or die via abort() More...
 
void die_with_message (const std::string &msg, const char *file, size_t line)
 die with message - either throw an exception or die via abort() More...
 

Macro Definition Documentation

#define assert_equal (   X,
 
)    die_unequal(X, Y)

Check that X == Y or die miserably, but output the values of X and Y for better debugging. Only active if NDEBUG is not defined.

Definition at line 113 of file die.hpp.

Referenced by examples::suffix_sorting::DC7Recursive().

#define die (   msg)
Value:
do { \
die_with_sstream("DIE: " << msg); \
} while (false)
#define die_with_sstream(msg)
Instead of abort(), throw the output the message via an exception.
Definition: die.hpp:33

Instead of abort(), throw the output the message via an exception.

Examples:
examples/tutorial/k-means_step5.cpp, and examples/tutorial/k-means_step6.cpp.

Definition at line 42 of file die.hpp.

Referenced by Pool::allocate(), BlockPool::AllocateByteBlock(), Dispatcher::MpiAsync::connection(), ActionNode::DecConsumeCounter(), File::GetReaderAt(), thrill::vfs::Hdfs3Glob(), thrill::vfs::Hdfs3OpenReadStream(), thrill::vfs::Hdfs3OpenWriteStream(), ActionNode::IncConsumeCounter(), thrill::net::mpi::Initialize(), JsonLogger::JsonLogger(), DIA< ValueType_, Stack_ >::Keep(), LoadPoints(), main(), ZipNode< ValueType, ZipFunction, Pad, UnequalCheck, NoRebalance, kNumInputs >::MainOp(), ZipWindowNode< ValueType, ZipFunction_, Pad_, UnequalCheck, UseStdArray, kNumInputs_ >::MainOp(), MergeNode< ValueType, Comparator, kNumInputs >::MainOp(), thrill::vfs::MakeBZip2ReadFilter(), thrill::vfs::MakeBZip2WriteFilter(), thrill::vfs::MakeGZipReadFilter(), thrill::vfs::MakeGZipWriteFilter(), BlockReader< CatBlockSource >::Next(), HyperLogLogRegisters< p >::operator+(), ReadBinaryNode< ValueType >::ReadBinaryNode(), ReadLinesNode::ReadLinesNode(), RunKMeansFile(), RunKMeansGenerated(), RunPageRankGenerated(), RunPageRankJoinGenerated(), RunStochasticGradFile(), thrill::vfs::S3Glob(), thrill::vfs::S3OpenReadStream(), thrill::vfs::S3OpenWriteStream(), ActionNode::SetConsumeCounter(), thrill::vfs::SysGlob(), and File::~File().

#define die_if (   X)
Value:
do { \
if (X) { \
"DIE: Assertion \"" #X "\" succeeded!", __FILE__, __LINE__); \
} \
} while (false)
void die_with_message(const std::string &msg)
die with message - either throw an exception or die via abort()
Definition: die.cpp:18

Check condition X and die miserably if true. Opposite of assert() except this is also active in Release mode.

Definition at line 62 of file die.hpp.

#define die_unequal (   X,
 
)
Value:
do { \
auto x__ = (X); /* NOLINT */ \
auto y__ = (Y); /* NOLINT */ \
if (!::tlx::die_equal_compare(x__, y__)) \
die_with_sstream("DIE-UNEQUAL: " #X " != " #Y " : " \
"\"" << x__ << "\" != \"" << y__ << "\""); \
} while (false)
bool die_equal_compare(TypeA a, TypeB b)
helper method to compare two values in die_unequal()
Definition: die.hpp:75
#define die_with_sstream(msg)
Instead of abort(), throw the output the message via an exception.
Definition: die.hpp:33

Check that X == Y or die miserably, but output the values of X and Y for better debugging.

Definition at line 99 of file die.hpp.

Referenced by Pool::AllocateFreeArena(), AsyncReadBuffer::DoCallback(), AsyncReadByteBlock::DoCallback(), main(), BlockPool::OnWriteComplete(), Pool::print(), Connection::SyncRecv(), and BlockPool::~BlockPool().

#define die_unless (   X)
Value:
do { \
if (!(X)) { \
"DIE: Assertion \"" #X "\" failed!", __FILE__, __LINE__); \
} \
} while (false)
void die_with_message(const std::string &msg)
die with message - either throw an exception or die via abort()
Definition: die.cpp:18

Check condition X and die miserably if false. Same as assert() except this is also active in Release mode.

Definition at line 52 of file die.hpp.

Referenced by Pool::AllocateFreeArena(), BitStreamWriter< BlockWriter >::BitStreamWriter(), BlockPool::BlockPool(), Multiplexer::Close(), examples::suffix_sorting::DC3Recursive(), examples::suffix_sorting::DC7Recursive(), Pool::deallocate(), BlockPool::DecBlockPinCount(), BlockPool::DestroyBlock(), Dispatcher::DispatchOne(), BlockPool::EvictBlock(), BlockReader< CatBlockSource >::GetItemBatch(), GolombBitStreamWriter< BlockWriter >::GolombBitStreamWriter(), BlockPool::IncBlockPinCount(), SelectDispatcher::Interrupt(), main(), Vector< D, double >::Make(), Multiplexer::OnCatStreamBlock(), Multiplexer::OnMixStreamBlock(), Multiplexer::OnMultiplexerHeader(), BlockPool::OnReadComplete(), MixStreamData::OnStreamBlock(), CatStreamData::OnStreamBlock(), MixStreamData::OnStreamBlockOrdered(), CatStreamData::OnStreamBlockOrdered(), BlockPool::OnWriteComplete(), thrill::vfs::OpenReadStream(), BlockPool::PinBlock(), Pool::print(), Vector< D, double >::Random(), ReadInputFile(), MergeNode< ValueType, Comparator, kNumInputs >::SearchStep(), thrill::api::TopoSortVisit(), and BlockPool::~BlockPool().

#define die_unless_throws (   code,
  exception_type 
)
Value:
do { \
try { \
code; \
} \
catch (const exception_type&) { \
break; \
} \
"DIE-UNLESS-THROWS: " #code " - NO EXCEPTION " #exception_type, \
__FILE__, __LINE__); \
} while (false)
void die_with_message(const std::string &msg)
die with message - either throw an exception or die via abort()
Definition: die.cpp:18

Define to check that [code] throws and exception of given type.

Definition at line 120 of file die.hpp.

#define die_with_sstream (   msg)
Value:
do { \
std::ostringstream oss__; \
oss__ << msg << " @ " << __FILE__ << ':' << __LINE__; \
::tlx::die_with_message(oss__.str()); \
std::terminate(); \
} while (false)
void die_with_message(const std::string &msg)
die with message - either throw an exception or die via abort()
Definition: die.cpp:18

Instead of abort(), throw the output the message via an exception.

Definition at line 33 of file die.hpp.