Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
geo::part::PartitionWithData< Data > Class Template Reference

Partition also containing data directly. More...

#include <Partitions.h>

Inheritance diagram for geo::part::PartitionWithData< Data >:
geo::part::Partition< Data > geo::part::PartitionBase geo::part::AreaOwner geo::part::PartitionContainer< Data > geo::part::PartitionElement< Data > geo::part::GridPartition< Data > geo::part::SortedPartition< Data, Sorter >

Public Types

using Base_t = Partition< Data >
 Base class. More...
 
using Partition_t = Partition< Data >
 Base type of the partition. More...
 
using Data_t = typename Partition_t::Data_t
 Type of contained data. More...
 
using Area_t = typename Partition_t::Area_t
 Type of covered area. More...
 
- Public Types inherited from geo::part::Partition< Data >
using Data_t = Data
 Type of data stored in the partition. More...
 
using Partition_t = Partition< Data >
 This type. More...
 
using Area_t = PartitionBase::Area_t
 Type of area. More...
 
using Subpartitions_t = std::vector< std::unique_ptr< Partition_t const >>
 Type of list of subpartitions. It needs to preserve polymorphism. More...
 
- Public Types inherited from geo::part::PartitionBase
using Area_t = AreaOwner::Area_t
 
using AreaRangeMember_t = AreaOwner::AreaRangeMember_t
 
- Public Types inherited from geo::part::AreaOwner
using Area_t = lar::util::simple_geo::Rectangle< double >
 Type of area covered by the partition. More...
 
using AreaRangeMember_t = Area_t::Range_t(Area_t::*)
 Type of pointer to Area_t data member of type Range_t. More...
 

Public Member Functions

 PartitionWithData (Area_t const &area, Data_t *myData)
 Constructor: sets the covered area and the contained datum. More...
 
virtual Data_tdata () const override
 Returns the datum directly stored (nullptr if none). More...
 
virtual Data_tatPoint (double w, double d) const override
 Returns stored datum only if point is covered, nullptr otherwise. More...
 
- Public Member Functions inherited from geo::part::Partition< Data >
 Partition (Area_t const &area)
 Constructor: sets the covered area and no subpartitions. More...
 
virtual ~Partition ()=default
 Destructor (default, virtual). More...
 
std::string describe (std::string indent, std::string firstIndent) const
 Returns a description of the partition. More...
 
std::string describe (std::string indent="") const
 Returns a description of the partition. More...
 
template<typename Pred >
void walk (Pred &&pred) const
 Applies pred to all partitions. More...
 
std::size_t nParts () const
 Returns the number of subparts in the partition (0 if simple element). More...
 
- Public Member Functions inherited from geo::part::PartitionBase
 PartitionBase (Area_t const &area)
 Constructor: sets the covered area and no subpartitions. More...
 
- Public Member Functions inherited from geo::part::AreaOwner
 AreaOwner (Area_t const &area)
 Constructor: sets the covered area and no subpartitions. More...
 
bool contains (double w, double d) const
 Returns whether the specified point is covered by this object. More...
 
Area_t const & area () const
 Returns the covered area. More...
 
template<typename Stream >
void dumpArea (Stream &&out) const
 Output the owned area into an output stream. More...
 

Private Member Functions

virtual std::string doDescribe (std::string indent, std::string firstIndent) const override
 Returns a description of the partition. More...
 

Private Attributes

Data_tmyData
 The contained datum. More...
 

Additional Inherited Members

- Protected Member Functions inherited from geo::part::Partition< Data >
virtual Subpartitions_t const & parts () const
 Returns a list of all subpartitions. More...
 
- Protected Member Functions inherited from geo::part::PartitionBase
std::string describeArea (std::string indent, std::string firstIndent) const
 Returns a description of the partition area. More...
 
- Static Protected Member Functions inherited from geo::part::Partition< Data >
template<typename Pred >
static void walk (Partition_t const *start, Pred &&pred)
 
- Static Protected Attributes inherited from geo::part::Partition< Data >
static Subpartitions_t const NoSubparts
 Subpartitions (if any). More...
 

Detailed Description

template<typename Data>
class geo::part::PartitionWithData< Data >

Partition also containing data directly.

Definition at line 275 of file Partitions.h.

Member Typedef Documentation

template<typename Data >
using geo::part::PartitionWithData< Data >::Area_t = typename Partition_t::Area_t

Type of covered area.

Definition at line 281 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Base_t = Partition<Data>

Base class.

Definition at line 278 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Data_t = typename Partition_t::Data_t

Type of contained data.

Definition at line 280 of file Partitions.h.

template<typename Data >
using geo::part::PartitionWithData< Data >::Partition_t = Partition<Data>

Base type of the partition.

Definition at line 279 of file Partitions.h.

Constructor & Destructor Documentation

template<typename Data >
geo::part::PartitionWithData< Data >::PartitionWithData ( Area_t const &  area,
Data_t myData 
)
inline

Constructor: sets the covered area and the contained datum.

Definition at line 284 of file Partitions.h.

285  : Base_t(area), myData(myData)
286  {}
Area_t const & area() const
Returns the covered area.
Definition: Partitions.h:56
Data_t * myData
The contained datum.
Definition: Partitions.h:296
Partition< Data > Base_t
Base class.
Definition: Partitions.h:278

Member Function Documentation

template<typename Data >
virtual Data_t* geo::part::PartitionWithData< Data >::atPoint ( double  w,
double  d 
) const
inlineoverridevirtual

Returns stored datum only if point is covered, nullptr otherwise.

Implements geo::part::Partition< Data >.

Reimplemented in geo::part::PartitionContainer< Data >.

Definition at line 292 of file Partitions.h.

293  { return Base_t::contains(w, d)? myData: nullptr; }
bool contains(double w, double d) const
Returns whether the specified point is covered by this object.
Definition: Partitions.h:52
Data_t * myData
The contained datum.
Definition: Partitions.h:296
template<typename Data >
virtual Data_t* geo::part::PartitionWithData< Data >::data ( ) const
inlineoverridevirtual

Returns the datum directly stored (nullptr if none).

Reimplemented from geo::part::Partition< Data >.

Definition at line 289 of file Partitions.h.

289 { return myData; }
Data_t * myData
The contained datum.
Definition: Partitions.h:296
template<typename Data >
std::string geo::part::PartitionWithData< Data >::doDescribe ( std::string  indent,
std::string  firstIndent 
) const
overrideprivatevirtual

Returns a description of the partition.

Reimplemented from geo::part::Partition< Data >.

Reimplemented in geo::part::GridPartition< Data >, and geo::part::PartitionContainer< Data >.

Definition at line 820 of file Partitions.h.

821 {
822  std::string msg = Base_t::doDescribe(indent, firstIndent);
823  if (data()) {
824  std::ostringstream sstr;
825  sstr << ": ";
827  msg += sstr.str();
828  }
829  else {
830  msg += " (no data)";
831  }
832  return msg;
833 } // geo::part::PartitionWithData<Data>::doDescribe()
void describePartitionData(Stream &&out, Data const *data, std::string indent="", std::string firstIndent="")
Describes a data object for Partition::describe() method.
Definition: Partitions.h:784
void msg(const char *fmt,...)
Definition: message.cpp:107
std::string string
Definition: nybbler.cc:12
virtual std::string doDescribe(std::string indent, std::string firstIndent) const
Returns a description of the partition.
Definition: Partitions.h:260
virtual Data_t * data() const override
Returns the datum directly stored (nullptr if none).
Definition: Partitions.h:289

Member Data Documentation

template<typename Data >
Data_t* geo::part::PartitionWithData< Data >::myData
private

The contained datum.

Definition at line 296 of file Partitions.h.


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