LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
proxy::details::OneTo01Data< Main, Aux, Metadata, Tag > Class Template Reference

Object for one-to-zero/or/one associated data interface. More...

#include "OneTo01Data.h"

Public Types

using aux_t = Aux
 Type of associated datum. More...
 
using metadata_t = Metadata
 Type of associated metadata. More...
 
using tag = Tag
 Type of tag. More...
 
using main_t = Main
 Type of main datum. More...
 
using aux_ptr_t = art::Ptr< aux_t >
 Type of art pointer to associated datum. More...
 
using auxiliary_data_t = util::add_tag_t< aux_ptr_t, tag >
 Type of auxiliary data associated with a main item. More...
 
using aux_coll_t = std::vector< aux_ptr_t >
 Type of collection of auxiliary data for all main elements. More...
 
using assns_t = art::Assns< main_t, aux_t >
 Type of the source association. More...
 

Public Member Functions

 OneTo01Data (aux_coll_t &&data)
 
bool has (std::size_t i) const
 Returns whether the element i is associated with auxiliary datum. More...
 
auxiliary_data_t get (std::size_t i) const
 Returns a copy of the pointer to data associated with element i. More...
 
auto operator[] (std::size_t index) const -> decltype(auto)
 Returns the range with the specified index (no check performed). More...
 

Private Types

using This_t = OneTo01Data< Main, Aux, Metadata, Tag >
 This type. More...
 

Private Attributes

aux_coll_t auxData
 Data associated to the main collection. More...
 

Detailed Description

template<typename Main, typename Aux, typename Metadata, typename Tag>
class proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >

Object for one-to-zero/or/one associated data interface.

Template Parameters
Maintype of the main associated object (one)
Auxtype of the additional associated objects (zero or one)
Metadatatype of associated metadata
Tagtag this data is labeled with

Allows:

  • random access (no index check guarantee)
  • forward iteration

Construction is not part of the interface.

The OneTo01Data object acquires a vector of art pointers, one for each element in the main collection. It is an implementation detail for associations fulfilling the one-to-(zero-or-one) sequential association requirement.

Note
This data structure marks the main elements which have no associated data with an invalid art pointer (default-constructed) and it does not distinguish that from the element being actually associated to a default-constructed art pointer.

The OneTo01Data object also provides a container-like view of this information, where each element in the container is associated to a single Main and it is an art pointer to the Right element.

Association metadata is not accessible from this object.

Todo:
Metadata for proxy::details::OneTo01Data is not supported yet.

Definition at line 68 of file OneTo01Data.h.

Member Typedef Documentation

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::assns_t = art::Assns<main_t, aux_t>

Type of the source association.

Definition at line 94 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::aux_coll_t = std::vector<aux_ptr_t>

Type of collection of auxiliary data for all main elements.

Definition at line 91 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::aux_ptr_t = art::Ptr<aux_t>

Type of art pointer to associated datum.

Definition at line 85 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::aux_t = Aux

Type of associated datum.

Definition at line 73 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::auxiliary_data_t = util::add_tag_t<aux_ptr_t, tag>

Type of auxiliary data associated with a main item.

Definition at line 88 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::main_t = Main

Type of main datum.

Definition at line 82 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::metadata_t = Metadata

Type of associated metadata.

Definition at line 76 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::tag = Tag

Type of tag.

Definition at line 79 of file OneTo01Data.h.

template<typename Main , typename Aux , typename Metadata , typename Tag >
using proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::This_t = OneTo01Data<Main, Aux, Metadata, Tag>
private

This type.

Definition at line 69 of file OneTo01Data.h.

Constructor & Destructor Documentation

template<typename Main , typename Aux , typename Metadata , typename Tag >
proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::OneTo01Data ( aux_coll_t &&  data)
inline

Definition at line 96 of file OneTo01Data.h.

96 : auxData(std::move(data)) {}
aux_coll_t auxData
Data associated to the main collection.
Definition: OneTo01Data.h:113

Member Function Documentation

template<typename Main , typename Aux , typename Metadata , typename Tag >
auxiliary_data_t proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::get ( std::size_t  i) const
inline

Returns a copy of the pointer to data associated with element i.

Definition at line 102 of file OneTo01Data.h.

References proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::auxData.

102 { return auxiliary_data_t(auxData[i]); }
aux_coll_t auxData
Data associated to the main collection.
Definition: OneTo01Data.h:113
util::add_tag_t< aux_ptr_t, tag > auxiliary_data_t
Type of auxiliary data associated with a main item.
Definition: OneTo01Data.h:88
template<typename Main , typename Aux , typename Metadata , typename Tag >
bool proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::has ( std::size_t  i) const
inline

Returns whether the element i is associated with auxiliary datum.

Definition at line 99 of file OneTo01Data.h.

99 { return get(i) == aux_ptr_t(); }
art::Ptr< aux_t > aux_ptr_t
Type of art pointer to associated datum.
Definition: OneTo01Data.h:85
template<typename Main , typename Aux , typename Metadata , typename Tag >
auto proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::operator[] ( std::size_t  index) const -> decltype(auto)
inline

Returns the range with the specified index (no check performed).

Definition at line 105 of file OneTo01Data.h.

106  {
107  static_assert(std::is_convertible<decltype(get(index)), auxiliary_data_t>(),
108  "Inconsistent data types.");
109  return get(index);
110  }
util::add_tag_t< aux_ptr_t, tag > auxiliary_data_t
Type of auxiliary data associated with a main item.
Definition: OneTo01Data.h:88

Member Data Documentation

template<typename Main , typename Aux , typename Metadata , typename Tag >
aux_coll_t proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::auxData
private

Data associated to the main collection.

Definition at line 113 of file OneTo01Data.h.

Referenced by proxy::details::OneTo01Data< Main, Aux, Metadata, Tag >::get().


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