codac  1.5.7
codac2_TDomain.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC2_TDOMAIN_H__
13 #define __CODAC2_TDOMAIN_H__
14 
15 #include <map>
16 #include <list>
17 #include <vector>
18 #include <memory>
19 
20 #include "codac_Interval.h"
21 #include "codac_predef_values.h"
22 
23 namespace codac2
24 {
25  using codac::Interval;
26  class TSlice;
27 
28  class TDomain
29  {
30  public:
31 
32  explicit TDomain(const Interval& t0_tf);
33  explicit TDomain(const Interval& t0_tf, double dt, bool with_gates = false);
34  const Interval t0_tf() const; // todo: keep this method?
35  std::list<TSlice>::iterator iterator_tslice(double t); // returns it on last slice if t==t_f, not end
36  size_t nb_tslices() const;
37  size_t nb_tubes() const;
38  bool all_gates_defined() const;
39  std::list<TSlice>::iterator sample(double t, bool with_gate = false);
40  void sample(const Interval& t0_tf, double dt, bool with_gates = false);
41  friend std::ostream& operator<<(std::ostream& os, const TDomain& x);
42  const std::list<TSlice>& tslices() const;
43  std::list<TSlice>& tslices();
44  void delete_gates();
45  static bool are_same(const std::shared_ptr<TDomain>& tdom1, const std::shared_ptr<TDomain>& tdom2);
46 
47 
48  protected:
49 
50  std::list<TSlice> _tslices;
51 
52  template<typename U>
53  friend class Tube;
54  };
55 
56  std::shared_ptr<TDomain> create_tdomain(const Interval& t0_tf = Interval(-oo,oo));
57  std::shared_ptr<TDomain> create_tdomain(const Interval& t0_tf, double dt, bool with_gates = false);
58 
59 } // namespace codac
60 
61 #endif