11 #ifndef LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H 12 #define LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H 27 #include <type_traits> 68 typename Main,
typename Aux,
typename Metadata ,
103 bool has(std::size_t i)
const 116 "Inconsistent data types." 164 template <
typename Tag,
typename Assns>
167 template <
typename Assns>
169 {
return makeOneTo01data<typename Assns::right_t>(assns, minSize); }
191 template <
typename Tag,
typename MainColl,
typename Assns>
193 {
return makeOneTo01data<Tag>(assns, mainColl.size()); }
195 template <
typename MainColl,
typename Assns>
197 {
return makeOneTo01data<typename Assns::right_t>(mainColl, assns); }
213 template <
typename T>
216 typename std::vector<T>::size_type index,
217 typename std::vector<T>::value_type
const&
value 219 if (index >= v.size()) {
220 v.reserve(index + 1);
224 else v[index] =
value;
229 template <
typename T>
232 typename std::vector<T>::size_type index,
233 typename std::vector<T>::value_type&&
value 235 if (index >= v.size()) {
236 v.reserve(index + 1);
238 v.push_back(std::move(
value));
240 else v[index] = std::move(
value);
245 template <std::
size_t Key, std::
size_t Data,
typename Iter>
253 using value_type =
typename Iter::value_type;
254 using data_t = std::tuple_element_t<Data, value_type>;
255 std::vector<data_t> data(n);
256 for (
auto it = begin; it !=
end; ++it) {
257 auto const& keyPtr = std::get<Key>(*it);
269 template <
typename Tag,
typename Assns>
272 using Main_t =
typename Assns::left_t;
273 using Aux_t =
typename Assns::right_t;
275 using AssociatedData_t
280 return AssociatedData_t(
281 details::associationOneToOneFullSequence<0U, 1U>
282 (cbegin(assns), cend(assns), minSize)
291 #endif // LARDATA_RECOBASEPROXY_PROXYBASE_ONETO01DATA_H
auto makeOneTo01data(Assns const &assns, std::size_t minSize=0)
Processes and returns an one-to-(zero/one) associated data object.
art::Ptr< aux_t > aux_ptr_t
Type of art pointer to associated datum.
bool has(std::size_t i) const
Returns whether the element i is associated with auxiliary datum.
OneTo01Data(aux_coll_t &&data)
Main main_t
Type of main datum.
auto operator[](std::size_t index) const -> decltype(auto)
Returns the range with the specified index (no check performed).
Object for one-to-zero/or/one associated data interface.
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
Encloses LArSoft data product proxy objects and utilities.See this doxygen module for an introduction...
Aux aux_t
Type of associated datum.
std::string value(boost::any const &)
Utilities to address elements of a tuple-like class by tag.
Traits for art associations.
Metadata metadata_t
Type of associated metadata.
void extendAndAssign(std::vector< T > &v, typename std::vector< T >::size_type index, typename std::vector< T >::value_type const &value)
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
std::vector< aux_ptr_t > aux_coll_t
Type of collection of auxiliary data for all main elements.
aux_coll_t auxData
Data associated to the main collection.
util::add_tag_t< aux_ptr_t, tag > auxiliary_data_t
Type of auxiliary data associated with a main item.
auto associationOneToOneFullSequence(Iter begin, Iter end, std::size_t n)