mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
Loading...
Searching...
No Matches
mx Namespace Reference

The mxlib c++ namespace. More...

The mxlib c++ namespace.

Namespaces

namespace  internal
 Namespace for the internal error reporting functions.
 
namespace  verbose
 Namespace for the error reporting verbosity levels.
 

Enumerations

enum class  error_t {
  error_t::noerror , error_t::error , error_t::invalidarg , error_t::invalidconfig ,
  error_t::notimpl , error_t::paramnotset , error_t::envnotset , error_t::notfound ,
  error_t::sizeerr , error_t::allocerr , error_t::freeerr , error_t::parseerr ,
  error_t::filesystem , error_t::fileoerr , error_t::filewerr , error_t::filererr ,
  error_t::filecerr , error_t::filenotfound , error_t::fileempty , error_t::dirnotfound ,
  error_t::dirempty , error_t::procerr , error_t::timeout , error_t::liberr ,
  error_t::exception , error_t::std_logic_error , error_t::std_invalid_argument , error_t::std_domain_error ,
  error_t::std_length_error , error_t::std_out_of_range , error_t::std_future_error , error_t::std_bad_optional_access ,
  error_t::gnuploterr , error_t::lapackerr , error_t::e2big , error_t::eacces ,
  error_t::eaddrinuse , error_t::eaddrnotavail , error_t::eafnosupport , error_t::eagain ,
  error_t::ealready , error_t::ebadf , error_t::ebadmsg , error_t::ebusy ,
  error_t::ecanceled , error_t::echild , error_t::econnaborted , error_t::econnrefused ,
  error_t::econnreset , error_t::edestaddrreq , error_t::edom , error_t::eexist ,
  error_t::efault , error_t::efbig , error_t::ehostunreach , error_t::eidrm ,
  error_t::eilseq , error_t::einprogress , error_t::eintr , error_t::einval ,
  error_t::eio , error_t::eisconn , error_t::eisdir , error_t::eloop ,
  error_t::emfile , error_t::emlink , error_t::emsgsize , error_t::enametoolong ,
  error_t::enetdown , error_t::enetreset , error_t::enetunreach , error_t::enfile ,
  error_t::enobufs , error_t::enodata , error_t::enodev , error_t::enoent ,
  error_t::enoexec , error_t::enolck , error_t::enolink , error_t::enomem ,
  error_t::enomsg , error_t::enoprotoopt , error_t::enospc , error_t::enosr ,
  error_t::enostr , error_t::enosys , error_t::enotconn , error_t::enotdir ,
  error_t::enotempty , error_t::enotrecoverable , error_t::enotsock , error_t::enotsup ,
  error_t::enotty , error_t::enxio , error_t::eopnotsupp , error_t::eoverflow ,
  error_t::eownerdead , error_t::eperm , error_t::epipe , error_t::eproto ,
  error_t::eprotonosupport , error_t::eprototype , error_t::erange , error_t::erofs ,
  error_t::espipe , error_t::esrch , error_t::etime , error_t::etimedout ,
  error_t::etxtbsy , error_t::ewouldblock , error_t::exdev
}
 The mxlib error codes. More...
 

Functions

template<class verboseT >
std::string error_message (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
 Format a report given an mxlib error_t code and explanation.
 
template<>
std::string error_message< verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::o.
 
template<>
std::string error_message< verbose::v > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::v.
 
template<>
std::string error_message< verbose::vv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::vv.
 
template<>
std::string error_message< verbose::vvv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::vvv.
 
template<class verboseT >
std::string error_message (const error_t &code, const std::source_location &loc=std::source_location::current())
 Format a report given an mxlib error_t code.
 
template<>
std::string error_message< verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::o.
 
template<>
std::string error_message< verbose::v > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::v.
 
template<>
std::string error_message< verbose::vv > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::vv.
 
template<>
std::string error_message< verbose::vvv > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::vvv.
 
template<class verboseT >
error_t error_report (const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
 Print a report to stderr given an mxlib error_t code and explanation and return the code.
 
template<>
error_t error_report< verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_report for verbose::o.
 
template<class verboseT >
error_t error_report (const error_t &code, const std::source_location &loc=std::source_location::current())
 Print a report to stderr given an mxlib error_t code and return the code.
 
template<>
error_t error_report< verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of error_report for verbose::o.
 
template<typename iosT , char comment = '#'>
iosT & dumpGitStatus (iosT &ios, const std::string &repoName, const std::string &branch, const std::string &sha1, const bool &modified, const std::string &section="")
 Dump the git status of a repository to a stream.
 
template<typename iosT , char comment = '#'>
iosT & dumpGitStatus (iosT &ios)
 Dump the current git status of the mxlib library to a stream.
 
static constexpr const char * errorName (const error_t &errc)
 Convert an error_t code to its name.
 
static constexpr const char * errorMessage (const error_t &errc)
 Get the descriptive message for an error_t code.
 
static constexpr error_t errno2error_t (const int &err)
 Convert an errno code to error_t.
 
std::string MXE_CodeToName (int ec)
 Return the name for an mxlib error code.
 
std::string MXE_CodeToDescription (int ec)
 Return the description for an mxlib error code.
 
std::string errno_CodeToName (int ec)
 Return the macro name and a message for a standard errno code.
 
std::string error_report (const std::string &source, const int &code, const std::string &file, const int &line, const std::string &expl="")
 Construct a rich error report given an mxlib error code.
 
std::string errno_report (const std::string &source, int ec, const std::string &file, const int &line, const std::string &expl="")
 Construct a rich error report given a standard errno error code.
 
template<>
std::string error_message< verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::o.
 
template<>
std::string error_message< verbose::v > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::v.
 
template<>
std::string error_message< verbose::vv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::vv.
 
template<>
std::string error_message< verbose::vvv > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_message for verbose::vvv.
 
template<>
std::string error_message< verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::o.
 
template<>
std::string error_message< verbose::v > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::v.
 
template<>
std::string error_message< verbose::vv > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::vv.
 
template<>
std::string error_message< verbose::vvv > (const error_t &code, const std::source_location &loc)
 Specialization of error_message for verbose::vvv.
 
template<>
error_t error_report< verbose::o > (const error_t &code, const std::string &expl, const std::source_location &loc)
 Specialization of error_report for verbose::o.
 
template<>
error_t error_report< verbose::o > (const error_t &code, const std::source_location &loc)
 Specialization of error_report for verbose::o.
 

Function Documentation

◆ dumpGitStatus() [1/2]

template<typename iosT , char comment = '#'>
iosT & mx::dumpGitStatus ( iosT &  ios)

Dump the current git status of the mxlib library to a stream.

Prints the current SHA1 hash and whether or not the library has been modified since that commit.

Template Parameters
iosTa std::ostream-like type
commenta character to print at the beginning of each line. Default is '#'.
Parameters
[in]iosa std::ostream-like stream.

Definition at line 89 of file mxlib.hpp.

References dumpGitStatus().

◆ dumpGitStatus() [2/2]

template<typename iosT , char comment = '#'>
iosT & mx::dumpGitStatus ( iosT &  ios,
const std::string &  repoName,
const std::string &  branch,
const std::string &  sha1,
const bool &  modified,
const std::string &  section = "" 
)

Dump the git status of a repository to a stream.

Prints the provided SHA1 hash and whether or not the library has been modified since that commit.

Template Parameters
iosTa std::ostream-like type
commenta character to print at the beginning of each line. Default is '#'.
Parameters
[in]iosa std::ostream-like stream.
[in]repoNameThe name of the repository
[in]branchThe name of the branch
[in]sha1The sha1 hash for the current commit
[in]modifiedWhether or not the repository is currently modified
[in]section[optional] Descriptive sub-section name (e.g. headers vs. compiled)

Definition at line 52 of file mxlib.hpp.

Referenced by mx::AO::analysis::aoSystem< _realT, _inputSpectT, iosT >::dumpAOSystem(), and dumpGitStatus().