11 #ifndef LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_OPDETVISIBILITYDATA_H 12 #define LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_OPDETVISIBILITYDATA_H 19 #include <type_traits> 58 template <
typename Cont,
typename Enable =
void>
71 template <
typename Cont>
116 template <
typename Cont,
typename Mapping>
224 template <
typename Cont>
228 return size(std::forward<Cont>(cont));
237 template <
typename Cont,
typename =
void>
240 template <
typename Cont>
243 std::enable_if_t<util::always_true_v<decltype(generic_size(std::declval<Cont>()))>>> {
248 template <
typename Cont,
typename =
void>
252 template <
typename Cont>
255 std::enable_if_t<util::always_true_v<decltype(std::declval<Cont const>().empty())>>> {
256 static bool isValid(Cont
const& cont) {
return !cont.empty(); }
260 template <
typename Cont,
typename =
void>
264 template <
typename Cont>
267 std::enable_if_t<util::always_true_v<decltype(std::declval<Cont const>().is_valid())>>> {
268 static bool isValid(Cont
const& cont) {
return cont.is_valid(); }
272 template <
typename Cont,
typename =
void>
276 template <
typename Cont>
279 std::enable_if_t<util::always_true_v<decltype(std::declval<Cont const>().isValid())>>> {
280 static bool isValid(Cont
const& cont) {
return cont.isValid(); }
284 template <
typename Cont,
typename =
void>
288 template <
typename Cont>
291 std::enable_if_t<util::is_unique_ptr_v<Cont>>> {
292 static bool isValid(Cont
const& cont) {
return bool(cont); }
296 template <
typename T>
300 template <
typename T>
302 static bool isValid(T* ptr) {
return bool(ptr); }
306 template <
typename T>
311 template <
typename T, std::
size_t N>
313 static bool isValid(T (&)[N]) {
return N > 0U; }
317 template <
typename Cont,
typename =
void>
321 template <
typename Cont>
324 std::enable_if_t<std::is_pointer_v<std::decay_t<Cont>>>>
328 template <
typename Cont>
338 template <
typename Cont,
typename >
343 template <
typename Cont>
350 template <
typename Cont,
typename Mapping>
357 template <
typename Cont,
typename Mapping>
368 #endif // LARSIM_PHOTONPROPAGATION_LIBRARYMAPPINGTOOLS_OPDETVISIBILITYDATA_H
Provides MappedContainer class.
static bool isValid(Cont const &cont)
auto generic_size(Cont &&cont)
A meta-container providing transparent mapping on top of another.
Mapping Mapping_t
Type of the mapping object.
OpDetVisibilityData(DataContainer_t const &cont, Mapping_t const &mapping, size_type size)
Constructor: acquires data and mapping.
size_type minimal_size() const
Returns the minimum size to include all mapped values.
static bool isValid(T *ptr)
OpDetVisibilityData(DataContainer_t const &cont, Mapping_t const &mapping)
Constructor: acquires data and mapping.
size_type size() const
Returns the nominal size of the container (after mapping).
OpDetVisibilityData(DataContainer_t const &cont, Mapping_t const &mapping, size_type size, value_type defValue)
Constructor: acquires data, mapping and a default value.
static bool isValid(T(&)[N])
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
static bool isValid(Cont const &cont)
static bool isValid(Cont const &cont)
static size_type effectiveSize(DataContainer_t const &cont, size_type allegedSize)
Determines whether the current content should be considered valid.
bool operator!() const
Returns whether the container has no valid data.
Cont DataContainer_t
Type of the original container.
static bool isValid(Cont const &cont)
bool isValidLibraryData(Cont &&cont)
Returns the validity of content of library data in the container.
General LArSoft Utilities.
A container for photon visibility mapping data.
static bool isValid(Cont const &cont)
bool isValid() const
Returns whether the contained data is valid or not.
bool empty() const
Returns whether the container has no elements.
OpDetVisibilityData()=default
Constructor: acquires data, mapping and a default value.
Trait for determining the validity of library data in a container.