libpsynth 0.2.1
Namespaces | Classes | Typedefs | Functions
psynth::base Namespace Reference

Namespaces

namespace  detail

Classes

class  parse_error
 A parsing error. More...
class  option
 The interface of an option of the argument parser. More...
class  option_generic
 Option that catches the argument and stores its value, converted to any desired type. More...
class  option_flag
 A boolan option that is set to true if the option exists. More...
class  option_not_flag
 A boolan option that is set to true if the option exists. More...
class  option_stream
 Option that parses the param using a stringstream. More...
class  arg_parser
 Class for parsing program arguments. More...
struct  direct_superclasses
struct  all_superclasses
struct  generate_c3_hierarchy
struct  get_c3_type
struct  DefaultConstructible
struct  CopyConstructible
struct  Assignable
struct  EqualityComparable
struct  SameType
struct  Swappable
struct  Regular
struct  Metafunction
class  conf_backend_xml
 XML configuration backend that stores the config to an XML file. More...
class  conf_listener
 A configuration node listener to aid you when you are interested in all the signals emitted by a conf_subject. More...
class  conf_subject
 The psynth class of an observable configuration node. More...
class  conf_backend
 A backend for a config system. More...
class  conf_node
 A configuration node. More...
struct  config
 Singleton conf_node to store the global config. More...
class  exception
 Base class for all the exceptions inside the framework. More...
class  error_base
 A base clase for the errors defined with PSYNTH_DECLARE_ERROR and alike preprocessor commands. More...
class  factory_base
class  factory
class  restricted_factory_manager
 A factory manager that is mutable through special detail::factory_access class. More...
class  factory_manager
struct  factory_registrant
struct  global_factory_manager
struct  restricted_global_factory_manager
class  path_predicate
class  has_extension
class  file_finder
class  file_mgr_node
struct  dynamic_functor
 Useful when we need polymorphic functors. More...
struct  fn_dynamic_functor
class  hetero_deque
 A deque of constant size over polymorphic types with a common base. More...
class  ptr_iterator
class  ptr_const_iterator
class  map_iterator
 This class acts as wrapper to a map::iterator. More...
class  map_const_iterator
 This class acts as wrapper to a map::const_iterator. More...
class  map_iterator_base
class  map_const_iterator_base
class  map_key_iterator
 This class acts as wrapper to a map::iterator. More...
class  log_stream_adapter
 A iostreams alike adapter for a log. More...
class  log_stream_adapter_wrapper
 This allow to wrap the log_stream_adapter into a wrapper that flushes the log_stream when the last copy is destroyed. More...
class  log_sink
 Interface of a log sink. More...
class  log
 A logger node. More...
struct  logger
 Root singleton Log to log global messages. More...
class  log_std_sink
 Simple log sink that logs messages to cout and cerr. More...
class  log_stream_sink
 Logs messages to a standard stream. More...
class  log_file_sink
 Outputs to stream file. More...
struct  safe_front
struct  safe_pop_front
struct  concat
struct  every_p
struct  any_p
struct  join
struct  flatten
struct  pair_seq
class  listener_base
 This should be the base of all listener types. More...
class  subject_base
 This provides a basic interface for an observable entity and some helper functions. More...
class  option_conf
 An arg_parser option that receives an argument and stores it in a conf_node. More...
class  option_conf< std::string >
 Optimized version of OptionConf for strings. More...
class  option_conf_value
 An arg_parser option that sets a conf_node to a given value if the option is parsed. More...
struct  deleter
 Functor for the delete operator, usefull to clear pointer containers with for_each. More...
class  null_ptr
class  manage_me_ptr
class  mgr_ptr
class  mgr_auto_ptr
class  mgr_container
class  mgr_assoc
class  scope_guard_impl_base
class  scope_guard_impl
class  singleton_holder
 This is a generic singleton implementation. More...
struct  create_with_new
 Creator singleton policy that uses new and delete to allocate and free the singleton. More...
struct  create_with_malloc
 Creator singleton policy that uses std::malloc and std::free to allocate and free the singleton. More...
struct  create_with_static
 Creator policy that creates the singleton in static memory. More...
struct  create_with
 Creator policy that uses a allocator satisfying the std::allocator interface to build an destroy the singleton. More...
struct  lifetime_atexit
 Lifetime singleton policy that destroys the singleton in the atexit invocation sequence. More...
struct  lifetime_static_dtor
 Lifetime singleton policy that destroys the singleton on the static destructors invocation sequence. More...
class  lifetime_phoenix
 Singleton lifetime policy that re-creates the singleton if it has already been destroyed. More...
struct  lifetime_no_destroy
 Lifetime policy for the singleton class that never destroys the singleton. More...
struct  try_lock_guard
 try_lock_guard, lock_guard and no_lock_guard provide a way to design policies that are not bases just on object or class locking, but fine-grainedly control wether some internal construct should have exclusion, probabilistic exclusion or no exclusion at all. More...
struct  lock_guard
struct  no_lock_guard
class  no_threading
class  lockable_base
class  object_lockable
class  class_lockable
class  throw_with
class  timer
 A class for counting time and forcing update rates. More...
struct  tree_node_traits
 Traits that provide additional information about how to make paths out of a key. More...
struct  tree_node_traits< std::string >
class  tree_node
 A tree node. More...
struct  pointee
struct  pointee< typename std::unique_ptr< T > >
struct  pointee< typename std::shared_ptr< T > >
struct  pointer
struct  pointer< Ptr * >
struct  pointer< std::unique_ptr< Ptr > >
struct  pointer< std::shared_ptr< Ptr > >
struct  pointer< std::auto_ptr< Ptr > >
class  type_value
 A typeid wrapper that have value semantics. More...
struct  tpl_bind_snd
struct  tpl_bind_fst
struct  nop_ostream
struct  equal_id
class  vector_2d
 A bidimensional vector type that can hold any scalar type. More...

Typedefs

typedef option_generic< int,
detail::atoi_func > 
option_int
 An int option.
typedef option_generic< float,
detail::atof_func > 
option_float
 A float option.
typedef option_generic
< std::string > 
option_string
 A std::string option.
typedef option_generic< const
char * > 
option_cstring
 A cstring option.
typedef singleton_holder
< file_mgr_node > 
file_manager
typedef const
scope_guard_impl_base & 
scope_guard
typedef void(* destroy_func_t )()
 Type of the destroy function to be registered on the lifetime policies.
typedef tpl_bind_snd
< object_lockable,
PSYNTH_DEFAULT_MUTEX > 
default_object_lockable
typedef tpl_bind_snd
< class_lockable,
PSYNTH_DEFAULT_MUTEX > 
default_class_lockable
typedef vector_2d< float > vector_2f
 A bidimensional vector of floats.

Functions

 PSYNTH_DEFINE_ERROR_WHAT (parse_option_error,"Error while parsing option parameter.") namespace
template<typename C >
void psynth_function_requires ()
 PSYNTH_DEFINE_ERROR (config_error)
 PSYNTH_DEFINE_ERROR_WHAT (config_type_error,"Config node type mismatch.")
 PSYNTH_DEFINE_ERROR_WHAT (config_backend_error,"Config node has no backend.")
 PSYNTH_DECLARE_ERROR (error, config_error)
 PSYNTH_DECLARE_ERROR (config_error, config_type_error)
 PSYNTH_DECLARE_ERROR (config_error, config_backend_error)
 PSYNTH_DEFINE_ERROR (error)
int default_error_level () throw ()
 PSYNTH_DECLARE_ERROR (error_base, error)
 PSYNTH_DEFINE_ERROR_WHAT (factory_error,"Unknown factory key.")
 PSYNTH_DECLARE_ERROR (error, factory_error)
template<class IterType >
has_extension< IterType > make_has_extension (IterType first, IterType last)
 PSYNTH_DEFINE_ERROR_WHAT (hetero_deque_empty,"Can not extract from empty deque.")
 PSYNTH_DECLARE_ERROR (error, hetero_deque_empty)
log_stream_adapter & flush (log_stream_adapter &s)
 Manipulator for flushing the stream.
template<typename T >
log_stream_adapter_wrapper operator<< (log_stream_adapter_wrapper s, T p)
log_stream_adapter & operator<< (log_stream_adapter &s, log::level x)
template<class T >
log_stream_adapter & operator<< (log_stream_adapter &s, const T &x)
log_stream_adapter & operator<< (log_stream_adapter &stm, log_stream_adapter &(*func)(log_stream_adapter &))
 PSYNTH_DECLARE_SHARED_TYPE (log_sink)
 PSYNTH_DECLARE_SHARED_TYPE (log_stream_sink)
 PSYNTH_DECLARE_SHARED_TYPE (log_file_sink)
 PSYNTH_DECLARE_SHARED_TYPE (log_std_sink)
 PSYNTH_DECLARE_TYPE (log)
 PSYNTH_DECLARE_TYPE (log_stream_adapter)
 PSYNTH_DECLARE_TYPE (logger)
const char * get_extension (const char *file)
 Returns a pointer to the begining of the extension part of a file name string, defined as the first character after the last dot in the string or the begining of the string if no dot is in it.
int strcmp_i (const char *a, const char *b)
 Compares two strings without being case sensible.
char * itoa (int val, int base)
 Returns a the string representation of an integer.
char * ftoa (double f, double sigfigs)
 Returns a the string representation of a floating point.
string dirname_str (string str)
template<class T >
T clamp (T x, T min, T max)
template<typename T >
T sign (T x)
 Returns the sign of a number or zero if zero.
template<class T >
T phase (T x)
 Returns the fractional part of a number.
template<class T >
T linear_interp (T val, T next, T delta)
 Returns the linear interpolation between to values.
std::string dirname_str (std::string str)
 String implementation of dirname.
template<class T >
manage_me_ptr< T > manage (T *ptr)
template<typename Fun >
scope_guard_impl< Fun > make_guard (const Fun &fun)
 PSYNTH_DECLARE_ERROR (error, singleton_error)
 The error that lifetime policies should throw in case of dead reference access.
template<class Mutex , typename... Args>
std::unique_lock< Mutex > make_unique_lock (Mutex &lock, Args...args)
 Utility to avoid writing too many types when locking mutexes.
template<class E , typename T >
throw_with< E > operator<< (throw_with< E > ts, const T &what)
 PSYNTH_DEFINE_ERROR (tree_node_error)
 PSYNTH_DECLARE_ERROR (error, tree_node_error)
 Exception for this type.
bool operator== (const type_value &lhs, const type_value &rhs)
bool operator< (const type_value &lhs, const type_value &rhs)
bool operator!= (const type_value &lhs, const type_value &rhs)
bool operator> (const type_value &lhs, const type_value &rhs)
bool operator<= (const type_value &lhs, const type_value &rhs)
bool operator>= (const type_value &lhs, const type_value &rhs)
template<typename T >
void ignore_unused_variable_warning (T &&)
template<typename T >
PSYNTH_FORCEINLINE const
nop_ostream & 
operator<< (const nop_ostream &s, const T &)
template<typename Ptr1 , typename Ptr2 >
bool equal_ptr (Ptr1 a, Ptr2 b)
 Utility to compare for equality pointers with weird comparison semantics like std::shared_ptr.
template<typename A >
equal_id< A > make_equal_id (const A &e)
template<class T >
std::ostream & operator<< (std::ostream &os, const psynth::base::vector_2d< T > v)
 Output stream operator for the vector class.
template<typename IntTypes , typename ValueType >
ValueType at_c (std::size_t index)
 Given an MPL Random Access Sequence and a dynamic index n, returns the value of the n-th element It constructs a lookup table at compile time.

Typedef Documentation

typedef void(* psynth::base::destroy_func_t)()

Type of the destroy function to be registered on the lifetime policies.

A cstring option.

A float option.

An int option.

A std::string option.

A bidimensional vector of floats.


Function Documentation

template<typename IntTypes , typename ValueType >
ValueType psynth::base::at_c ( std::size_t  index) [inline]

Given an MPL Random Access Sequence and a dynamic index n, returns the value of the n-th element It constructs a lookup table at compile time.

template<class T >
T psynth::base::clamp ( T  x,
T  min,
T  max 
) [inline]
int psynth::base::default_error_level ( ) throw ()
string psynth::base::dirname_str ( string  str)
std::string psynth::base::dirname_str ( std::string  str)

String implementation of dirname.

Returns everything that is before the last dash in the string.

Parameters:
strThe string where to extract the dirname.
template<typename Ptr1 , typename Ptr2 >
bool psynth::base::equal_ptr ( Ptr1  a,
Ptr2  b 
)

Utility to compare for equality pointers with weird comparison semantics like std::shared_ptr.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1590.html

log_stream_adapter& psynth::base::flush ( log_stream_adapter &  s) [inline]

Manipulator for flushing the stream.

char * psynth::base::ftoa ( double  f,
double  sigfigs 
)

Returns a the string representation of a floating point.

The returned value must not be freed by the user because it is statically defined in the function and so new calls invalidates old returned value and it is not thread safe.

Parameters:
fThe value to convert to string.
sigfigsThe number of significant
const char * psynth::base::get_extension ( const char *  file)

Returns a pointer to the begining of the extension part of a file name string, defined as the first character after the last dot in the string or the begining of the string if no dot is in it.

template<typename T >
void psynth::base::ignore_unused_variable_warning ( T &&  )
char * psynth::base::itoa ( int  val,
int  base 
)

Returns a the string representation of an integer.

The returned value must not be freed by the user because it is statically defined in the function and so new calls invalidates old returned value and it is not thread safe.

Parameters:
valThe value to represent as a string.
baseThe numerical base in which we want to represent the number.
template<class T >
T psynth::base::linear_interp ( T  val,
T  next,
T  delta 
) [inline]

Returns the linear interpolation between to values.

Parameters:
valThe center value to interpolate.
nextThe next value to interpolate.
deltaThe percentage between the two values.
template<typename A >
equal_id<A> psynth::base::make_equal_id ( const A &  e)
template<typename Fun >
scope_guard_impl<Fun> psynth::base::make_guard ( const Fun &  fun)
template<class IterType >
has_extension<IterType> psynth::base::make_has_extension ( IterType  first,
IterType  last 
)
template<class Mutex , typename... Args>
std::unique_lock<Mutex> psynth::base::make_unique_lock ( Mutex &  lock,
Args...  args 
)

Utility to avoid writing too many types when locking mutexes.

template<class T >
manage_me_ptr<T> psynth::base::manage ( T *  ptr)
bool psynth::base::operator!= ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
bool psynth::base::operator< ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
template<class E , typename T >
throw_with<E> psynth::base::operator<< ( throw_with< E >  ts,
const T &  what 
)
template<typename T >
log_stream_adapter_wrapper psynth::base::operator<< ( log_stream_adapter_wrapper  s,
T  p 
) [inline]
log_stream_adapter& psynth::base::operator<< ( log_stream_adapter &  s,
log::level  x 
) [inline]
log_stream_adapter& psynth::base::operator<< ( log_stream_adapter &  stm,
log_stream_adapter &(*)(log_stream_adapter &)  func 
) [inline]
template<class T >
log_stream_adapter& psynth::base::operator<< ( log_stream_adapter &  s,
const T &  x 
) [inline]
template<typename T >
PSYNTH_FORCEINLINE const nop_ostream& psynth::base::operator<< ( const nop_ostream &  s,
const T &   
)
template<class T >
std::ostream& psynth::base::operator<< ( std::ostream &  os,
const psynth::base::vector_2d< T >  v 
)

Output stream operator for the vector class.

Relies on the output stream operator of the T type stored in the vector.

bool psynth::base::operator<= ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
bool psynth::base::operator== ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
bool psynth::base::operator> ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
bool psynth::base::operator>= ( const type_value &  lhs,
const type_value &  rhs 
) [inline]
template<class T >
T psynth::base::phase ( T  x) [inline]

Returns the fractional part of a number.

Parameters:
xThe number to get its floating point part.
psynth::base::PSYNTH_DECLARE_ERROR ( config_error  ,
config_backend_error   
)
psynth::base::PSYNTH_DECLARE_ERROR ( error  ,
hetero_deque_empty   
)
psynth::base::PSYNTH_DECLARE_ERROR ( error  ,
config_error   
)
psynth::base::PSYNTH_DECLARE_ERROR ( error_base  ,
error   
)
psynth::base::PSYNTH_DECLARE_ERROR ( error  ,
singleton_error   
)

The error that lifetime policies should throw in case of dead reference access.

psynth::base::PSYNTH_DECLARE_ERROR ( error  ,
tree_node_error   
)

Exception for this type.

psynth::base::PSYNTH_DECLARE_ERROR ( error  ,
factory_error   
)
psynth::base::PSYNTH_DECLARE_ERROR ( config_error  ,
config_type_error   
)
psynth::base::PSYNTH_DECLARE_SHARED_TYPE ( log_sink  )
psynth::base::PSYNTH_DECLARE_SHARED_TYPE ( log_std_sink  )
psynth::base::PSYNTH_DECLARE_SHARED_TYPE ( log_stream_sink  )
psynth::base::PSYNTH_DECLARE_SHARED_TYPE ( log_file_sink  )
psynth::base::PSYNTH_DECLARE_TYPE ( logger  )
psynth::base::PSYNTH_DECLARE_TYPE ( log_stream_adapter  )
psynth::base::PSYNTH_DECLARE_TYPE ( log  )
psynth::base::PSYNTH_DEFINE_ERROR ( error  )
psynth::base::PSYNTH_DEFINE_ERROR ( config_error  )
psynth::base::PSYNTH_DEFINE_ERROR ( tree_node_error  )
psynth::base::PSYNTH_DEFINE_ERROR_WHAT ( config_backend_error  ,
"Config node has no backend."   
)
psynth::base::PSYNTH_DEFINE_ERROR_WHAT ( config_type_error  ,
"Config node type mismatch."   
)
psynth::base::PSYNTH_DEFINE_ERROR_WHAT ( factory_error  ,
"Unknown factory key."   
)
psynth::base::PSYNTH_DEFINE_ERROR_WHAT ( hetero_deque_empty  ,
"Can not extract from empty deque."   
)
psynth::base::PSYNTH_DEFINE_ERROR_WHAT ( parse_option_error  ,
"Error while parsing option parameter."   
)
template<typename C >
void psynth::base::psynth_function_requires ( )
template<typename T >
T psynth::base::sign ( T  x) [inline]

Returns the sign of a number or zero if zero.

int psynth::base::strcmp_i ( const char *  a,
const char *  b 
)

Compares two strings without being case sensible.

Returns:
-1 if a is less than b. 1 If a is greater than b. And 0 if a equals b.