| 1 |
/****************************************************************************** |
| 2 |
This source file is part of the Avogadro project. |
| 3 |
This source code is released under the 3-Clause BSD License, (see "LICENSE"). |
| 4 |
******************************************************************************/ |
| 5 |
|
| 6 |
#ifndef AVOGADRO_CORE_ANGLEITERATOR_H |
| 7 |
#define AVOGADRO_CORE_ANGLEITERATOR_H |
| 8 |
|
| 9 |
#include "avogadrocoreexport.h" |
| 10 |
|
| 11 |
#include "avogadrocore.h" |
| 12 |
|
| 13 |
#include <tuple> |
| 14 |
|
| 15 |
namespace Avogadro::Core { |
| 16 |
|
| 17 |
class Molecule; |
| 18 |
|
| 19 |
using Angle = std::tuple<Index, Index, Index>; |
| 20 |
|
| 21 |
class AVOGADROCORE_EXPORT AngleIterator |
| 22 |
{ |
| 23 |
public: |
| 24 |
/** |
| 25 |
* Constructor. |
| 26 |
*/ |
| 27 |
AngleIterator(const Molecule* mol); |
| 28 |
|
| 29 |
~AngleIterator() {} |
| 30 |
|
| 31 |
Angle* operator*() { return &m_current; } |
| 32 |
|
| 33 |
Angle begin(); |
| 34 |
|
| 35 |
Angle end() const |
| 36 |
{ |
| 37 |
return std::make_tuple(Avogadro::MaxIndex, Avogadro::MaxIndex, |
| 38 |
Avogadro::MaxIndex); |
| 39 |
} |
| 40 |
|
| 41 |
Angle operator++(); |
| 42 |
|
| 43 |
bool operator!=(const AngleIterator& other) |
| 44 |
{ |
| 45 |
return (m_a != other.m_a || m_b != other.m_b || m_c != other.m_c); |
| 46 |
} |
| 47 |
|
| 48 |
private: |
| 49 |
// m_b is the current vertex |
| 50 |
// m_a and m_c are instead index into the neighbors of m_b |
| 51 |
Index m_a, m_b, m_c; |
| 52 |
Angle m_current; |
| 53 |
const Molecule* m_mol; |
| 54 |
}; |
| 55 |
|
| 56 |
} // namespace Avogadro::Core |
| 57 |
|
| 58 |
#endif // AVOGADRO_CORE_ANGLEITERATOR_H |