Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon.common Module Reference

Concepts

concept  kcenon::common::concepts::Resultable
 A type that can contain either a value or an error.
 
concept  kcenon::common::concepts::Unwrappable
 A type that supports value extraction (unwrapping).
 
concept  kcenon::common::concepts::Mappable
 A type that supports monadic map operations.
 
concept  kcenon::common::concepts::Chainable
 A type that supports monadic chaining (flatMap/and_then).
 
concept  kcenon::common::concepts::MonadicResult
 A complete Result-like type with all monadic operations.
 
concept  kcenon::common::concepts::OptionalLike
 A type that represents an optional value (present or absent).
 
concept  kcenon::common::concepts::ErrorInfo
 A type that contains error information.
 
concept  kcenon::common::concepts::ValueOrError
 A type that holds either a value or error information.
 
concept  kcenon::common::concepts::Invocable
 A callable type that can be invoked with given arguments.
 
concept  kcenon::common::concepts::VoidCallable
 A callable type that returns void when invoked.
 
concept  kcenon::common::concepts::ReturnsResult
 A callable type that returns a value convertible to the specified type.
 
concept  kcenon::common::concepts::NoexceptCallable
 A callable type that is marked noexcept.
 
concept  kcenon::common::concepts::Predicate
 A callable type that returns a boolean value.
 
concept  kcenon::common::concepts::UnaryFunction
 A callable type that takes a single argument.
 
concept  kcenon::common::concepts::BinaryFunction
 A callable type that takes two arguments.
 
concept  kcenon::common::concepts::JobLike
 A type that satisfies the Job interface requirements.
 
concept  kcenon::common::concepts::ExecutorLike
 A type that satisfies the Executor interface requirements.
 
concept  kcenon::common::concepts::TaskFactory
 A callable that creates a job or task.
 
concept  kcenon::common::concepts::AsyncCallable
 A callable suitable for async execution returning a future.
 
concept  kcenon::common::concepts::DelayedCallable
 A callable suitable for delayed execution.
 
concept  kcenon::common::concepts::EventType
 A type that can be used as an event in the event bus.
 
concept  kcenon::common::concepts::EventHandler
 A callable that can handle events of a specific type.
 
concept  kcenon::common::concepts::EventFilter
 A callable that filters events based on criteria.
 
concept  kcenon::common::concepts::TimestampedEvent
 An event type that includes a timestamp.
 
concept  kcenon::common::concepts::NamedEvent
 An event type that includes a module or source name.
 
concept  kcenon::common::concepts::ErrorEvent
 An event type representing an error.
 
concept  kcenon::common::concepts::MetricEvent
 An event type representing a metric measurement.
 
concept  kcenon::common::concepts::ModuleLifecycleEvent
 An event type representing module lifecycle changes.
 
concept  kcenon::common::concepts::FullErrorEvent
 A complete error event with module, message, code, and timestamp.
 
concept  kcenon::common::concepts::FullMetricEvent
 A complete metric event with timestamp.
 
concept  kcenon::common::concepts::EventBusLike
 A type that satisfies the event bus interface requirements.
 
concept  kcenon::common::concepts::ServiceInterface
 A type that can be used as a service interface.
 
concept  kcenon::common::concepts::ServiceImplementation
 A type that implements a service interface.
 
concept  kcenon::common::concepts::ServiceFactory
 A callable that creates service instances.
 
concept  kcenon::common::concepts::Validatable
 A type that can validate its own state.
 
concept  kcenon::common::concepts::Container
 A type that satisfies basic container requirements.
 
concept  kcenon::common::concepts::SequenceContainer
 A container that provides sequential access and modification.
 
concept  kcenon::common::concepts::ResizableContainer
 A container that can be resized.
 
concept  kcenon::common::concepts::BasicLogger
 A type that provides basic logging functionality.
 
concept  kcenon::common::concepts::FlushableLogger
 A type that supports flushing buffered log messages.
 
concept  kcenon::common::concepts::CounterMetric
 A type that supports counter metric operations.
 
concept  kcenon::common::concepts::GaugeMetric
 A type that supports gauge metric operations.
 
concept  kcenon::common::concepts::HistogramMetric
 A type that supports histogram metric operations.
 
concept  kcenon::common::concepts::Sendable
 A type that can send data.
 
concept  kcenon::common::concepts::Receivable
 A type that can receive data.
 
concept  kcenon::common::concepts::TransportClient
 A type that represents any transport client (HTTP or UDP).
 

Classes

struct  kcenon::common::module_version
 Version information for common_system module. More...
 
struct  kcenon::common::source_location
 C++17-compatible source_location implementation using compiler builtins. More...
 
class  kcenon::common::utils::CircularBuffer< T, Capacity >
 Thread-safe fixed-size circular buffer. More...
 
struct  kcenon::common::utils::detail::RawDelete< T >
 
class  kcenon::common::utils::ObjectPool< T >
 Thread-safe object pool that reuses raw storage for expensive objects. More...
 
struct  kcenon::common::config::feature_flags
 Compile-time feature detection flags. More...
 
struct  kcenon::common::config::config_entry
 A single configuration entry. More...
 
class  kcenon::common::config::IConfigLoader
 Interface for configuration loaders. More...
 
struct  kcenon::common::config::cli_option
 Definition for a CLI option. More...
 
struct  kcenon::common::config::cli_parse_result
 Result of CLI parsing. More...
 
class  kcenon::common::config::CliConfigParser
 Simple command-line argument parser. More...
 
class  kcenon::common::Result< T >
 Result type for error handling with member function support. More...
 
class  kcenon::common::Optional< T >
 Optional type similar to std::optional with Rust-like API. More...
 
struct  kcenon::common::error_info
 Standard error information used by Result<T>. More...
 
class  kcenon::common::exception_mapper
 Maps standard exception types to appropriate error codes. More...
 
interface  kcenon::common::interfaces::IJob
 Abstract job interface for task execution. More...
 
interface  kcenon::common::interfaces::IExecutor
 Abstract interface for task execution systems. More...
 
interface  kcenon::common::interfaces::IExecutorProvider
 Interface for modules that provide executor implementations. More...
 
interface  kcenon::common::interfaces::IThreadPool
 Extended interface for thread pool implementations. More...
 
interface  kcenon::common::interfaces::IThreadPoolProvider
 Interface for modules that provide thread pool implementations. More...
 
class  kcenon::common::interfaces::IDatabase
 Standard interface for database operations. More...
 
class  kcenon::common::di::IServiceContainer
 Abstract interface for dependency injection containers. More...
 
class  kcenon::common::di::ServiceContainer
 Simple thread-safe service container implementation. More...
 
class  kcenon::common::di::IBootstrapper
 Interface for system bootstrapping. More...
 
struct  kcenon::common::interfaces::log_entry
 Standard log entry structure. More...
 
interface  kcenon::common::interfaces::ILogger
 Standard interface for logging implementations. More...
 
interface  kcenon::common::interfaces::ILoggerProvider
 Interface for modules that provide logger implementations. More...
 
struct  kcenon::common::interfaces::logger_config
 Configuration for logger instances. More...
 
interface  kcenon::common::interfaces::ILoggerRegistry
 Phase 2: Global logger registry interface. More...
 
class  kcenon::common::logging::ConsoleLogger
 Simple console logger implementation. More...
 
class  kcenon::common::patterns::SimpleEventBus
 Thread-safe event bus for publish/subscribe pattern. More...
 
struct  kcenon::common::patterns::SimpleEventBus::HandlerEntry
 

Enumerations

enum class  kcenon::common::result_state {
  uninitialized , ok , error , uninitialized ,
  ok , error
}
 Result state enum for tracking initialization. More...
 
enum class  kcenon::common::interfaces::log_level {
  trace = 0 , debug = 1 , info = 2 , warning = 3 ,
  warn = 3 , error = 4 , critical = 5 , fatal = 5 ,
  off = 6 , trace = 0 , debug = 1 , info = 2 ,
  warning = 3 , error = 4 , critical = 5 , off = 6
}
 
enum class  kcenon::common::interfaces::log_level {
  trace = 0 , debug = 1 , info = 2 , warning = 3 ,
  warn = 3 , error = 4 , critical = 5 , fatal = 5 ,
  off = 6 , trace = 0 , debug = 1 , info = 2 ,
  warning = 3 , error = 4 , critical = 5 , off = 6
}
 Standard log levels. More...
 
enum class  kcenon::common::error::category : int {
  success = 0 , common = -1 , thread_system = -100 , logger_system = -200 ,
  monitoring_system = -300 , container_system = -400 , database_system = -500 , network_system = -600 ,
  pacs_system = -700 , success = 0 , common = -1 , thread_system = -100 ,
  logger_system = -200 , monitoring_system = -300 , container_system = -400 , database_system = -500 ,
  network_system = -600 , pacs_system = -700
}
 
enum class  kcenon::common::error::category : int {
  success = 0 , common = -1 , thread_system = -100 , logger_system = -200 ,
  monitoring_system = -300 , container_system = -400 , database_system = -500 , network_system = -600 ,
  pacs_system = -700 , success = 0 , common = -1 , thread_system = -100 ,
  logger_system = -200 , monitoring_system = -300 , container_system = -400 , database_system = -500 ,
  network_system = -600 , pacs_system = -700
}
 Error code category ranges for compile-time validation. More...
 

Typedefs

using value_type = T
 
using RawPtr = std::unique_ptr<T, detail::RawDelete<T>>
 
using kcenon::common::config::config_value
 Configuration value type.
 
using kcenon::common::VoidResult = Result<std::monostate>
 Specialized Result for void operations.
 
using value_type = T
 Type alias for the contained value type (for concept compatibility)
 
using error_type = error_info
 Type alias for the error type.
 
using value_type = T
 Type alias for the contained value type (for concept compatibility)
 
using kcenon::common::interfaces::ExecutorFactory = std::function<std::shared_ptr<IExecutor>()>
 Factory function type for creating executor instances.
 
using kcenon::common::interfaces::ThreadPoolFactory = std::function<std::shared_ptr<IThreadPool>(size_t worker_count)>
 Factory function type for creating thread pool instances.
 
using kcenon::common::interfaces::LoggerFactory = std::function<std::shared_ptr<ILogger>()>
 Factory function type for creating logger instances.
 

Functions

constexpr source_location (const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE()) noexcept
 
constexpr const char * file_name () const noexcept
 
constexpr const char * function_name () const noexcept
 
constexpr int line () const noexcept
 
constexpr int column () const noexcept
 
static constexpr source_location current (const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE()) noexcept
 
 CircularBuffer ()=default
 
bool push (const T &value, bool overwrite=false)
 Push a value to the buffer.
 
bool push (T &&value, bool overwrite=false)
 
std::optional< T > pop ()
 Pop a value from the buffer.
 
bool empty () const
 
bool full () const
 
std::size_t size () const
 
constexpr std::size_t capacity () const
 
void advance (std::size_t &index) noexcept
 
bool is_full_locked () const noexcept
 
std::optional< T > pop_locked ()
 
void operator() (T *ptr) const noexcept
 
 ObjectPool (std::size_t growth=32)
 
template<typename... Args>
std::unique_ptr< T, std::function< void(T *)> > acquire (bool *reused, Args &&... args)
 Acquire an object constructed with the provided arguments.
 
template<typename... Args>
std::unique_ptr< T, std::function< void(T *)> > acquire (Args &&... args)
 
void release (T *ptr) noexcept
 Return raw storage to the pool (destructor already run).
 
void reserve (std::size_t count)
 Add count additional blocks to the pool.
 
void clear ()
 Destroy all cached instances and release memory.
 
std::size_t available () const
 
void allocate_block_unlocked (std::size_t count)
 
 config_entry ()=default
 
 config_entry (std::string k, config_value v, std::string desc="", bool req=false)
 
virtual ~IConfigLoader ()=default
 
virtual bool load ()=0
 Load configuration from source.
 
virtual std::optional< config_value > get (const std::string &key) const =0
 Get a configuration value.
 
virtual bool has (const std::string &key) const =0
 Check if a key exists.
 
bool has_errors () const
 
bool has_option (const std::string &name) const
 
std::optional< std::string > get_option (const std::string &name) const
 
 CliConfigParser ()=default
 
void add_option (const cli_option &opt)
 Add an option definition.
 
cli_parse_result parse (int argc, const char *const *argv) const
 Parse command-line arguments.
 
constexpr source_location (const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE()) noexcept
 
constexpr const char * file_name () const noexcept
 
constexpr const char * function_name () const noexcept
 
constexpr int line () const noexcept
 
constexpr int column () const noexcept
 
static constexpr source_location current (const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE()) noexcept
 
 error_info ()
 
 error_info (const std::string &msg)
 Construct with message only.
 
 error_info (int c, const std::string &msg, const std::string &mod="")
 Construct with code, message and optional module.
 
 error_info (int c, const std::string &msg, const std::string &mod, const std::string &det)
 Construct with code, message, module and details.
 
template<typename Enum , typename std::enable_if_t< std::is_enum_v< Enum >, int > = 0>
 error_info (Enum c, std::string msg, std::string mod="", std::optional< std::string > det=std::nullopt)
 Construct from strongly-typed enum error codes.
 
bool operator== (const error_info &other) const
 
bool operator!= (const error_info &other) const
 
 Result (const T &value)
 
 Result (T &&value)
 
 Result (const error_info &error)
 
 Result (error_info &&error)
 
 Result ()=delete
 
 Result (const Result &)=default
 
 Result (Result &&)=default
 
Result & operator= (const Result &)=default
 
Result & operator= (Result &&)=default
 
template<typename U = T>
static Result< T > ok (U &&value)
 
static Result< T > err (const error_info &error)
 
static Result< T > err (error_info &&error)
 
static Result< T > err (int code, const std::string &message, const std::string &module="")
 
static Result< T > uninitialized ()
 
bool is_ok () const
 
bool is_err () const
 
const T & unwrap () const
 
T & unwrap ()
 
unwrap_or (T default_value) const
 
value_or (T default_value) const
 
const T & value () const
 
T & value ()
 
const error_info & error () const
 
template<typename F >
auto map (F &&func) const -> Result< decltype(func(std::declval< T >()))>
 
template<typename F >
auto and_then (F &&func) const -> decltype(func(std::declval< T >()))
 
template<typename F >
Result< T > or_else (F &&func) const
 
 Optional ()
 
 Optional (const T &value)
 
 Optional (T &&value)
 
 Optional (std::nullopt_t)
 
bool has_value () const
 
bool is_some () const
 
bool is_none () const
 
const T & value () const
 
T & value ()
 
const T & unwrap () const
 
unwrap_or (T default_value) const
 
template<typename F >
auto map (F &&func) const -> Optional< decltype(func(std::declval< T >()))>
 
template<typename T >
Optional< T > kcenon::common::Some (T value)
 Create an Optional with value.
 
template<typename T >
Optional< T > kcenon::common::None ()
 Create an empty Optional.
 
VoidResult kcenon::common::ok ()
 Create a successful void result.
 
VoidResult kcenon::common::err (const error_info &error)
 Factory function to create error VoidResult.
 
VoidResult kcenon::common::err (int code, const std::string &message, const std::string &module="")
 Factory function to create error VoidResult.
 
template<typename T >
Result< T > kcenon::common::ok (T value)
 Create a successful result.
 
template<typename T >
Result< T > kcenon::common::make_error (int code, const std::string &message, const std::string &module="")
 Create an error result with code and message.
 
template<typename T >
Result< T > kcenon::common::make_error (int code, const std::string &message, const std::string &module, const std::string &details)
 Create an error result with details.
 
template<typename T >
Result< T > kcenon::common::make_error (const error_info &err)
 Create an error result from existing error_info.
 
static error_info map_unknown_exception (const std::string &module="")
 
static error_info map_generic_exception (const std::exception &e, const std::string &module="")
 
template<typename T , typename F >
Result< T > kcenon::common::try_catch (F &&func, const std::string &module="")
 Convert exception to Result with automatic error code mapping.
 
template<typename F >
VoidResult kcenon::common::try_catch_void (F &&func, const std::string &module="")
 Convert exception to VoidResult with automatic error code mapping.
 
virtual ~IJob ()=default
 
virtual VoidResult execute ()=0
 Execute the job.
 
virtual std::string get_name () const
 Get the name of the job.
 
virtual int get_priority () const
 Get the priority of the job.
 
virtual ~IExecutor ()=default
 
virtual Result< std::future< void > > execute (std::unique_ptr< IJob > &&job)=0
 Execute a job with Result-based error handling.
 
virtual Result< std::future< void > > execute_delayed (std::unique_ptr< IJob > &&job, std::chrono::milliseconds delay)=0
 Execute a job with delay.
 
virtual size_t worker_count () const =0
 Get the number of worker threads.
 
virtual bool is_running () const =0
 Check if the executor is running.
 
virtual size_t pending_tasks () const =0
 Get the number of pending tasks.
 
virtual void shutdown (bool wait_for_completion=true)=0
 Shutdown the executor gracefully.
 
virtual ~IExecutorProvider ()=default
 
virtual std::shared_ptr< IExecutor > get_executor ()=0
 
virtual std::shared_ptr< IExecutor > create_executor (size_t worker_count)=0
 
virtual ~IThreadPool ()=default
 
virtual VoidResult resize (size_t new_size)=0
 
virtual size_t min_workers () const
 
virtual size_t max_workers () const
 
virtual VoidResult set_queue_capacity (size_t capacity)=0
 
virtual size_t get_queue_capacity () const =0
 
virtual bool is_queue_full () const =0
 
virtual size_t clear_pending_tasks ()=0
 
virtual VoidResult start ()=0
 
virtual VoidResult stop (bool wait_for_completion=true)=0
 
virtual VoidResult pause ()=0
 
virtual VoidResult resume ()=0
 
virtual bool is_paused () const =0
 
virtual size_t active_tasks () const =0
 
virtual size_t idle_workers () const =0
 
virtual size_t completed_tasks () const
 
virtual size_t failed_tasks () const
 
virtual ~IThreadPoolProvider ()=default
 
virtual std::shared_ptr< IThreadPool > get_thread_pool ()=0
 
virtual Result< std::shared_ptr< IThreadPool > > create_thread_pool (size_t worker_count, size_t queue_capacity=0)=0
 
virtual ~IDatabase ()=default
 
virtual ~IServiceContainer ()=default
 
template<typename Interface , typename Factory >
void register_factory (Factory &&factory)
 Register a service with a factory function.
 
template<typename Interface >
void register_singleton (std::shared_ptr< Interface > instance)
 Register a singleton instance.
 
template<typename Interface >
std::shared_ptr< Interface > resolve ()
 Resolve a service by interface type.
 
template<typename Interface >
bool has () const
 Check if a service is registered.
 
virtual void register_impl (std::type_index type, std::any factory)=0
 
virtual void register_singleton_impl (std::type_index type, std::any instance)=0
 
virtual std::any resolve_impl (std::type_index type)=0
 
virtual bool has_impl (std::type_index type) const =0
 
 ServiceContainer ()=default
 
void register_impl (std::type_index type, std::any factory) override
 
void register_singleton_impl (std::type_index type, std::any instance) override
 
std::any resolve_impl (std::type_index type) override
 
bool has_impl (std::type_index type) const override
 
virtual ~IBootstrapper ()=default
 
virtual bool initialize ()=0
 Initialize the system.
 
virtual void shutdown ()=0
 Shutdown the system.
 
virtual bool is_initialized () const =0
 Check if the system is initialized.
 
 log_entry (log_level lvl=log_level::info, const std::string &msg="")
 
static log_entry create (log_level lvl, std::string_view msg, const source_location &loc=source_location::current())
 
virtual ~ILogger ()=default
 
virtual VoidResult log (log_level level, const std::string &message)=0
 
virtual VoidResult log (log_level level, std::string_view message, const source_location &loc=source_location::current())
 
virtual VoidResult log (const log_entry &entry)=0
 
virtual bool is_enabled (log_level level) const =0
 
virtual VoidResult set_level (log_level level)=0
 
virtual log_level get_level () const =0
 
virtual VoidResult flush ()=0
 
virtual ~ILoggerProvider ()=default
 
virtual std::shared_ptr< ILogger > get_logger ()=0
 
virtual std::shared_ptr< ILogger > create_logger (const std::string &name)=0
 
 logger_config ()=default
 
 logger_config (log_level level, const std::string &fmt="")
 
virtual ~ILoggerRegistry ()=default
 
virtual VoidResult register_logger (const std::string &name, std::shared_ptr< ILogger > logger)=0
 
virtual std::shared_ptr< ILogger > get_logger (const std::string &name)=0
 
virtual VoidResult unregister_logger (const std::string &name)=0
 
virtual std::shared_ptr< ILogger > get_default_logger ()=0
 
virtual VoidResult set_default_logger (std::shared_ptr< ILogger > logger)=0
 
std::string kcenon::common::interfaces::to_string (log_level level)
 Convert log level to string.
 
log_level kcenon::common::interfaces::from_string (const std::string &str)
 Parse log level from string (case-insensitive)
 
void kcenon::common::logging::log_trace (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log a trace message.
 
void kcenon::common::logging::log_debug (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log a debug message.
 
void kcenon::common::logging::log_info (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log an info message.
 
void kcenon::common::logging::log_warning (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log a warning message.
 
void kcenon::common::logging::log_error (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log an error message.
 
void kcenon::common::logging::log_critical (std::shared_ptr< interfaces::ILogger > logger, std::string_view message)
 Log a critical message.
 
 ConsoleLogger (interfaces::log_level level=interfaces::log_level::info)
 
VoidResult log (interfaces::log_level level, const std::string &message) override
 Log a message with specified level.
 
VoidResult log (const interfaces::log_entry &entry) override
 Log a structured entry.
 
bool is_enabled (interfaces::log_level level) const override
 Check if logging is enabled for the specified level.
 
VoidResult set_level (interfaces::log_level level) override
 Set the minimum log level.
 
interfaces::log_level get_level () const override
 Get the current minimum log level.
 
VoidResult flush () override
 Flush any buffered log messages.
 
std::shared_ptr< interfaces::ILogger > kcenon::common::logging::make_console_logger (interfaces::log_level level=interfaces::log_level::info)
 Create a console logger.
 
std::string_view kcenon::common::error::get_error_message (int code)
 Get human-readable error message for error code.
 
std::string_view kcenon::common::error::get_category_name (int code)
 Get category name for error code.
 
 SimpleEventBus ()
 
 ~SimpleEventBus ()
 
void start ()
 Start the event bus.
 
void stop ()
 Stop the event bus.
 
bool is_running () const
 Check if the event bus is running.
 
template<typename Event >
uint64_t subscribe (std::function< void(const Event &)> handler)
 Subscribe to events of a specific type.
 
void unsubscribe (uint64_t subscription_id)
 Unsubscribe from events.
 
template<typename Event >
void publish (const Event &event)
 Publish an event to all subscribers.
 
template<typename Event >
size_t subscriber_count () const
 Get the number of subscribers for an event type.
 
void clear ()
 Clear all subscriptions.
 

Variables

static constexpr int major = 0
 
static constexpr int minor = 2
 
static constexpr int patch = 0
 
static constexpr int tweak = 0
 
static constexpr const char * string = "0.2.0.0"
 
static constexpr const char * module_name = "kcenon.common"
 
const char * file_
 
const char * function_
 
int line_
 
int column_
 
std::mutex mutex_
 
std::array< T, Capacity > buffer_ {}
 
std::size_t head_ {0}
 
std::size_t tail_ {0}
 
std::size_t size_ {0}
 
std::size_t growth_
 
std::mutex mutex_
 
std::stack< T * > free_list_
 
std::vector< RawPtr > storage_
 
static constexpr bool has_source_location
 
static constexpr bool has_concepts = true
 
static constexpr bool has_ranges
 
std::string key
 
config_value value
 
std::optional< std::string > description
 
bool required = false
 
std::string name
 
std::string short_name
 
std::string description
 
bool required = false
 
bool takes_value = true
 
std::optional< std::string > default_value
 
std::map< std::string, std::string > options
 
std::vector< std::string > positional_args
 
std::vector< std::string > errors
 
std::vector< cli_option > options_
 
const char * file_
 
const char * function_
 
int line_
 
int column_
 
int code
 
std::string message
 
std::string module
 
std::optional< std::string > details
 
std::optional< T > value_
 
std::optional< error_info > error_
 
std::optional< T > value_
 
constexpr int kcenon::common::error_codes::SUCCESS = error::codes::common_errors::success
 
constexpr int kcenon::common::error_codes::INVALID_ARGUMENT = error::codes::common_errors::invalid_argument
 
constexpr int kcenon::common::error_codes::NOT_FOUND = error::codes::common_errors::not_found
 
constexpr int kcenon::common::error_codes::PERMISSION_DENIED = error::codes::common_errors::permission_denied
 
constexpr int kcenon::common::error_codes::TIMEOUT = error::codes::common_errors::timeout
 
constexpr int kcenon::common::error_codes::CANCELLED = error::codes::common_errors::cancelled
 
constexpr int kcenon::common::error_codes::NOT_INITIALIZED = error::codes::common_errors::not_initialized
 
constexpr int kcenon::common::error_codes::ALREADY_EXISTS = error::codes::common_errors::already_exists
 
constexpr int kcenon::common::error_codes::OUT_OF_MEMORY = error::codes::common_errors::out_of_memory
 
constexpr int kcenon::common::error_codes::IO_ERROR = error::codes::common_errors::io_error
 
constexpr int kcenon::common::error_codes::NETWORK_ERROR = error::codes::common_errors::network_error
 
constexpr int kcenon::common::error_codes::REGISTRY_FROZEN = error::codes::common_errors::registry_frozen
 
constexpr int kcenon::common::error_codes::INTERNAL_ERROR = error::codes::common_errors::internal_error
 
constexpr int kcenon::common::error_codes::THREAD_ERROR_BASE = static_cast<int>(error::category::thread_system)
 
constexpr int kcenon::common::error_codes::LOGGER_ERROR_BASE = static_cast<int>(error::category::logger_system)
 
constexpr int kcenon::common::error_codes::MONITORING_ERROR_BASE = static_cast<int>(error::category::monitoring_system)
 
constexpr int kcenon::common::error_codes::CONTAINER_ERROR_BASE = static_cast<int>(error::category::container_system)
 
constexpr int kcenon::common::error_codes::DATABASE_ERROR_BASE = static_cast<int>(error::category::database_system)
 
constexpr int kcenon::common::error_codes::NETWORK_ERROR_BASE = static_cast<int>(error::category::network_system)
 
std::mutex mutex_
 
std::unordered_map< std::type_index, std::any > factories_
 
std::unordered_map< std::type_index, std::any > singletons_
 
log_level level
 
std::string message
 
std::string file
 
int line
 
std::string function
 
std::chrono::system_clock::time_point timestamp
 
source_location location
 C++20 source_location (Issue #177)
 
log_level min_level = log_level::info
 
std::string pattern = "[%Y-%m-%d %H:%M:%S.%e] [%l] %v"
 
bool async_mode = false
 
size_t queue_size = 8192
 
bool color_enabled = false
 
interfaces::log_level level_
 
constexpr int kcenon::common::error::codes::common_errors::success = 0
 
constexpr int kcenon::common::error::codes::common_errors::invalid_argument = -1
 
constexpr int kcenon::common::error::codes::common_errors::not_found = -2
 
constexpr int kcenon::common::error::codes::common_errors::permission_denied = -3
 
constexpr int kcenon::common::error::codes::common_errors::timeout = -4
 
constexpr int kcenon::common::error::codes::common_errors::cancelled = -5
 
constexpr int kcenon::common::error::codes::common_errors::not_initialized = -6
 
constexpr int kcenon::common::error::codes::common_errors::already_exists = -7
 
constexpr int kcenon::common::error::codes::common_errors::out_of_memory = -8
 
constexpr int kcenon::common::error::codes::common_errors::io_error = -9
 
constexpr int kcenon::common::error::codes::common_errors::network_error = -10
 
constexpr int kcenon::common::error::codes::common_errors::registry_frozen = -11
 
constexpr int kcenon::common::error::codes::common_errors::internal_error = -99
 
constexpr int kcenon::common::error::codes::thread_system::base = static_cast<int>(category::thread_system)
 
constexpr int kcenon::common::error::codes::thread_system::pool_full = base - 0
 
constexpr int kcenon::common::error::codes::thread_system::pool_shutdown = base - 1
 
constexpr int kcenon::common::error::codes::thread_system::pool_not_started = base - 2
 
constexpr int kcenon::common::error::codes::thread_system::invalid_pool_size = base - 3
 
constexpr int kcenon::common::error::codes::thread_system::worker_failed = base - 20
 
constexpr int kcenon::common::error::codes::thread_system::worker_not_found = base - 21
 
constexpr int kcenon::common::error::codes::thread_system::worker_busy = base - 22
 
constexpr int kcenon::common::error::codes::thread_system::job_rejected = base - 40
 
constexpr int kcenon::common::error::codes::thread_system::job_timeout = base - 41
 
constexpr int kcenon::common::error::codes::thread_system::job_cancelled = base - 42
 
constexpr int kcenon::common::error::codes::thread_system::invalid_job = base - 43
 
constexpr int kcenon::common::error::codes::thread_system::queue_full = base - 60
 
constexpr int kcenon::common::error::codes::thread_system::queue_empty = base - 61
 
constexpr int kcenon::common::error::codes::thread_system::queue_stopped = base - 62
 
constexpr int kcenon::common::error::codes::logger_system::base = static_cast<int>(category::logger_system)
 
constexpr int kcenon::common::error::codes::logger_system::file_open_failed = base - 0
 
constexpr int kcenon::common::error::codes::logger_system::file_write_failed = base - 1
 
constexpr int kcenon::common::error::codes::logger_system::file_close_failed = base - 2
 
constexpr int kcenon::common::error::codes::logger_system::file_rotation_failed = base - 3
 
constexpr int kcenon::common::error::codes::logger_system::file_permission_denied = base - 4
 
constexpr int kcenon::common::error::codes::logger_system::writer_not_initialized = base - 20
 
constexpr int kcenon::common::error::codes::logger_system::writer_stopped = base - 21
 
constexpr int kcenon::common::error::codes::logger_system::writer_full = base - 22
 
constexpr int kcenon::common::error::codes::logger_system::async_writer_failed = base - 23
 
constexpr int kcenon::common::error::codes::logger_system::invalid_format = base - 40
 
constexpr int kcenon::common::error::codes::logger_system::format_error = base - 41
 
constexpr int kcenon::common::error::codes::logger_system::invalid_filter = base - 60
 
constexpr int kcenon::common::error::codes::logger_system::filter_rejected = base - 61
 
constexpr int kcenon::common::error::codes::monitoring_system::base = static_cast<int>(category::monitoring_system)
 
constexpr int kcenon::common::error::codes::monitoring_system::metric_not_found = base - 0
 
constexpr int kcenon::common::error::codes::monitoring_system::invalid_metric_type = base - 1
 
constexpr int kcenon::common::error::codes::monitoring_system::metric_collection_failed = base - 2
 
constexpr int kcenon::common::error::codes::monitoring_system::storage_full = base - 20
 
constexpr int kcenon::common::error::codes::monitoring_system::storage_error = base - 21
 
constexpr int kcenon::common::error::codes::monitoring_system::event_publish_failed = base - 40
 
constexpr int kcenon::common::error::codes::monitoring_system::event_subscribe_failed = base - 41
 
constexpr int kcenon::common::error::codes::monitoring_system::invalid_event_type = base - 42
 
constexpr int kcenon::common::error::codes::monitoring_system::profiler_not_enabled = base - 60
 
constexpr int kcenon::common::error::codes::monitoring_system::profiler_error = base - 61
 
constexpr int kcenon::common::error::codes::container_system::base = static_cast<int>(category::container_system)
 
constexpr int kcenon::common::error::codes::container_system::value_type_mismatch = base - 0
 
constexpr int kcenon::common::error::codes::container_system::invalid_value_type = base - 1
 
constexpr int kcenon::common::error::codes::container_system::value_conversion_failed = base - 2
 
constexpr int kcenon::common::error::codes::container_system::serialization_failed = base - 20
 
constexpr int kcenon::common::error::codes::container_system::deserialization_failed = base - 21
 
constexpr int kcenon::common::error::codes::container_system::invalid_format = base - 22
 
constexpr int kcenon::common::error::codes::container_system::pool_exhausted = base - 40
 
constexpr int kcenon::common::error::codes::container_system::allocation_failed = base - 41
 
constexpr int kcenon::common::error::codes::container_system::invalid_allocation_size = base - 42
 
constexpr int kcenon::common::error::codes::container_system::key_not_found = base - 60
 
constexpr int kcenon::common::error::codes::container_system::duplicate_key = base - 61
 
constexpr int kcenon::common::error::codes::container_system::container_full = base - 62
 
constexpr int kcenon::common::error::codes::database_system::base = static_cast<int>(category::database_system)
 
constexpr int kcenon::common::error::codes::database_system::connection_failed = base - 0
 
constexpr int kcenon::common::error::codes::database_system::connection_lost = base - 1
 
constexpr int kcenon::common::error::codes::database_system::connection_timeout = base - 2
 
constexpr int kcenon::common::error::codes::database_system::invalid_connection_string = base - 3
 
constexpr int kcenon::common::error::codes::database_system::pool_exhausted = base - 20
 
constexpr int kcenon::common::error::codes::database_system::pool_shutdown = base - 21
 
constexpr int kcenon::common::error::codes::database_system::pool_timeout = base - 22
 
constexpr int kcenon::common::error::codes::database_system::query_failed = base - 40
 
constexpr int kcenon::common::error::codes::database_system::query_syntax_error = base - 41
 
constexpr int kcenon::common::error::codes::database_system::query_timeout = base - 42
 
constexpr int kcenon::common::error::codes::database_system::transaction_failed = base - 60
 
constexpr int kcenon::common::error::codes::database_system::transaction_rolled_back = base - 61
 
constexpr int kcenon::common::error::codes::database_system::transaction_timeout = base - 62
 
constexpr int kcenon::common::error::codes::network_system::base = static_cast<int>(category::network_system)
 
constexpr int kcenon::common::error::codes::network_system::connection_failed = base - 0
 
constexpr int kcenon::common::error::codes::network_system::connection_refused = base - 1
 
constexpr int kcenon::common::error::codes::network_system::connection_timeout = base - 2
 
constexpr int kcenon::common::error::codes::network_system::connection_closed = base - 3
 
constexpr int kcenon::common::error::codes::network_system::session_not_found = base - 20
 
constexpr int kcenon::common::error::codes::network_system::session_expired = base - 21
 
constexpr int kcenon::common::error::codes::network_system::invalid_session = base - 22
 
constexpr int kcenon::common::error::codes::network_system::send_failed = base - 40
 
constexpr int kcenon::common::error::codes::network_system::receive_failed = base - 41
 
constexpr int kcenon::common::error::codes::network_system::message_too_large = base - 42
 
constexpr int kcenon::common::error::codes::network_system::server_not_started = base - 60
 
constexpr int kcenon::common::error::codes::network_system::server_already_running = base - 61
 
constexpr int kcenon::common::error::codes::network_system::bind_failed = base - 62
 
constexpr int kcenon::common::error::codes::pacs_system::base = static_cast<int>(category::pacs_system)
 
constexpr int kcenon::common::error::codes::pacs_system::file_not_found = base - 0
 
constexpr int kcenon::common::error::codes::pacs_system::file_read_error = base - 1
 
constexpr int kcenon::common::error::codes::pacs_system::file_write_error = base - 2
 
constexpr int kcenon::common::error::codes::pacs_system::invalid_dicom_file = base - 3
 
constexpr int kcenon::common::error::codes::pacs_system::missing_dicm_prefix = base - 4
 
constexpr int kcenon::common::error::codes::pacs_system::invalid_meta_info = base - 5
 
constexpr int kcenon::common::error::codes::pacs_system::missing_transfer_syntax = base - 6
 
constexpr int kcenon::common::error::codes::pacs_system::unsupported_transfer_syntax = base - 7
 
constexpr int kcenon::common::error::codes::pacs_system::element_not_found = base - 20
 
constexpr int kcenon::common::error::codes::pacs_system::value_conversion_error = base - 21
 
constexpr int kcenon::common::error::codes::pacs_system::invalid_vr = base - 22
 
constexpr int kcenon::common::error::codes::pacs_system::invalid_tag = base - 23
 
constexpr int kcenon::common::error::codes::pacs_system::data_size_mismatch = base - 24
 
constexpr int kcenon::common::error::codes::pacs_system::decode_error = base - 40
 
constexpr int kcenon::common::error::codes::pacs_system::encode_error = base - 41
 
constexpr int kcenon::common::error::codes::pacs_system::compression_error = base - 42
 
constexpr int kcenon::common::error::codes::pacs_system::decompression_error = base - 43
 
constexpr int kcenon::common::error::codes::pacs_system::association_rejected = base - 60
 
constexpr int kcenon::common::error::codes::pacs_system::association_aborted = base - 61
 
constexpr int kcenon::common::error::codes::pacs_system::dimse_error = base - 62
 
constexpr int kcenon::common::error::codes::pacs_system::pdu_error = base - 63
 
constexpr int kcenon::common::error::codes::pacs_system::storage_failed = base - 80
 
constexpr int kcenon::common::error::codes::pacs_system::retrieve_failed = base - 81
 
constexpr int kcenon::common::error::codes::pacs_system::query_failed = base - 82
 
uint64_t id
 
std::function< void(const void *)> handler
 
std::shared_mutex mutex_
 
std::atomic< bool > running_
 
std::atomic< uint64_t > next_id_
 
std::unordered_map< std::type_index, std::vector< HandlerEntry > > handlers_
 

Files

file  src/modules/common.cppm
 Primary C++20 module for common_system.
 
file  src/modules/concepts.cppm
 C++20 module partition for common_system concepts.
 
file  src/modules/config.cppm
 C++20 module partition for configuration.
 
file  src/modules/interfaces/core.cppm
 C++20 module partition aggregator for core interfaces.
 
file  src/modules/result/core.cppm
 C++20 module partition for Result<T> core types.
 
file  src/modules/di.cppm
 C++20 module partition for dependency injection.
 
file  src/modules/error.cppm
 C++20 module partition for error codes.
 
file  src/modules/interfaces/executor.cppm
 C++20 module partition for executor interfaces.
 
file  src/modules/interfaces.cppm
 C++20 module partition aggregator for interfaces.
 
file  src/modules/interfaces/logger.cppm
 C++20 module partition for logger interfaces.
 
file  src/modules/logging.cppm
 C++20 module partition for logging utilities.
 
file  src/modules/patterns.cppm
 C++20 module partition for design patterns.
 
file  src/modules/result.cppm
 C++20 module partition aggregator for Result<T> pattern.
 
file  src/modules/result/utilities.cppm
 C++20 module partition for Result<T> utility functions.
 
file  src/modules/utils.cppm
 C++20 module partition for common_system utilities.