Scarab Use and API Documentation¶
Scarab/Library Overview¶
Scarab/CMake Overview¶
API_Ref¶
library¶
library/authentication¶
library/authentication/authentication.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(mtlog, "authentication")
-
library/authentication/authentication.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
authentication
¶ - #include <authentication.hh>
Inherits from param_node
-
class
library/logger¶
library/logger/logger.cc¶
-
struct
Private
¶ -
Public Functions
-
namespace
scarab
¶ The standard scarab namespace.
library/logger/logger.hh¶
Contains the logger class and macros, based on Kasper’s KLogger class.
- Date
- Created on: 18.11.2011
- Author
- Marco Haag marco.haag@kit.edu
Defines
-
LOGGER_UTILITY_MACROS_
¶
-
va_num_args
(...)¶
-
va_num_args_impl
(_1, _2, _3, _4, _5, N, ...)¶
-
macro_dispatcher
(func, ...)¶
-
macro_dispatcher_
(func, nargs)¶
-
macro_dispatcher__
(func, nargs)¶
-
COLOR_NORMAL
¶
-
COLOR_BRIGHT
¶
-
COLOR_FOREGROUND_RED
¶
-
COLOR_FOREGROUND_GREEN
¶
-
COLOR_FOREGROUND_YELLOW
¶
-
COLOR_FOREGROUND_BLUE
¶
-
COLOR_FOREGROUND_CYAN
¶
-
COLOR_FOREGROUND_WHITE
¶
-
COLOR_PREFIX
¶
-
COLOR_SUFFIX
¶
-
COLOR_SEPARATOR
¶
-
__DEFAULT_LOGGER
¶
-
__LOG_LOCATION
¶
-
__LOG_LOG_4
(I, L, M, O)¶
-
__LOG_LOG_3
(I, L, M)¶
-
__LOG_LOG_2
(L, M)¶
-
__LOG_LOG_1
(M)¶
-
__LOG_TRACE_2
(I, M)¶
-
__LOG_TRACE_1
(M)¶
-
__LOG_DEBUG_2
(I, M)¶
-
__LOG_DEBUG_1
(M)¶
-
__LOG_INFO_2
(I, M)¶
-
__LOG_INFO_1
(M)¶
-
__LOG_PROG_2
(I, M)¶
-
__LOG_PROG_1
(M)¶
-
__LOG_WARN_2
(I, M)¶
-
__LOG_WARN_1
(M)¶
-
__LOG_ERROR_2
(I, M)¶
-
__LOG_ERROR_1
(M)¶
-
__LOG_FATAL_2
(I, M)¶
-
__LOG_FATAL_1
(M)¶
-
__LOG_ASSERT_3
(I, C, M)¶
-
__LOG_ASSERT_2
(C, M)¶
-
__LOG_LOG_ONCE_3
(I, L, M)¶
-
__LOG_LOG_ONCE_2
(L, M)¶
-
__LOG_LOG_ONCE_1
(M)¶
-
__LOG_TRACE_ONCE_2
(I, M)¶
-
__LOG_TRACE_ONCE_1
(M)¶
-
__LOG_DEBUG_ONCE_2
(I, M)¶
-
__LOG_DEBUG_ONCE_1
(M)¶
-
__LOG_INFO_ONCE_2
(I, M)¶
-
__LOG_INFO_ONCE_1
(M)¶
-
__LOG_WARN_ONCE_2
(I, M)¶
-
__LOG_WARN_ONCE_1
(M)¶
-
__LOG_ERROR_ONCE_2
(I, M)¶
-
__LOG_ERROR_ONCE_1
(M)¶
-
__LOG_FATAL_ONCE_2
(I, M)¶
-
__LOG_FATAL_ONCE_1
(M)¶
-
LOGGER
(I, K)¶
-
LOG
(...)¶
-
LTRACE
(...)¶
-
LDEBUG
(...)¶
-
LINFO
(...)¶
-
LPROG
(...)¶
-
LWARN
(...)¶
-
LERROR
(...)¶
-
LFATAL
(...)¶
-
LASSERT
(...)¶
-
LOG_ONCE
(...)¶
-
LTRACE_ONCE
(...)¶
-
LDEBUG_ONCE
(...)¶
-
LINFO_ONCE
(...)¶
-
LPROG_ONCE
(...)¶
-
LWARN_ONCE
(...)¶
-
LERROR_ONCE
(...)¶
-
LFATAL_ONCE
(...)¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
logger
¶ - #include <logger.hh>
The scarab logger.
The usage and syntax is inspired by log4j. logger itself uses the log4cxx library if it was available on the system during compiling, otherwise it falls back to std::stream.
The logger output can be configured in a file specified with the environment variable LOGGER_CONFIGURATION (by default log4cxx.properties in the config directory).
In most cases the following macro can be used to instantiate a Logger in your code:
This is equivalent to:
For logging the following macros can be used. The source code location will then automatically included in the output:
Public Types
Public Functions
-
logger
(const char *name = 0)¶ Standard constructor assigning a name to the logger instance.
- Parameters
name
: The logger name.
-
logger
(const std::string &name)¶ This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
~logger
()¶
-
bool
IsLevelEnabled
(ELevel level) const¶ Check whether a certain log-level is enabled.
- Return
- Parameters
level
: The log level
-
void
SetLevel
(ELevel level) const¶ Set a logger’s minimum logging level
- Parameters
level
: The log level
-
void
SetGlobalLevel
(ELevel level) const¶ Set all loggers’ minimum logging level
- Parameters
level
: The log level
-
void
Log
(ELevel level, const std::string &message, const Location &loc = Location ())¶ Log a message with the specified level. Use the macro LOG(logger, level, message).
- Parameters
level
: The log level.message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogTrace
(const std::string &message, const Location &loc = Location ())¶ Log a message at TRACE level. Use the macro LTRACE(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogDebug
(const std::string &message, const Location &loc = Location ())¶ Log a message at DEBUG level. Use the macro LDEBUG(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogInfo
(const std::string &message, const Location &loc = Location ())¶ Log a message at INFO level. Use the macro LINFO(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogProg
(const std::string &message, const Location &loc = Location ())¶ Log a message at PROG level. Use the macro PROG(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogWarn
(const std::string &message, const Location &loc = Location ())¶ Log a message at WARN level. Use the macro LWARN(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogError
(const std::string &message, const Location &loc = Location ())¶ Log a message at ERROR level. Use the macro LERROR(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
Public Static Functions
-
void
SetColored
(bool flag)¶ Set whether colored text will be used
- Parameters
flag
: Bool determining whether colored text will be used
-
void
SetOutStream
(std::ostream *stream)¶ Set the ostream pointer used for standard output messages
- Parameters
stream
: Stream object for standard output
-
void
SetErrStream
(std::ostream *stream)¶ Set the ostream pointer used for standard error messages
- Parameters
stream
: Stream object for standard errors
Private Members
-
Private *
fPrivate
¶
-
-
class
library/param¶
library/param/configurator.cc¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(slog, "configurator")
-
library/param/configurator.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
configurator
¶ - #include <configurator.hh>
Public Functions
-
configurator
(int an_argc, char **an_argv, scarab::param_node *a_default = NULL)¶
-
~configurator
()¶
-
const std::string &
exe_name
() const¶
-
scarab::param_node &
config
()¶
-
const scarab::param_node &
config
() const¶
-
bool
help_flag
() const¶
-
bool
version_flag
() const¶
- template <typename XReturnType>
-
XReturnType
get
(const std::string &a_name) const¶
- template <typename XReturnType>
-
XReturnType
get
(const std::string &a_name, XReturnType a_default) const¶
-
-
class
library/param/global_config.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
global_config
¶ - #include <global_config.hh>
Inherits from singleton< global_config >
Private Members
-
param_node
f_config
¶
Friends
-
friend
scarab::scarab::singleton< global_config >
-
friend
scarab::scarab::destroyer< global_config >
-
param_node
-
class
library/param/param.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
SCARAB_API std::ostream & operator<<(std::ostream & out, const param & a_value)
-
SCARAB_API std::ostream & operator<<(std::ostream & out, const param_value & a_value)
-
SCARAB_API std::ostream & operator<<(std::ostream & out, const param_array & a_value)
-
SCARAB_API std::ostream & operator<<(std::ostream & out, const param_node & a_value)
-
library/param/param.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
- template <>
-
template<>
std::stringget
<std::string>() const¶
-
class
param
¶ - #include <param.hh>
Subclassed by param_array, param_node, param_value
Public Functions
-
param
()¶
-
~param
()¶
-
bool
is_null
() const¶
-
bool
is_value
() const¶
-
bool
is_array
() const¶
-
bool
is_node
() const¶
-
param_value &
as_value
()¶
-
param_array &
as_array
()¶
-
param_node &
as_node
()¶
-
const param_value &
as_value
() const¶
-
const param_array &
as_array
() const¶
-
const param_node &
as_node
() const¶
-
const param_value &
operator()
() const¶ Assumes that the parameter is a value, and returns a reference to itself.
-
param_value &
operator()
()¶ Assumes that the parameter is a value, and returns a reference to itself.
-
const param &
operator[]
(unsigned a_index) const¶ Assumes that the parameter is an array, and returns a reference to the KTParam at aIndex. Behavior is undefined if aIndex is out-of-range.
-
param &
operator[]
(unsigned a_index)¶ Assumes that the parameter is an array, and returns a reference to the KTParam at aIndex. Behavior is undefined if aIndex is out-of-range.
-
const param &
operator[]
(const std::string &a_name) const¶ Assumes that the parameter is a node, and returns a reference to the KTParam corresponding to aName. Throws an KTException if aName is not present.
-
param &
operator[]
(const std::string &a_name)¶ Assumes that the parameter is a node, and returns a reference to the KTParam corresponding to aName. Adds a new Value if aName is not present.
-
std::string
to_string
() const¶
Public Static Attributes
-
SCARAB_API unsigned s_indent_level
= 0
-
-
class
param_array
¶ - #include <param.hh>
Inherits from param
Public Types
Public Functions
-
param_array
()¶
-
param_array
(const param_array &orig)¶
-
~param_array
()¶
-
param_array &
operator=
(const param_array &rhs)¶
-
bool
is_null
() const¶
-
bool
is_array
() const¶
-
unsigned
size
() const¶
-
bool
empty
() const¶
-
void
resize
(unsigned a_size)¶ sets the size of the array if smaller than the current size, extra elements are deleted
-
std::string
get_value
(unsigned a_index) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue
- template <typename XValType>
-
XValType
get_value
(unsigned a_index) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue
-
std::string
get_value
(unsigned a_index, const std::string &a_default) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue
-
std::string
get_value
(unsigned a_index, const char *a_default) const¶
- template <typename XValType>
-
XValType
get_value
(unsigned a_index, XValType a_default) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue
-
const param *
at
(unsigned a_index) const¶ Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.
-
param *
at
(unsigned a_index)¶ Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.
-
const param_value *
value_at
(unsigned a_index) const¶ Returns a pointer to the param_value (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
param_value *
value_at
(unsigned a_index)¶ Returns a pointer to the param_value (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
const param_array *
array_at
(unsigned a_index) const¶ Returns a pointer to the param_array (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
param_array *
array_at
(unsigned a_index)¶ Returns a pointer to the param_array (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
const param_node *
node_at
(unsigned a_index) const¶ Returns a pointer to the param_node (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
param_node *
node_at
(unsigned a_index)¶ Returns a pointer to the param_node (static-ly cast) corresponding to a_name. Returns NULL if a_name is not present.
-
const param &
operator[]
(unsigned a_index) const¶ Returns a reference to the param at a_index. Behavior is undefined if a_index is out-of-range.
-
param &
operator[]
(unsigned a_index)¶ Returns a reference to the param at a_index. Behavior is undefined if a_index is out-of-range.
-
void
append
(const param_array &an_array)¶
-
void
erase
(unsigned a_index)¶
-
void
clear
()¶
-
param_array::iterator
begin
()¶
-
param_array::const_iterator
begin
() const¶
-
param_array::iterator
end
()¶
-
param_array::const_iterator
end
() const¶
-
param_array::reverse_iterator
rbegin
()¶
-
param_array::const_reverse_iterator
rbegin
() const¶
-
param_array::reverse_iterator
rend
()¶
-
param_array::const_reverse_iterator
rend
() const¶
-
std::string
to_string
() const¶
-
-
class
param_node
¶ - #include <param.hh>
Inherits from param
Subclassed by authentication, parsable, parser
Public Types
Public Functions
-
param_node
()¶
-
param_node
(const param_node &orig)¶
-
~param_node
()¶
-
param_node &
operator=
(const param_node &rhs)¶
-
param *
clone
() const
-
bool
is_null
() const
-
bool
is_node
() const¶
-
bool
has_subset
(const param &a_subset) const
-
unsigned
size
() const¶
-
bool
empty
() const¶
-
bool
has
(const std::string &a_name) const¶
-
unsigned
count
(const std::string &a_name) const¶
-
std::string
get_value
(const std::string &a_name) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue
- template <typename XValType>
-
XValType
get_value
(const std::string &a_name) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Throws an error if a_name is not present or is not of type ParamValue
-
std::string
get_value
(const std::string &a_name, const std::string &a_default) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue
-
std::string
get_value
(const std::string &a_name, const char *a_default) const¶
- template <typename XValType>
-
XValType
get_value
(const std::string &a_name, XValType a_default) const¶ Returns the result of ParamValue::get if a_name is present and is of type ParamValue Returns a_default if a_name is not present or is not of type ParamValue
-
const param *
at
(const std::string &a_name) const¶ Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.
-
param *
at
(const std::string &a_name)¶ Returns a pointer to the param corresponding to a_name. Returns NULL if a_name is not present.
-
const param_value *
value_at
(const std::string &a_name) const¶
-
param_value *
value_at
(const std::string &a_name)¶
-
const param_array *
array_at
(const std::string &a_name) const¶
-
param_array *
array_at
(const std::string &a_name)¶
-
const param_node *
node_at
(const std::string &a_name) const¶
-
param_node *
node_at
(const std::string &a_name)¶
-
const param &
operator[]
(const std::string &a_name) const¶ Returns a reference to the param corresponding to a_name. Throws an error if a_name is not present.
-
param &
operator[]
(const std::string &a_name)¶ Returns a reference to the param corresponding to a_name. Adds a new value if a_name is not present.
-
bool
add
(const std::string &a_name, param *a_value_ptr)¶ directly adds (without copying) a_value_ptr
-
void
replace
(const std::string &a_name, param *a_value_ptr)¶ directly adds (without copying) a_value_ptr
-
void
merge
(const param_node &a_object)¶ Merges the contents of a_object into this object. If names in the contents of a_object exist in this object, the values in this object corresponding to the matching names will be replaced.
-
void
erase
(const std::string &a_name)¶
-
void
clear
()¶
-
param_node::iterator
begin
()¶
-
param_node::const_iterator
begin
() const¶
-
param_node::iterator
end
()¶
-
param_node::const_iterator
end
() const¶
-
std::string
to_string
() const
-
-
class
param_value
¶ - #include <param.hh>
Inherits from param
Public Functions
-
param_value
()¶
-
param_value
(bool a_value)¶
-
param_value
(uint8_t a_value)¶
-
param_value
(uint16_t a_value)¶
-
param_value
(uint32_t a_value)¶
-
param_value
(uint64_t a_value)¶
-
param_value
(int8_t a_value)¶
-
param_value
(int16_t a_value)¶
-
param_value
(int32_t a_value)¶
-
param_value
(int64_t a_value)¶
-
param_value
(float a_value)¶
-
param_value
(double a_value)¶
-
param_value
(const std::string &a_value)¶
-
param_value
(const char *a_value)¶
-
param_value
(const param_value &orig)¶
-
~param_value
()¶
-
param_value &
operator=
(const param_value &rhs)¶
-
param *
clone
() const
-
bool
empty
() const
-
bool
is_null
() const
-
bool
is_value
() const¶
-
bool
has_subset
(const param &a_subset) const
-
std::string
type
() const¶
-
bool
is_bool
() const¶
-
bool
is_uint
() const¶
-
bool
is_int
() const¶
-
bool
is_double
() const¶
-
bool
is_string
() const¶
-
bool
as_bool
() const¶
-
uint64_t
as_uint
() const¶
-
int64_t
as_int
() const¶
-
double
as_double
() const¶
-
const string &
as_string
() const¶
- template <typename XValType>
-
XValType
get
() const¶
-
void
set
(bool a_value)¶
-
void
set
(uint8_t a_value)¶
-
void
set
(uint16_t a_value)¶
-
void
set
(uint32_t a_value)¶
-
void
set
(uint64_t a_value)¶
-
void
set
(int8_t a_value)¶
-
void
set
(int16_t a_value)¶
-
void
set
(int32_t a_value)¶
-
void
set
(int64_t a_value)¶
-
void
set
(float a_value)¶
-
void
set
(double a_value)¶
-
void
set
(const std::string &a_value)¶
-
void
set
(const char *a_value)¶
-
std::string
to_string
() const
-
void
clear
()
- template <>
-
bool
get
() const¶
- template <>
-
uint64_t
get
() const
- template <>
-
int64_t
get
() const
- template <>
-
double
get
() const
Private Members
-
union scarab::param_value::Values
f_value
¶
-
scarab::param_value::ValueTypes
f_value_type
¶
-
std::string
f_buffer
¶
-
union
Values
¶
-
library/param/param_codec.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
Functions
-
LOGGER(slog, "param_codec")
-
namespace
scarab
¶ The standard scarab namespace.
library/param/param_codec.hh¶
Defines
-
REGISTER_PARAM_INPUT_CODEC
(codec_class, encoding)¶
-
REGISTER_PARAM_OUTPUT_CODEC
(codec_class, encoding)¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
param_input_codec
¶ - #include <param_codec.hh>
Subclassed by param_input_json, param_input_yaml
Public Functions
-
param_input_codec
()¶
-
~param_input_codec
()¶
-
virtual param *
read_file
(const std::string &a_filename, const param_node *a_options = nullptr) = 0¶
-
virtual param *
read_string
(const std::string &a_string, const param_node *a_options = nullptr) = 0¶
-
-
class
param_output_codec
¶ - #include <param_codec.hh>
Subclassed by param_output_json, param_output_yaml
Public Functions
-
param_output_codec
()¶
-
~param_output_codec
()¶
-
virtual bool
write_file
(const param &a_param, const std::string &a_filename, const param_node *a_options = nullptr) = 0¶
-
virtual bool
write_string
(const param &a_param, std::string &a_string, const param_node *a_options = nullptr) = 0¶
-
-
class
param_translator
¶ - #include <param_codec.hh>
Public Functions
-
param_translator
()¶
-
~param_translator
()¶
-
param *
read_file
(const std::string &a_filename, const param_node *a_options = nullptr)¶
-
param *
read_string
(const std::string &a_string, const param_node *a_options = nullptr)¶
-
bool
write_file
(const param &a_param, const std::string &a_filename, const param_node *a_options = nullptr)¶
-
bool
write_string
(const param &a_param, std::string &a_string, const param_node *a_options = nullptr)¶
-
-
class
library/param/parsable.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(dlog, "parsable")
-
library/param/parsable.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
parsable
¶ - #include <parsable.hh>
Inherits from param_node
Public Functions
-
parsable
()¶
-
parsable
(const std::string &a_addr_with_value)¶
-
parsable
(const std::string &a_addr, const std::string &a_value)¶
-
~parsable
()¶
Private Functions
-
void
add_next
(param_node *a_parent, const std::string &a_addr, const std::string &a_value)¶
-
-
class
library/param/parser.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
library/param/parser.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
parser
¶ - #include <parser.hh>
Inherits from param_node
-
class
library/param/codec¶
library/param/codec/json¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(dlog, "param")
-
scarab::REGISTER_PARAM_INPUT_CODEC(param_input_json, "json")
-
scarab::REGISTER_PARAM_OUTPUT_CODEC(param_output_json, "json")
-
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(dlog_param_json, "param_json")
-
class
param_input_json
¶ - #include <param_json.hh>
Convert JSON to Param.
Options: None
- Author
- N.S. Oblath
Inherits from param_input_codec
Public Functions
-
param_input_json
()¶
-
~param_input_json
()¶
-
param *
read_file
(const std::string &a_filename, const param_node *a_options = nullptr)¶
-
param *
read_string
(const std::string &a_json_str, const param_node *a_options = nullptr)¶
-
param_node *
read_document
(const rapidjson::Document &a_document)¶
-
class
param_output_json
¶ - #include <param_json.hh>
Convert Param to JSON.
Options:
- JSON Style Pretty print: { “style”: param_output_json::k_pretty } or { “style”: “pretty” } Compact (default): { “style”: param_output_json::k_compact } or { “style”: “compact” } or anything else
- Author
- N.S. Oblath
Inherits from param_output_codec
Public Types
-
typedef rapidjson::Writer<rapidjson::FileWriteStream>
rj_file_writer
¶
-
typedef rapidjson::PrettyWriter<rapidjson::FileWriteStream>
rj_pretty_file_writer
¶
-
typedef rapidjson::Writer<rapidjson::StringBuffer>
rj_string_writer
¶
-
typedef rapidjson::PrettyWriter<rapidjson::StringBuffer>
rj_pretty_string_writer
¶
Public Functions
-
param_output_json
()¶
-
~param_output_json
()¶
-
bool
write_file
(const param &a_to_write, const std::string &a_filename, const param_node *a_options = nullptr)¶
-
bool
write_string
(const param &a_to_write, std::string &a_string, const param_node *a_options = nullptr)¶
- template <class XWriter>
-
bool
write_param_value
(const param_value &a_to_write, XWriter *a_writer)¶
- template <class XWriter>
-
bool
write_param_array
(const param_array &a_to_write, XWriter *a_writer)¶
- template <class XWriter>
-
bool
write_param_node
(const param_node &a_to_write, XWriter *a_writer)¶
-
library/param/codec/msgpack¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(dlog, "param_msgpack")
-
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(dlog_param_msgpack, "param_msgpack")
-
class
param_input_msgpack
¶ - #include <param_msgpack.hh>
-
class
param_output_msgpack
¶ - #include <param_msgpack.hh>
Public Static Functions
-
static bool
write_file
(const param &a_to_write, const std::string &a_filename, json_writing_style a_style)¶
- template <class XWriter>
-
bool
write_param_value
(const param_value &a_to_write, XWriter *a_writer)¶
- template <class XWriter>
-
bool
write_param_array
(const param_array &a_to_write, XWriter *a_writer)¶
- template <class XWriter>
-
bool
write_param_node
(const param_node &a_to_write, XWriter *a_writer)¶
-
static bool
-
library/param/codec/yaml¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(slog, "param_yaml")
-
scarab::REGISTER_PARAM_INPUT_CODEC(param_input_yaml, "yaml")
-
scarab::REGISTER_PARAM_OUTPUT_CODEC(param_output_yaml, "yaml")
-
-
namespace
scarab
¶ The standard scarab namespace.
-
class
param_input_yaml
¶ - #include <param_yaml.hh>
Convert YAML to Param.
Options: None
- Author
- N.S. Oblath
Inherits from param_input_codec
Public Functions
-
param_input_yaml
()¶
-
~param_input_yaml
()¶
-
param *
read_file
(const std::string &a_filename, const param_node *a_options = nullptr)¶
-
param *
read_string
(const std::string &a_json_str, const param_node *a_options = nullptr)¶
-
param_array *
sequence_handler
(const YAML::Node &a_node)¶
-
param_node *
map_handler
(const YAML::Node &a_node)¶
-
param_value *
scalar_handler
(const YAML::Node &a_node)¶
-
class
param_output_yaml
¶ - #include <param_yaml.hh>
Convert YAMl to JSON.
Options: None
- Author
- N.S. Oblath
Inherits from param_output_codec
Public Functions
-
param_output_yaml
()¶
-
~param_output_yaml
()¶
-
bool
write_file
(const param &a_to_write, const std::string &a_filename, const param_node *a_options = nullptr)¶
-
bool
write_string
(const param &a_to_write, std::string &a_string, const param_node *a_options = nullptr)¶
-
class
library/test¶
library/test/test__member_variables.hh¶
-
struct
test_acc
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_accessible_noset
(int, mv_acc_ns_int)¶
-
-
struct
test_acc_static
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_accessible_static_noset
(int, mv_acc_ns_int)¶
-
-
struct
test_acc_mutable
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_accessible_mutable_noset
(int, mv_acc_ns_int)¶
-
-
struct
test_ref
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_referrable_const
(int, mv_ref_c_int)¶
-
-
struct
test_ptr
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_assignable_noset
(int, mv_ptr_ns_int)¶
-
-
struct
test_ptr_static
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_assignable_static_noset
(int, mv_ptr_ns_int)¶
-
-
struct
test_ptr_mutable
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_assignable_mutable_noset
(int, mv_ptr_ns_int)¶
-
-
struct
test_shptr
¶ - #include <test__member_variables.hh>
Public Functions
-
struct
test_atm
¶ - #include <test__member_variables.hh>
Public Functions
-
mv_atomic_noset
(int, mv_atm_ns_int)¶
-
library/test/test_configurator.cc¶
library/utility¶
library/utility/_member_variables.hh¶
Defines
-
get_fcn
(x_variable)¶ Templates for macros for class member variables
Types of variables:
- ”normal”
- referrable (i.e. accessed by reference)
- pointers
- std::shared_ptr
- std::atomic
Variations:
- no set (non-const) accessor
- static
- mutable
How to use this file:
- Create the include file that will be used (see e.g. member_variables.hh)
- Add include guards
- Define set_prefix, get_prefix, var_prefix, and static_prefix
- #include this file
Macros that must be defined to use this file:
- set_prefix: the prefix for set accessor functions (e.g. set_)
- get_prefix: the prefix for get accessor functions (e.g. get_)
- var_prefix: the prefix for variables (e.g. f_)
- static_prefix: the prefix for static variables (e.g. s_)
Accessors for normal variables, pointers, and atomics are of the form [set_prefix][variable name] and [get_prefix][variable_name]. Accessors for referrable variables and shared_ptr’s are of the form [variable name], both const and non-const
-
set_fcn
(x_variable)¶
-
var_name
(x_variable)¶
-
static_var_name
(x_variable)¶
-
mv_accessible_noset
(x_type, x_variable)¶
-
mv_accessible
(x_type, x_variable)¶
-
mv_accessible_static_noset
(x_type, x_variable)¶
-
mv_accessible_static
(x_type, x_variable)¶
-
mv_accessible_mutable_noset
(x_type, x_variable)¶
-
mv_accessible_mutable
(x_type, x_variable)¶
-
mv_referrable_const
(x_type, x_variable)¶
-
mv_referrable
(x_type, x_variable)¶
-
mv_referrable_static
(x_type, x_variable)¶
-
mv_referrable_mutable
(x_type, x_variable)¶
-
mv_assignable_noset
(x_type, x_variable)¶
-
mv_assignable
(x_type, x_variable)¶
-
mv_assignable_static_noset
(x_type, x_variable)¶
-
mv_assignable_static
(x_type, x_variable)¶
-
mv_assignable_mutable_noset
(x_type, x_variable)¶
-
mv_assignable_mutable
(x_type, x_variable)¶
-
mv_atomic_noset
(x_type, x_variable)¶
-
mv_atomic
(x_type, x_variable)¶
-
mv_atomic_static_noset
(x_type, x_variable)¶
-
mv_atomic_static
(x_type, x_variable)¶
-
mv_atomic_mutable_noset
(x_type, x_variable)¶
-
mv_atomic_mutable
(x_type, x_variable)¶
library/utility/cancelable.cc¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(slog, "cancelable")
-
library/utility/concurrent_queue.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(slog_cq, "concurrent_queue")
- template <class XDataType>
-
class
concurrent_queue
¶ - #include <concurrent_queue.hh>
Public Functions
-
concurrent_queue
()¶
-
virtual
~concurrent_queue
()¶
-
void
push
(XDataType const &a_data)¶
-
bool
empty
() const¶
-
bool
size
() const¶
-
bool
try_pop
(XDataType &a_popped_value)¶
-
bool
wait_and_pop
(XDataType &a_popped_value)¶
-
bool
timed_wait_and_pop
(XDataType &a_popped_value)¶
-
void
interrupt
()¶
-
unsigned
get_timeout
() const¶
-
void
set_timeout
(unsigned a_duration)¶
Private Members
-
bool
f_interrupt
¶
-
std::chrono::milliseconds
f_timeout
¶
-
std::mutex
f_mutex
¶ Timeout duration in milliseconds.
-
std::condition_variable
f_condition_var
¶
-
struct
queue_not_empty
¶ - #include <concurrent_queue.hh>
-
-
library/utility/destroyer.hh¶
library/utility/digital.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
SCARAB_API void get_calib_params(unsigned n_bits, unsigned data_type_size, double v_offset, double v_range, bool bits_r_aligned, dig_calib_params * params)
-
SCARAB_API void get_calib_params2(unsigned n_bits, unsigned data_type_size, double v_offset, double v_range, double dac_gain, bool bits_r_aligned, dig_calib_params * params)
-
library/utility/digital.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
- template <typename dig_type, typename an_type>
-
an_type
d2a
(dig_type dig, const struct dig_calib_params *params)¶
- template <typename an_type, typename dig_type>
-
dig_type
a2d
(an_type analog, const struct dig_calib_params *params)¶
-
struct
dig_calib_params
¶ - #include <digital.hh>
library/utility/error.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
library/utility/error.hh¶
library/utility/factory.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
scarab::LOGGER(slog_fact, "factory")
- template <class XBaseType, typename… XArgs>
-
class
base_registrar
¶ - #include <factory.hh>
Protected Functions
-
virtual XBaseType *
create
(XArgs... args) const = 0¶
Friends
-
friend
scarab::factory< XBaseType, XArgs... >
-
virtual XBaseType *
- template <class XBaseType>
-
template<>
classbase_registrar
<XBaseType, void>¶ - #include <factory.hh>
Protected Functions
-
virtual XBaseType *
create
() const = 0¶
Friends
-
friend
scarab::factory< XBaseType >
-
virtual XBaseType *
- template <class XBaseType, typename… XArgs>
-
class
factory
¶ - #include <factory.hh>
Inherits from singleton< factory< XBaseType, XArgs… > >
Public Types
-
typedef std::map<std::string, const base_registrar<XBaseType, XArgs...> *>
FactoryMap
¶
-
typedef FactoryMap::value_type
FactoryEntry
¶
-
typedef FactoryMap::iterator
FactoryIt
¶
-
typedef FactoryMap::const_iterator
FactoryCIt
¶
Public Functions
-
XBaseType *
create
(const std::string &a_class_name, XArgs... args)¶
-
XBaseType *
create
(const FactoryCIt &iter, XArgs... args)¶
-
void
register_class
(const std::string &a_class_name, const base_registrar<XBaseType, XArgs...> *base_registrar)¶
-
bool
has_class
(const std::string &a_class_name) const¶
-
void
remove_class
(const std::string &a_class_name)¶
-
typedef std::map<std::string, const base_registrar<XBaseType, XArgs...> *>
- template <class XBaseType>
-
template<>
classfactory
<XBaseType, void>¶ - #include <factory.hh>
Inherits from singleton< factory< XBaseType > >
Public Types
-
typedef std::map<std::string, const base_registrar<XBaseType> *>
FactoryMap
¶
-
typedef FactoryMap::value_type
FactoryEntry
¶
-
typedef FactoryMap::iterator
FactoryIt
¶
-
typedef FactoryMap::const_iterator
FactoryCIt
¶
Public Functions
-
XBaseType *
create
(const std::string &a_class_name)¶
-
XBaseType *
create
(const FactoryCIt &iter)¶
-
void
register_class
(const std::string &a_class_name, const base_registrar<XBaseType> *base_registrar)¶
-
bool
has_class
(const std::string &a_class_name) const¶
-
void
remove_class
(const std::string &a_class_name)¶
Friends
-
friend
scarab::singleton< factory >
-
friend
scarab::destroyer< factory >
-
typedef std::map<std::string, const base_registrar<XBaseType> *>
- template <class XBaseType, class XDerivedType, typename… XArgs>
-
class
registrar
¶ - #include <factory.hh>
Inherits from base_registrar< XBaseType, XArgs… >
Protected Functions
-
void
register_class
(const std::string &a_class_name) const¶
-
XBaseType *
create
(XArgs... args) const¶
Protected Attributes
-
std::string
f_class_name
¶
-
void
- template <class XBaseType, class XDerivedType>
-
template<>
classregistrar
<XBaseType, XDerivedType, void>¶ - #include <factory.hh>
Inherits from base_registrar< XBaseType >
Protected Functions
-
void
register_class
(const std::string &a_class_name) const¶
-
XBaseType *
create
() const¶
Protected Attributes
-
std::string
f_class_name
¶
-
void
-
library/utility/macros.hh¶
library/utility/member_variables.hh¶
Defines
-
set_prefix
¶ Macros for class member variables
In all cases remember to initialize the variables!
For “normal” variables Defines accessors [type get_my_var() const], [void set_my_var( type )], and member variable [type f_my_var] The set_ function is not available if the _noset macros are used
- mv_accessible
- mv_accessible_noset
- mv_accessible_static
- mv_accessible_static_noset
For variables accessed by reference Defines accessors [const type& my_var() const], [type& my_var()], and member variable [type f_my_var] The non-const function is not available if the _const macros are used
- mv_referrable
- mv_referrable_const
- mv_referrable_static
- mv_referrable_static_const
For pointer variables Defines accessors [type* get_my_var() const], [void set_my_var( type* )], and member variable [type* f_my_var] The set_ function is not available if the _noset macros are used
- mv_assignable
- mv_assignable_noset
- mv_assignable_static
- mv_assignable_static_noset
For std::shared_ptr’s Defines accessors [const std::shared_ptr< type > my_var() const], [std::shared_ptr< type > my_var()], and member variable [std::shared_ptr< type > f_my_var] The non-const function is not available if the _const macros are used
- mv_shared_ptr
- mv_shared_ptr_const
- mv_shared_ptr_static
- mv_shared_ptr_static_const
For atomic variables Defines accessors [type get_my_var() const], [void set_my_var( type )], and member variable [std::atomic< type > f_my_var] The set_ function is not available if the _noset macros are used
- mv_atomic
- mv_atomic_noset
- mv_atomic_static
- mv_atomic_static_noset
-
get_prefix
¶
-
var_prefix
¶
-
static_prefix
¶
library/utility/path.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
path SCARAB_API expand_path(const string & a_path)
-
library/utility/path.hh¶
library/utility/scarab_version.hh¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
version
¶ - #include <scarab_version.hh>
Inherits from version_semantic
-
class
version_ifc
¶ - #include <scarab_version.hh>
Subclassed by version_semantic
Public Functions
-
version_ifc
()¶
-
version_ifc
(const version_ifc&)¶
-
virtual
~version_ifc
()¶
-
version_ifc &
operator=
(const version_ifc&)¶
-
virtual unsigned
major_version
() const = 0¶
-
virtual unsigned
minor_version
() const = 0¶
-
virtual unsigned
patch_version
() const = 0¶
-
virtual const std::string &
version_str
() const = 0¶
-
virtual const std::string &
package
() const = 0¶
-
virtual const std::string &
commit
() const = 0¶
-
virtual const std::string &
exe_name
() const = 0¶
-
virtual const std::string &
hostname
() const = 0¶
-
virtual const std::string &
username
() const = 0¶
-
virtual std::string
version_info_string
() const = 0¶
-
-
class
version_semantic
¶ - #include <scarab_version.hh>
Inherits from version_ifc
Subclassed by version
Public Functions
-
version_semantic
()¶
-
version_semantic
(unsigned a_maj_ver, unsigned a_min_ver, unsigned a_patch_ver)¶
-
version_semantic
(const std::string &a_ver)¶
-
version_semantic
(const version_semantic &a_orig)¶
-
~version_semantic
()¶
-
version_semantic &
operator=
(const version_semantic &a_orig)¶
-
unsigned
major_version
() const¶
-
unsigned
minor_version
() const¶
-
unsigned
patch_version
() const¶
-
const std::string &
version_str
() const¶
-
const std::string &
package
() const¶
-
const std::string &
commit
() const¶
-
const std::string &
exe_name
() const¶
-
const std::string &
hostname
() const¶
-
const std::string &
username
() const¶
-
virtual std::string
version_info_string
() const¶
-
bool
parse
(const std::string &a_ver)¶
-
bool
combine
(unsigned a_maj_ver, unsigned a_min_ver, unsigned a_patch_ver)¶
-
bool
update_exe_host_user
()¶
Protected Attributes
-
unsigned
f_major_ver
¶
-
unsigned
f_minor_ver
¶
-
unsigned
f_patch_ver
¶
-
std::string
f_version
¶
-
std::string
f_package
¶
-
std::string
f_commit
¶
-
std::string
f_exe_name
¶
-
std::string
f_hostname
¶
-
std::string
f_username
¶
Protected Static Attributes
-
char
s_delimeter
¶
-
-
class
library/utility/singleton.hh¶
Defines
-
allow_singleton_access
(class_name)¶
library/utility/time.cc¶
Defines
-
SCARAB_API_EXPORTS
¶
-
namespace
scarab
¶ The standard scarab namespace.
Functions
-
SCARAB_API int get_time_monotonic(struct timespec * time)
-
SCARAB_API int get_time_current(struct timespec * time)
-
SCARAB_API time_nsec_type time_to_nsec(struct timespec time)
-
SCARAB_API double time_to_sec(struct timespec time)
-
SCARAB_API void time_diff(struct timespec start, struct timespec end, struct timespec * diff)
-
SCARAB_API size_t get_time_absolute_str(char * ptr)
-
SCARAB_API std::string get_absolute_time_string()
Variables
-
SCARAB_API char date_time_format
= “%Y-%m-%dT%H:%M:%SZ”
-
library/utility/time.hh¶
Functions
-
SCARAB_API bool operator==(const timespec & lhs, const timespec & rhs)
-
SCARAB_API bool operator<(const timespec & lhs, const timespec & rhs)