codac 2.0.0
Loading...
Searching...
No Matches
codac2_TSlice.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <map>
13#include <memory>
14#include "codac2_Interval.h"
15
16namespace codac2
17{
18 class SliceBase;
19 class SlicedTubeBase;
20
34 class TSlice : private Interval
35 {
36 public:
37
43 explicit TSlice(const Interval& tdomain);
44
54 TSlice(const TSlice& tslice, const Interval& tdomain); // performs a deep copy on slices
55
64 bool is_gate() const;
65
75 const std::map<const SlicedTubeBase*,std::shared_ptr<SliceBase>>& slices() const;
76
77 // Read-only interval interface. Temporal bounds must only be changed
78 // by TDomain to preserve its temporal index.
79 using Interval::operator new;
80 using Interval::operator delete;
81
82 using Interval::lb;
83 using Interval::ub;
84 using Interval::mid;
85 using Interval::rad;
86 using Interval::diam;
94
99 const Interval& t0_tf() const
100 {
101 return *this;
102 }
103
104 // Keep copy construction for tslices_vector() and list insertion,
105 // but prevent replacing a temporal slice through a mutable iterator.
106 TSlice(const TSlice&) = default;
107 TSlice& operator=(const TSlice&) = delete;
108
109 bool operator==(const Interval& x) const
110 {
111 return Interval::operator==(x);
112 }
113
114 bool operator!=(const Interval& x) const
115 {
116 return !(*this == x);
117 }
118
119 bool operator==(const TSlice& x) const
120 {
121 return Interval::operator==(x);
122 }
123
124 bool operator!=(const TSlice& x) const
125 {
126 return !(*this == x);
127 }
128
129 friend bool operator==(const Interval& x, const TSlice& y)
130 {
131 return y == x;
132 }
133
134 friend bool operator!=(const Interval& x, const TSlice& y)
135 {
136 return !(y == x);
137 }
138
139 friend std::ostream& operator<<(std::ostream& os, const TSlice& x)
140 {
141 return os << x.t0_tf();
142 }
143
144 ~TSlice() override;
145
146 protected:
147
151 std::map<const SlicedTubeBase*,std::shared_ptr<SliceBase>> _slices;
152
153 friend class TDomain;
154 friend class SlicedTubeBase;
155 template<typename T>
156 friend class SlicedTube;
157 };
158}
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:50
bool is_unbounded() const
Tests if one of the bounds of this is infinite.
Definition codac2_Interval_impl.h:236
bool operator==(const Interval &x) const
Comparison (equality) between two intervals.
Definition codac2_Interval_impl.h:100
bool is_empty() const
Tests if this is empty.
Definition codac2_Interval_impl.h:221
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:131
bool intersects(const Interval &x) const
Tests if this and x intersect.
Definition codac2_Interval_impl.h:256
bool is_degenerated() const
Tests if this is degenerated, that is, in the form of .
Definition codac2_Interval_impl.h:241
double diam() const
Returns the diameter of this.
Definition codac2_Interval_impl.h:193
bool is_superset(const Interval &x) const
Tests if this is a superset of x.
Definition codac2_Interval_impl.h:294
double rad() const
Returns the radius of this.
Definition codac2_Interval_impl.h:176
bool is_subset(const Interval &x) const
Tests if this is a subset of x.
Definition codac2_Interval_impl.h:271
Interval()
Creates an interval .
Definition codac2_Interval_impl.h:23
bool contains(const double &x) const
Tests if this contains x.
Definition codac2_Interval_impl.h:226
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:126
double mid() const
Returns the midpoint of this.
Definition codac2_Interval_impl.h:136
Base class for codomain slices attached to a temporal slice.
Definition codac2_SliceBase.h:36
Base class for tubes defined over a sliced temporal domain.
Definition codac2_SlicedTubeBase.h:35
Temporal slice shared by sliced tubes.
Definition codac2_TSlice.h:35
const std::map< const SlicedTubeBase *, std::shared_ptr< SliceBase > > & slices() const
Returns the slices attached to this temporal slice.
bool is_gate() const
Tests whether this temporal slice is a gate.
std::map< const SlicedTubeBase *, std::shared_ptr< SliceBase > > _slices
Slices attached to each sliced tube over this temporal interval.
Definition codac2_TSlice.h:151
TSlice(const TSlice &tslice, const Interval &tdomain)
Creates a temporal slice from another one over a new time interval.
const Interval & t0_tf() const
Returns a read-only reference to the temporal interval.
Definition codac2_TSlice.h:99
TSlice(const Interval &tdomain)
Creates a temporal slice over the given time interval.
bool operator==(const Matrix< U_, R_, C_ > &x) const
Compares this matrix with another matrix for equality.
Definition codac2_Matrix_addons_Base.h:78
Definition codac2_OctaSym.h:21