14export import :expression;
17export template <
typename Type>
25 : impl_(std::shared_ptr<dimension_impl<
value_type>>{
new dimension_impl<value_type>}) {
32 impl_->set_expression(expr);
33 impl_->mark_unknown();
39 impl_->set_expression(expr);
40 impl_->mark_unknown();
43 explicit dimension(
const std::shared_ptr<context>& ctx)
46 impl_->mark_unknown();
52 impl_->set_expression(expr);
53 impl_->mark_unknown();
59 impl_->set_expression(other.impl_->expr_);
60 impl_->value_ = other.impl_->value_;
62 impl_->unknown_ =
false;
63 if (other.impl_->unknown_) {
64 impl_->mark_unknown();
69 impl_->set_expression(other.impl_->expr_);
70 impl_->value_ = other.impl_->value_;
71 impl_->unknown_ =
false;
72 if (other.impl_->unknown_) {
73 impl_->mark_unknown();
79 impl_->set_expression(expr);
80 impl_->mark_unknown();
85 impl_->set_expression(expr);
86 impl_->mark_unknown();
91 impl_->value_ = std::move(expr);
92 impl_->set_expression(std::move(expr));
93 impl_->unknown_ =
false;
99 impl_->set_expression(expr);
100 impl_->unknown_ =
false;
109 return impl_->is_set();
113 for (
const auto& dep: impl_->expr_.dependencies_) {
114 dep->dependents_.erase({impl_});
120 return impl_->context_;
122 void set_context(
const std::shared_ptr<context>& ctx,
const std::string& name =
"") {
123 impl_->set_context(ctx, name);
134 template <
typename S>
138 template <
typename S>
141 const std::unordered_map<std::string,
dimension<S>>& parameters
143 template <
typename S>
145 template <
typename S>
147 template <
typename S>
152 const std::unordered_map<std::string,
dimension<S>>& global_parameters
157 return impl_->value_;
164 [[meta(refl::eq_policy::shallow)]]
178#define OPERATOR subtract
179#define ENUM SUBTRACTION
184#define OPERATOR multiply
185#define ENUM MULTIPLICATION
190#define OPERATOR divide
199#define OP_FUNCTION add
205#define OP_FUNCTION subtract
211#define OP_FUNCTION multiply
217#define OP_FUNCTION divide
std::shared_ptr< dimension_impl > sptr
dimension & operator=(expression &&expr)
dimension & operator=(value_type &&expr)
friend compute_result_t< S > compute_dimension(dimension< S > &dim_, const std::unordered_map< std::string, dimension< S > > ¶meters)
void set_context(const std::shared_ptr< context > &ctx, const std::string &name="")
dimension & operator=(const expression &expr)
dimension(const std::shared_ptr< context > &ctx)
expression< value_type > expression
context< value_type > context
const std::shared_ptr< context > & get_context() const
dimension(const dimension &other)
friend bool find_cycle(cycle_t< S > &cycle, typename dimension_impl< S >::sptr start, typename dimension_impl< S >::sptr head, const std::unordered_map< std::string, dimension< S > > &global_parameters)
friend bool evaluate_expression(typename dimension_impl< S >::sptr dim, const std::unordered_map< std::string, dimension< S > > ¶meters)
dimension(expression &&expr)
const expression & get_expression() const
dimensions::screen_measure value_type
friend struct dimensional_operators
dimension(const expression &expr)
friend const S & get_value(dimension< S > &dim)
bool operator==(const dimension &rhl) const
dimension & operator=(const dimension &other)
dimension(const std::shared_ptr< context > &ctx, expression &&expr)
dimensional_operators()=delete