ase/platform.hh file


Namespaces

namespace Ase
The Anklang C++ API namespace.
namespace Ase::AnsiColors
The AnsiColors namespace contains utility functions for colored terminal output.

Classes

template <class Value>
class Ase::AsyncBlockingQueue
This is a thread-safe asyncronous queue which blocks in pop() until data is provided through push().
struct Ase::TaskStatus
Acquire information about a task (process or thread) at runtime.
class Ase::TaskRegistry
The task registry keeps track of runtime threads for profiling and statistical purposes.

Enums

enum Colors { NONE, RESET, BOLD, BOLD_OFF, ITALICS, ITALICS_OFF, UNDERLINE, UNDERLINE_OFF, INVERSE, INVERSE_OFF, STRIKETHROUGH, STRIKETHROUGH_OFF, FG_BLACK, FG_RED, FG_GREEN, FG_YELLOW, FG_BLUE, FG_MAGENTA, FG_CYAN, FG_WHITE, FG_DEFAULT, BG_BLACK, BG_RED, BG_GREEN, BG_YELLOW, BG_BLUE, BG_MAGENTA, BG_CYAN, BG_WHITE, BG_DEFAULT }
ANSI color symbols.

Functions

auto _(const char* string) →  const char*()
Translate message strings in the Anklang/ASE text domain.
auto _(const std::string& string) →  std::string()
Translate message strings in the Anklang/ASE text domain.
auto _(const char* string, const char* plural, int64_t n) →  const char*()
Translate message strings in the Anklang/ASE text domain, use @plural forms if
!= 1.
auto _(const std::string& string, const std::string& plural, int64_t n) →  std::string()
Translate message strings in the Anklang/ASE text domain, use @plural forms if
!= 1.
auto anklang_home_dir(const String& subdir) →  String
Get Anklang home dir, possibly adding subdir.
auto anklang_runpath(RPath rpath, const String& segment) →  std::string
Retrieve various resource paths at runtime.
auto application_name() →  String
Retrieve the localized program name intended for user display.
void application_name_init(String desktopname)
Set the application_name to a name other than program_alias if desired.
auto ase_build_id() →  const char*
Provide a string containing the ASE library build id.
auto ase_version() →  const char*
Provide a string containing the package version.
void breakpoint() ASE_ALWAYS_INLINE
Cause a debugging breakpoint, for development only.
auto color(Colors acolor, Colors c1, Colors c2, Colors c3, Colors c4, Colors c5, Colors c6) →  std::string
Return ANSI code for the specified color if stdout & stderr should be colorized, see colorize_tty().
auto color_code(Colors acolor) →  const char*
Return ANSI code for the specified color.
auto colorize_tty(int fd) →  bool
Check whether the tty fd should use colorization, checks ASE_COLOR if fd == -1.
void configure(Colorize colorize)
Override the environment variable $ASE_COLOR (which may contain "always", "never" or "auto").
auto cpu_arch() →  std::string
Retrieve string identifying the CPU architecture.
auto cpu_info() →  String
Retrieve string identifying the runtime CPU type.
auto executable_name() ASE_PURE -> std::string
Retrieve the name part of executable_path().
auto executable_path() →  std::string
Retrieve the path to the currently running executable.
auto monotonic_counter() →  uint64
A monotonically increasing counter, increments are atomic and visible in all threads.
auto program_alias() →  String
Retrieve the program name as used for logging or debug messages.
void program_alias_init(String customname)
Set program_alias to a non-localized alias other than program_argv0 if desired.
auto program_cwd() →  String
The current working directory during startup.
auto sched_fast_priority(int tid) →  bool
Try to acquire low latency scheduling priority, returns true if nice level is < 0.
auto sched_get_priority(int tid) →  int
Retrieve the nice level of process or thread tid.
auto sched_set_priority(int tid, int nicelevel) →  bool
Try to set the nice level of process or thread tid to nicelevel.
auto timestamp_benchmark() →  uint64
Returns benchmark timestamp in nano-seconds, clock starts around program startup.
auto timestamp_format(uint64 stamp, uint maxlength) →  String
Convert stamp into a string, adding µsecond fractions if space permits.
auto timestamp_realtime() →  uint64
Return the current time as uint64 in µseconds.
auto timestamp_resolution() →  uint64
Provide resolution of timestamp_benchmark() in nano-seconds.
auto timestamp_startup() →  uint64
Provides the timestamp_realtime() value from program startup.

Defines

#define ASE_CFENCE
Compiler Fence, prevent compiler from reordering non-volatile loads/stores, see also std::atomic_signal_fence().
#define ASE_LFENCE
#define ASE_MFENCE
Memory Fence - prevent processor (and compiler) from reordering loads/stores (read/write barrier), see also std::atomic_thread_fence().
#define ASE_SFENCE
Store Fence - prevent processor (and compiler) from reordering stores (write barrier).

Define documentation

#define ASE_LFENCE

Load Fence - prevent processor (and compiler) from reordering loads (read barrier).