Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ISingleContainer.hh
Go to the documentation of this file.
1 ///
2 /// @file ISingleContainer.hh
3 /// @brief Interface class for single container data structure
4 ///
5 
6 //**** This file is a part of the HAMMER library
7 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
8 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
9 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
10 
11 // -*- C++ -*-
12 #ifndef HAMMER_MATH_ISINGLECONTAINER
13 #define HAMMER_MATH_ISINGLECONTAINER
14 
15 
17 
18 namespace Hammer {
19 
20  namespace MultiDimensional {
21 
22  class ISingleContainer : public IContainer {
23 
24  public:
25  virtual ~ISingleContainer() {}
27  ISingleContainer(const ISingleContainer&) = default;
29  ISingleContainer& operator=(const ISingleContainer&) = default;
31 
32  class ItBase {
33  public:
34  virtual ~ItBase() {}
35  virtual IContainer::ElementType value() const = 0;
36  virtual PositionType position() const = 0;
37  virtual void next(int n = 1) = 0;
38  virtual bool isSame(const ItBase& other) const = 0;
39  virtual bool isAligned() const = 0;
40  virtual ptrdiff_t distanceFrom(const ItBase& other) const = 0;
41  };
42 
43  using NonZeroIt = std::unique_ptr<ItBase>;
44 
45  virtual NonZeroIt firstNonZero() const = 0;
46  virtual NonZeroIt endNonZero() const = 0;
47 
48  };
49 
50  inline void next(ISingleContainer::NonZeroIt it) { it->next(); }
51 
52  inline bool operator==(const ISingleContainer::ItBase& lhs,
53  const ISingleContainer::ItBase& rhs) {
54  return lhs.isSame(rhs);
55  }
56 
57  inline bool operator!=(const ISingleContainer::ItBase& lhs, const ISingleContainer::ItBase& rhs) {
58  return !(lhs == rhs);
59  }
60 
61  }
62 
63 }
64 
65 #endif
virtual bool isSame(const ItBase &other) const =0
bool operator!=(const OuterElemIterator &lhs, const OuterElemIterator &rhs)
ISingleContainer & operator=(const ISingleContainer &)=default
size_t PositionType
virtual ptrdiff_t distanceFrom(const ItBase &other) const =0
virtual NonZeroIt firstNonZero() const =0
std::complex< double > ElementType
Definition: IContainer.hh:34
bool operator==(const OuterElemIterator &lhs, const OuterElemIterator &rhs)
Interface class for tensor container data structure.
virtual IContainer::ElementType value() const =0
void next(ISingleContainer::NonZeroIt it)
virtual NonZeroIt endNonZero() const =0
virtual PositionType position() const =0