| 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_DIHEDRALITERATOR_H |
| 7 |
#define AVOGADRO_CORE_DIHEDRALITERATOR_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 Dihedral = std::tuple<Index, Index, Index, Index>; |
| 20 |
|
| 21 |
class AVOGADROCORE_EXPORT DihedralIterator |
| 22 |
{ |
| 23 |
public: |
| 24 |
/** |
| 25 |
* Constructor. |
| 26 |
*/ |
| 27 |
DihedralIterator(const Molecule* mol); |
| 28 |
|
| 29 |
~DihedralIterator() = default; |
| 30 |
|
| 31 |
Dihedral* operator*() { return &m_current; } |
| 32 |
|
| 33 |
Dihedral begin(); |
| 34 |
|
| 35 |
Dihedral end() const |
| 36 |
{ |
| 37 |
return std::make_tuple(MaxIndex, MaxIndex, MaxIndex, MaxIndex); |
| 38 |
} |
| 39 |
|
| 40 |
Dihedral operator++(); |
| 41 |
|
| 42 |
bool operator!=(const DihedralIterator& other) |
| 43 |
{ |
| 44 |
return m_current != other.m_current; |
| 45 |
} |
| 46 |
|
| 47 |
private: |
| 48 |
Dihedral m_current; |
| 49 |
Index m_i, m_jk, m_l; |
| 50 |
const Molecule* m_mol; |
| 51 |
}; |
| 52 |
|
| 53 |
} // namespace Avogadro::Core |
| 54 |
|
| 55 |
#endif // AVOGADRO_CORE_DIHEDRALITERATOR_H |