libfoedus-core
FOEDUS Core Library
assorted_func.hpp File Reference
#include <stdint.h>
#include <iosfwd>
#include <string>
#include <typeinfo>
#include "foedus/assert_nd.hpp"
#include "foedus/cxx11.hpp"
#include "foedus/assorted/uniform_random.hpp"
Include dependency graph for assorted_func.hpp:

Go to the source code of this file.

Classes

struct  foedus::assorted::Hex
 Convenient way of writing hex integers to stream. More...
 
struct  foedus::assorted::HexString
 Equivalent to std::hex in case the stream doesn't support it. More...
 
struct  foedus::assorted::Top
 Write only first few bytes to stream. More...
 
struct  foedus::assorted::SpinlockStat
 Helper for SPINLOCK_WHILE. More...
 

Namespaces

 foedus
 Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
 
 foedus::assorted
 Assorted Methods/Classes that are too subtle to have their own packages.
 

Macros

#define SPINLOCK_WHILE(x)   for (foedus::assorted::SpinlockStat __spins; (x); __spins.yield_backoff())
 A macro to busy-wait (spinlock) with occasional pause. More...
 
#define STATIC_SIZE_CHECK_CONCAT_DETAIL(x, y)   x##y
 
#define STATIC_SIZE_CHECK_CONCAT(x, y)   STATIC_SIZE_CHECK_CONCAT_DETAIL(x, y)
 
#define STATIC_SIZE_CHECK_METHOD_NAME   STATIC_SIZE_CHECK_CONCAT(_dummy_static_size_check, __COUNTER__)
 
#define STATIC_SIZE_CHECK(desired, actual)
 
#define INSTANTIATE_ALL_INTEGER_TYPES(M)
 INSTANTIATE_ALL_NUMERIC_TYPES minus bool/double/float. More...
 
#define INSTANTIATE_ALL_INTEGER_PLUS_BOOL_TYPES(M)
 INSTANTIATE_ALL_TYPES minus std::string/float/double. More...
 
#define INSTANTIATE_ALL_NUMERIC_TYPES(M)
 INSTANTIATE_ALL_TYPES minus std::string. More...
 
#define INSTANTIATE_ALL_TYPES(M)
 A macro to explicitly instantiate the given template for all types we care. More...
 

Functions

template<typename T , uint64_t ALIGNMENT>
foedus::assorted::align (T value)
 Returns the smallest multiply of ALIGNMENT that is equal or larger than the given number. More...
 
template<typename T >
foedus::assorted::align8 (T value)
 8-alignment. More...
 
template<typename T >
foedus::assorted::align16 (T value)
 16-alignment. More...
 
template<typename T >
foedus::assorted::align64 (T value)
 64-alignment. More...
 
int64_t foedus::assorted::int_div_ceil (int64_t dividee, int64_t dividor)
 Efficient ceil(dividee/dividor) for integer. More...
 
std::string foedus::assorted::replace_all (const std::string &target, const std::string &search, const std::string &replacement)
 target.replaceAll(search, replacement). More...
 
std::string foedus::assorted::replace_all (const std::string &target, const std::string &search, int replacement)
 target.replaceAll(search, String.valueOf(replacement)). More...
 
std::string foedus::assorted::os_error ()
 Thread-safe strerror(errno). More...
 
std::string foedus::assorted::os_error (int error_number)
 This version receives errno. More...
 
std::string foedus::assorted::get_current_executable_path ()
 Returns the full path of current executable. More...
 
void foedus::assorted::spinlock_yield ()
 Invoke _mm_pause(), x86 PAUSE instruction, or something equivalent in the env. More...
 
template<uint64_t SIZE1, uint64_t SIZE2>
int foedus::assorted::static_size_check ()
 Alternative for static_assert(sizeof(foo) == sizeof(bar), "oh crap") to display sizeof(foo). More...
 
std::string foedus::assorted::demangle_type_name (const char *mangled_name)
 Demangle the given C++ type name if possible (otherwise the original string). More...
 
template<typename T >
std::string foedus::assorted::get_pretty_type_name ()
 Returns the name of the C++ type as readable as possible. More...
 
uint64_t foedus::assorted::generate_almost_prime_below (uint64_t threshold)
 Generate a prime or some number that is almost prime less than the given number. More...
 

Macro Definition Documentation

#define STATIC_SIZE_CHECK (   desired,
  actual 
)
Value:
foedus::assorted::static_size_check< desired, actual >();\
}
#define STATIC_SIZE_CHECK_METHOD_NAME

Definition at line 264 of file assorted_func.hpp.

#define STATIC_SIZE_CHECK_CONCAT (   x,
 
)    STATIC_SIZE_CHECK_CONCAT_DETAIL(x, y)

Definition at line 261 of file assorted_func.hpp.

#define STATIC_SIZE_CHECK_CONCAT_DETAIL (   x,
 
)    x##y

Definition at line 260 of file assorted_func.hpp.

#define STATIC_SIZE_CHECK_METHOD_NAME   STATIC_SIZE_CHECK_CONCAT(_dummy_static_size_check, __COUNTER__)

Definition at line 262 of file assorted_func.hpp.