PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::client::routing_rule Struct Reference

A complete routing rule with conditions and actions. More...

#include <routing_types.h>

Collaboration diagram for kcenon::pacs::client::routing_rule:
Collaboration graph

Public Member Functions

bool is_effective_now () const noexcept
 Check if the rule is currently effective based on schedule.
 

Public Attributes

std::string rule_id
 Unique rule identifier.
 
std::string name
 Human-readable name.
 
std::string description
 Detailed description.
 
bool enabled {true}
 Whether the rule is active.
 
int priority {0}
 Evaluation priority (higher = first)
 
std::vector< routing_conditionconditions
 Conditions (AND logic)
 
std::vector< routing_actionactions
 Actions to execute on match.
 
std::optional< std::string > schedule_cron
 Cron expression for scheduling.
 
std::optional< std::chrono::system_clock::time_point > effective_from
 
std::optional< std::chrono::system_clock::time_point > effective_until
 
size_t triggered_count {0}
 Number of times the rule was triggered.
 
size_t success_count {0}
 Successful forwarding count.
 
size_t failure_count {0}
 Failed forwarding count.
 
std::chrono::system_clock::time_point last_triggered
 
std::chrono::system_clock::time_point created_at
 
std::chrono::system_clock::time_point updated_at
 
int64_t pk {0}
 Primary key (0 if not persisted)
 

Detailed Description

A complete routing rule with conditions and actions.

Rules are evaluated in priority order (higher priority first). All conditions must match (AND logic) for actions to be triggered.

Definition at line 176 of file routing_types.h.

Member Function Documentation

◆ is_effective_now()

bool kcenon::pacs::client::routing_rule::is_effective_now ( ) const
inlinenodiscardnoexcept

Check if the rule is currently effective based on schedule.

Returns
true if the rule can be applied now

Definition at line 232 of file routing_types.h.

232 {
233 if (!enabled) return false;
234
235 auto now = std::chrono::system_clock::now();
236
237 if (effective_from.has_value() && now < effective_from.value()) {
238 return false;
239 }
240
241 if (effective_until.has_value() && now > effective_until.value()) {
242 return false;
243 }
244
245 return true;
246 }
std::optional< std::chrono::system_clock::time_point > effective_until
std::optional< std::chrono::system_clock::time_point > effective_from
bool enabled
Whether the rule is active.

References effective_from, effective_until, and enabled.

Member Data Documentation

◆ actions

std::vector<routing_action> kcenon::pacs::client::routing_rule::actions

Actions to execute on match.

Definition at line 197 of file routing_types.h.

◆ conditions

std::vector<routing_condition> kcenon::pacs::client::routing_rule::conditions

Conditions (AND logic)

Definition at line 196 of file routing_types.h.

◆ created_at

std::chrono::system_clock::time_point kcenon::pacs::client::routing_rule::created_at

Definition at line 215 of file routing_types.h.

◆ description

std::string kcenon::pacs::client::routing_rule::description

Detailed description.

Definition at line 183 of file routing_types.h.

◆ effective_from

std::optional<std::chrono::system_clock::time_point> kcenon::pacs::client::routing_rule::effective_from

Definition at line 204 of file routing_types.h.

Referenced by is_effective_now().

◆ effective_until

std::optional<std::chrono::system_clock::time_point> kcenon::pacs::client::routing_rule::effective_until

Definition at line 205 of file routing_types.h.

Referenced by is_effective_now().

◆ enabled

bool kcenon::pacs::client::routing_rule::enabled {true}

Whether the rule is active.

Definition at line 189 of file routing_types.h.

189{true};

Referenced by is_effective_now().

◆ failure_count

size_t kcenon::pacs::client::routing_rule::failure_count {0}

Failed forwarding count.

Definition at line 213 of file routing_types.h.

213{0};

◆ last_triggered

std::chrono::system_clock::time_point kcenon::pacs::client::routing_rule::last_triggered

Definition at line 214 of file routing_types.h.

◆ name

std::string kcenon::pacs::client::routing_rule::name

◆ pk

int64_t kcenon::pacs::client::routing_rule::pk {0}

Primary key (0 if not persisted)

Definition at line 222 of file routing_types.h.

222{0};

◆ priority

int kcenon::pacs::client::routing_rule::priority {0}

Evaluation priority (higher = first)

Definition at line 190 of file routing_types.h.

190{0};

◆ rule_id

std::string kcenon::pacs::client::routing_rule::rule_id

◆ schedule_cron

std::optional<std::string> kcenon::pacs::client::routing_rule::schedule_cron

Cron expression for scheduling.

Definition at line 203 of file routing_types.h.

◆ success_count

size_t kcenon::pacs::client::routing_rule::success_count {0}

Successful forwarding count.

Definition at line 212 of file routing_types.h.

212{0};

◆ triggered_count

size_t kcenon::pacs::client::routing_rule::triggered_count {0}

Number of times the rule was triggered.

Definition at line 211 of file routing_types.h.

211{0};

◆ updated_at

std::chrono::system_clock::time_point kcenon::pacs::client::routing_rule::updated_at

Definition at line 216 of file routing_types.h.


The documentation for this struct was generated from the following file: