Class to store a single element of a relation.  
 More...
#include <RelationElement.h>
|  | 
|  | RelationElement () | 
|  | Empty constructor for ROOT. 
 | 
|  | 
|  | RelationElement (index_type from, index_type to, weight_type weight=1.0) | 
|  | Constructor for a 1:1 relation. 
 | 
|  | 
|  | RelationElement (index_type from, const std::vector< index_type > &to, const std::vector< weight_type > &weights) | 
|  | Constructor for a 1:n relation. 
 | 
|  | 
| template<class InputIterator> | 
|  | RelationElement (index_type from, const InputIterator &begin, const InputIterator &end) | 
|  | Constructor for a 1:n relation. 
 | 
|  | 
| index_type | getFromIndex () const | 
|  | Get index we point from. 
 | 
|  | 
| size_t | getSize () const | 
|  | Get number of indices we points to. 
 | 
|  | 
| std::pair< index_type, weight_type > | getTo (size_t n=0) const | 
|  | Get nth pair of index,weight we point to. 
 | 
|  | 
| index_type | getToIndex (size_t n=0) const | 
|  | Get nth index we point to. 
 | 
|  | 
| weight_type | getWeight (size_t n=0) const | 
|  | Get nth weight we point to. 
 | 
|  | 
| const std::vector< index_type > & | getToIndices () const | 
|  | Get vector of indices we point to. 
 | 
|  | 
| const std::vector< weight_type > & | getWeights () const | 
|  | Get vector of weights we point to. 
 | 
|  | 
| void | setFromIndex (index_type from) | 
|  | Set index we point from. 
 | 
|  | 
| void | setToIndex (index_type to, weight_type weight=1.0) | 
|  | Set index we point to, converts relation to 1:1 and discards all existing to-indices. 
 | 
|  | 
| template<class InputIterator> | 
| void | setToIndices (InputIterator begin, const InputIterator &end) | 
|  | Set new indices and weights we point to. 
 | 
|  | 
|  | 
|  | ClassDef (RelationElement, 1) | 
|  | Class to store a single element of a relation. 
 | 
|  | 
Class to store a single element of a relation. 
Supports 1:n relations with individual weights. 
Definition at line 25 of file RelationElement.h.
◆ index_type
◆ weight_type
◆ RelationElement() [1/4]
Empty constructor for ROOT. 
Definition at line 28 of file RelationElement.cc.
   28                                :
   30{
   31 
   32}
index_type m_from
index we point from.
std::vector< weight_type > m_weights
weights for to-indices.
std::vector< index_type > m_to
indices we point to.
 
 
◆ RelationElement() [2/4]
Constructor for a 1:1 relation. 
- Parameters
- 
  
    | from | index to point from |  | to | index to point to |  | weight | weight of the relation |  
 
Definition at line 44 of file RelationElement.h.
   44                                                                             :
   45      TObject(), m_from(from), m_to(1, to), m_weights(1, weight) {}
 
 
◆ RelationElement() [3/4]
Constructor for a 1:n relation. 
- Parameters
- 
  
    | from | index to point from |  | to | indices to point to |  | weights | weights of the relation |  
 
Definition at line 18 of file RelationElement.cc.
   18                                                                                                                       :
   19  TObject(),
   21  m_to(to.begin(), to.end()),
 
   23{
   24  if (to.size() != weights.size()) {
   25    B2FATAL("Index and weight vector sizes differ!");
   26  }
   27}
 
 
◆ RelationElement() [4/4]
template<class InputIterator> 
 
Constructor for a 1:n relation. 
- Parameters
- 
  
    | from | index to point from |  | begin | iterator pointing to the begin of a sequence of std::pair<index_type,weight_type> or compatible |  | end | iterator pointing to the end of a sequence of std::pair<index_type,weight_type> or compatible |  
 
Definition at line 63 of file RelationElement.h.
   63                                                                                                                         :
   64      TObject(), m_from(from)
   65    {
   66      setToIndices(begin, end);
   67    }
 
 
◆ getFromIndex()
◆ getSize()
Get number of indices we points to. 
Definition at line 73 of file RelationElement.h.
   73{ return m_to.size(); }
 
 
◆ getTo()
Get nth pair of index,weight we point to. 
Definition at line 76 of file RelationElement.h.
   76{ return std::make_pair(m_to[n], m_weights[n]); }
 
 
◆ getToIndex()
◆ getToIndices()
  
  | 
        
          | const std::vector< index_type > & getToIndices | ( |  | ) | const |  | inline | 
 
 
◆ getWeight()
Get nth weight we point to. 
Definition at line 82 of file RelationElement.h.
   82{ return m_weights[n]; }
 
 
◆ getWeights()
  
  | 
        
          | const std::vector< weight_type > & getWeights | ( |  | ) | const |  | inline | 
 
 
◆ setFromIndex()
◆ setToIndex()
Set index we point to, converts relation to 1:1 and discards all existing to-indices. 
Definition at line 94 of file RelationElement.h.
   95    {
   96      m_to = std::vector<index_type>(1, to);
   97      m_weights = std::vector<weight_type>(1, weight);
   98    }
 
 
◆ setToIndices()
template<class InputIterator> 
  
  | 
        
          | void setToIndices | ( | InputIterator | begin, |  
          |  |  | const InputIterator & | end ) |  | inline | 
 
Set new indices and weights we point to. 
- Parameters
- 
  
    | begin | iterator pointing to the begin of a sequence of std::pair<index_type,weight_type> or compatible |  | end | iterator pointing to the end of a sequence of std::pair<index_type,weight_type> or compatible |  
 
Definition at line 107 of file RelationElement.h.
  108    {
  109      for (; begin != end; ++begin) {
  110        m_to.push_back(begin->first);
  111        m_weights.push_back(begin->second);
  112      }
  113    }
 
 
◆ m_from
◆ m_to
◆ m_weights
The documentation for this class was generated from the following files: