codac 2.0.0
Loading...
Searching...
No Matches
codac2::SlicedTubeBase Class Reference

Base class for tubes defined over a sliced temporal domain. More...

#include <codac2_SlicedTubeBase.h>

Inheritance diagram for codac2::SlicedTubeBase:
Collaboration diagram for codac2::SlicedTubeBase:

Public Member Functions

 SlicedTubeBase (const std::shared_ptr< TDomain > &tdomain)
 Creates a sliced tube over a given temporal domain.
 ~SlicedTubeBase ()
 Destroys this sliced tube.
size_t nb_slices () const
 Returns the number of temporal elements of this tube.
std::shared_ptr< const SliceBasefirst_slice () const
 Returns the first slice of this tube.
std::shared_ptr< const SliceBaselast_slice () const
 Returns the last slice of this tube.
Public Member Functions inherited from codac2::TubeBase
 TubeBase (const std::shared_ptr< TDomain > &tdomain)
 Creates a tube over a given temporal domain.
const std::shared_ptr< TDomain > & tdomain () const
 Returns the temporal domain of this tube.
Interval t0_tf () const
 Returns the global temporal interval of this tube.

Additional Inherited Members

Protected Attributes inherited from codac2::TubeBase
const std::shared_ptr< TDomain_tdomain
 Shared temporal domain of this tube.

Detailed Description

Base class for tubes defined over a sliced temporal domain.

A SlicedTubeBase is a tube whose temporal domain is represented by a TDomain made of TSlice objects.

This class provides common services for all sliced tubes:

  • access to the number of temporal elements,
  • access to the first and last codomain slices,
  • cleanup of the links stored in the temporal partition when the tube is destroyed.

Each TSlice of the associated TDomain stores a map from SlicedTubeBase* to SliceBase. The destructor of this class removes the entries associated with the current tube.

Constructor & Destructor Documentation

◆ SlicedTubeBase()

codac2::SlicedTubeBase::SlicedTubeBase ( const std::shared_ptr< TDomain > & tdomain)
inline

Creates a sliced tube over a given temporal domain.

Parameters
tdomainshared temporal domain of this tube
45 { }
TubeBase(const std::shared_ptr< TDomain > &tdomain)
Creates a tube over a given temporal domain.
Definition codac2_TubeBase.h:38
const std::shared_ptr< TDomain > & tdomain() const
Returns the temporal domain of this tube.
Definition codac2_TubeBase.h:49

◆ ~SlicedTubeBase()

codac2::SlicedTubeBase::~SlicedTubeBase ( )
inline

Destroys this sliced tube.

All references to this tube stored in the TSlice objects of the associated TDomain are removed.

54 {
55 for(auto& s : *_tdomain)
56 s._slices.erase(this);
57 }
const std::shared_ptr< TDomain > _tdomain
Shared temporal domain of this tube.
Definition codac2_TubeBase.h:71

Member Function Documentation

◆ nb_slices()

size_t codac2::SlicedTubeBase::nb_slices ( ) const
inline

Returns the number of temporal elements of this tube.

The count includes all elements stored in the temporal partition, including explicit gates if they exist.

Returns
number of temporal slices of the associated TDomain
68 {
69 return _tdomain->nb_tslices();
70 }

◆ first_slice()

std::shared_ptr< const SliceBase > codac2::SlicedTubeBase::first_slice ( ) const
inline

Returns the first slice of this tube.

Note
This method assumes that the associated temporal domain is not empty and that its first TSlice contains a slice attached to this tube.
Returns
shared pointer to the first slice
82 {
83 const auto& slices = _tdomain->front().slices();
84 assert(slices.find(this) != slices.end());
85 return slices.at(this);
86 }

◆ last_slice()

std::shared_ptr< const SliceBase > codac2::SlicedTubeBase::last_slice ( ) const
inline

Returns the last slice of this tube.

Note
This method assumes that the associated temporal domain is not empty and that its last TSlice contains a slice attached to this tube.
Returns
shared pointer to the last slice
98 {
99 const auto& slices = _tdomain->back().slices();
100 assert(slices.find(this) != slices.end());
101 return slices.at(this);
102 }

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