jle_cpp_tk  0.0 2015-04-03 sh1:"d699093732dd5f321606d0ff7a6b63b229f1922c"
A small, safe, selft contained, soft-realtime C++ toolkit
jle Namespace Reference

generic namespace More...

Namespaces

 al
 small helpers for alarms
 
 chrono
 Here we have helpers and functions for time_point and durations.
 

Classes

struct  alarm
 
class  dbl
 
class  enable_shared_from_this
 Base class allowing use of member function shared_from_this. More...
 
struct  in_place_t
 Tag type for in-place construction. More...
 
class  list
 
class  map
 
class  non_copyable
 
struct  nullopt_t
 
class  optional
 Class template for optional values. More...
 
struct  owner_less
 Primary template owner_less. More...
 
struct  owner_less< shared_ptr< _Tp > >
 Partial specialization of owner_less for shared_ptr. More...
 
struct  owner_less< weak_ptr< _Tp > >
 Partial specialization of owner_less for weak_ptr. More...
 
class  set
 
class  shared_ptr
 A safe std smart pointer WRAPPER. More...
 
class  signal
 signal instance to connect and emit More...
 
class  signal_receptor
 Any object connected to signals, has to inherit from signal_receptor. More...
 
class  vector
 
class  weak_ptr
 A safe std weak_ptr WRAPPER. More...
 

Typedefs

template<typename... T>
using tuple = typename std::tuple< T... >
 

Functions

void write_time (std::ostream &os, const chrono::time_point &tp)
 
void write_body (std::ostream &os, const al::base_alarm &a)
 
std::ostream & operator<< (std::ostream &os, const ::jle::alarm &a)
 
void alarm_msg (const alarm &error)
 
std::ostream & operator<< (std::ostream &os, const jle::alarm &a)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const jle::list< T > &l)
 
dbl pow (const dbl &base, const dbl &exp)
 as double version std::
 
dbl log (const dbl &d)
 as double version std::
 
dbl exp (const dbl &d)
 as double version std::
 
int get_decimals10 (const dbl &d)
 Get number of decimals base 10 (aprox) More...
 
std::ostream & operator<< (std::ostream &os, const dbl &d)
 
dbl operator+ (const dbl &d1, const dbl &d2)
 
dbl operator- (const dbl &d1, const dbl &d2)
 
dbl operator* (const dbl &d1, const dbl &d2)
 
dbl operator/ (const dbl &d1, const dbl &d2)
 
dbloperator+= (dbl &d1, const dbl &d2)
 
dbloperator-= (dbl &d1, const dbl &d2)
 
dbloperator*= (dbl &d1, const dbl &d2)
 
dbloperator/= (dbl &d1, const dbl &d2)
 
bool operator== (const dbl &_d1, const dbl &_d2)
 
bool operator!= (const dbl &d1, const dbl &d2)
 
bool operator< (const dbl &d1, const dbl &d2)
 
bool operator<= (const dbl &d1, const dbl &d2)
 
bool operator> (const dbl &d1, const dbl &d2)
 
bool operator>= (const dbl &d1, const dbl &d2)
 
void bypass_sigfpe (int)
 
void init_handle_signal_FPE_intdiv0 (void)
 
template<typename _Tp >
constexpr bool operator== (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator!= (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator< (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator> (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator<= (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator>= (const optional< _Tp > &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator== (const optional< _Tp > &__lhs, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator== (nullopt_t, const optional< _Tp > &__rhs) noexcept
 
template<typename _Tp >
constexpr bool operator!= (const optional< _Tp > &__lhs, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator!= (nullopt_t, const optional< _Tp > &__rhs) noexcept
 
template<typename _Tp >
constexpr bool operator< (const optional< _Tp > &, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator< (nullopt_t, const optional< _Tp > &__rhs) noexcept
 
template<typename _Tp >
constexpr bool operator> (const optional< _Tp > &__lhs, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator> (nullopt_t, const optional< _Tp > &) noexcept
 
template<typename _Tp >
constexpr bool operator<= (const optional< _Tp > &__lhs, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator<= (nullopt_t, const optional< _Tp > &) noexcept
 
template<typename _Tp >
constexpr bool operator>= (const optional< _Tp > &, nullopt_t) noexcept
 
template<typename _Tp >
constexpr bool operator>= (nullopt_t, const optional< _Tp > &__rhs) noexcept
 
template<typename _Tp >
constexpr bool operator== (const optional< _Tp > &__lhs, const _Tp &__rhs)
 
template<typename _Tp >
constexpr bool operator== (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator!= (const optional< _Tp > &__lhs, _Tp const &__rhs)
 
template<typename _Tp >
constexpr bool operator!= (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator< (const optional< _Tp > &__lhs, const _Tp &__rhs)
 
template<typename _Tp >
constexpr bool operator< (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator> (const optional< _Tp > &__lhs, const _Tp &__rhs)
 
template<typename _Tp >
constexpr bool operator> (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator<= (const optional< _Tp > &__lhs, const _Tp &__rhs)
 
template<typename _Tp >
constexpr bool operator<= (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
constexpr bool operator>= (const optional< _Tp > &__lhs, const _Tp &__rhs)
 
template<typename _Tp >
constexpr bool operator>= (const _Tp &__lhs, const optional< _Tp > &__rhs)
 
template<typename _Tp >
void swap (optional< _Tp > &__lhs, optional< _Tp > &__rhs) noexcept(noexcept(__lhs.swap(__rhs)))
 
template<typename _Tp >
constexpr optional< std::decay_t< _Tp > > make_optional (_Tp &&__t)
 
template<typename _Tp >
std::ostream & operator<< (std::ostream &os, const jle::optional< _Tp > &opt)
 
template<typename _Tp1 , typename _Tp2 >
bool operator== (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator== (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator== (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp1 , typename _Tp2 >
bool operator!= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator!= (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator!= (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp1 , typename _Tp2 >
bool operator< (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator< (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator< (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp1 , typename _Tp2 >
bool operator<= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator<= (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator<= (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp1 , typename _Tp2 >
bool operator> (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator> (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator> (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp1 , typename _Tp2 >
bool operator>= (const shared_ptr< _Tp1 > &__a, const shared_ptr< _Tp2 > &__b)
 
template<typename _Tp >
bool operator>= (const shared_ptr< _Tp > &__a, nullptr_t)
 
template<typename _Tp >
bool operator>= (nullptr_t, const shared_ptr< _Tp > &__a)
 
template<typename _Tp >
void swap (shared_ptr< _Tp > &__a, shared_ptr< _Tp > &__b)
 
template<typename _Tp , typename _Tp1 >
shared_ptr< _Tp > static_pointer_cast (const shared_ptr< _Tp1 > &__r)
 
template<typename _Tp , typename _Tp1 >
shared_ptr< _Tp > const_pointer_cast (const shared_ptr< _Tp1 > &__r)
 
template<typename _Tp , typename _Tp1 >
shared_ptr< _Tp > dynamic_pointer_cast (const shared_ptr< _Tp1 > &__r)
 
template<typename _Tp >
void swap (weak_ptr< _Tp > &__a, weak_ptr< _Tp > &__b)
 
template<typename _Tp , typename... _Args>
shared_ptr< _Tp > make_shared (_Args &&...__args)
 Create an object that is owned by a shared_ptr. More...
 
std::string s_trim (const std::string &s, char char2remove)
 remove from left and right char2remove from string s
 
std::string s_trim (const std::string &s, const std::string &chars2remove)
 remove from left and right all chars in chars2remove from string s
 
std::string s_2lower (const std::string &s)
 
std::string s_2upper (const std::string &s)
 
std::tuple< chrono::duration, bool > s_try_s2dur (const std::string &s, const chrono::duration &def_val)
 try to convert from string to jle::duration possible formats... More...
 
std::tuple< chrono::time_point, bool > s_try_s2tp (const std::string &s, const chrono::time_point &defVal)
 try to convert from string to jle::time_point possible formats... More...
 
jle::vector< std::string > s_split (const std::string &s, const std::string &separator, bool remove_empty=false)
 divide string s with separator s_split("a b c") -> ["a", "b", "c"] s_split("a b c") -> ["a", "", "b", "c"] More...
 
std::tuple< double, bool > s_try_s2d (const std::string &s, double def_val)
 try to convert from string to double
 
std::tuple< int, bool > s_try_s2i (const std::string &s, int def_val)
 try to convert from string to integer
 
std::string s_align_left (const std::string &s, int size, char char_fill)
 
std::string s_align_right (const std::string &s, int size, char char_fill)
 
std::string s_normalize_utf8 (const std::string &s)
 return a valid utf8 string from a raw one If char is "special" as á, é, í, ó, ú, ñ, ü (and uppercases) it will be converted to utf8. Other weird values will be replaced by "_"
 
std::string align_cols (const std::string &text)
 format in columns separated by spaces align_cols("aa, b, cccc, dd, eee\n. . . ............ .")
 

Variables

jmp_buf env_jmp_div0
 
bool init_jump_div0 = false
 
constexpr nullopt_t nullopt { nullopt_t::_Construct::_Token }
 
constexpr in_place_t in_place { }
 Tag for in-place construction.
 
const int SIGNAL_SLOT_MAX_DEEP_EMIT = 20
 

Detailed Description

generic namespace

Function Documentation

int jle::get_decimals10 ( const dbl d)

Get number of decimals base 10 (aprox)

This is not exact but quit accurate

template<typename _Tp , typename... _Args>
shared_ptr<_Tp> jle::make_shared ( _Args &&...  __args)
inline

Create an object that is owned by a shared_ptr.

Parameters
__argsArguments for the _Tp object's constructor.
Returns
A shared_ptr that owns the newly created object.
Exceptions
std::bad_alloc,oran exception thrown from the constructor of _Tp.
std::tuple< chrono::duration, bool > jle::s_try_s2dur ( const std::string &  s,
const chrono::duration def_val 
)

try to convert from string to jle::duration possible formats...

  • 1d
  • 1d4h
  • 4h5m
  • 5m
  • 3s 895ms
  • 5s
  • 123ms
  • 3500ms
Examples:
/core/ex_jle_string.cpp.
std::tuple< jle::chrono::time_point, bool > jle::s_try_s2tp ( const std::string &  s,
const chrono::time_point defVal 
)

try to convert from string to jle::time_point possible formats...

  • 2015-03-29 09:16:33.123
  • 2015-03-29
jle::vector< std::string > jle::s_split ( const std::string &  s,
const std::string &  separator,
bool  remove_empty = false 
)

divide string s with separator s_split("a b c") -> ["a", "b", "c"] s_split("a b c") -> ["a", "", "b", "c"]

s_split("a b c", true) -> ["a", "b", "c"]