[8387e0] | 1 | /*
|
---|
| 2 | * FragmentNode.hpp
|
---|
| 3 | *
|
---|
| 4 | * Created on: Sep 24, 2012
|
---|
| 5 | * Author: heber
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #ifndef FRAGMENTNODE_HPP_
|
---|
| 9 | #define FRAGMENTNODE_HPP_
|
---|
| 10 |
|
---|
| 11 | // include config.h
|
---|
| 12 | #ifdef HAVE_CONFIG_H
|
---|
| 13 | #include <config.h>
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | #include <iosfwd>
|
---|
| 17 |
|
---|
| 18 | /** FragmentNode contains all information important to homology considerations
|
---|
| 19 | * between fragments.
|
---|
| 20 | *
|
---|
| 21 | * This is important to answer whether to fragments have the same structure or
|
---|
| 22 | * not. Basically, the node simply represents an atom but without any index to
|
---|
| 23 | * make it indistinguishable from another atom having same number of bonds and
|
---|
| 24 | * same atomic number.
|
---|
| 25 | *
|
---|
| 26 | * Namely, we need:
|
---|
| 27 | * -# charge/atomic number of the node
|
---|
| 28 | * -# number of edges connected to this node
|
---|
| 29 | *
|
---|
| 30 | * Central is have this class be sortable by having comparison operators defined.
|
---|
| 31 | */
|
---|
| 32 | class FragmentNode
|
---|
| 33 | {
|
---|
| 34 | //!> grant output operator access to internals
|
---|
| 35 | friend std::ostream& operator<<(std::ostream &out, const FragmentNode &node);
|
---|
| 36 | public:
|
---|
| 37 | /** Default constructor for class FragmentNode.
|
---|
| 38 | *
|
---|
| 39 | * Is required to allow placement in STL containers.
|
---|
| 40 | */
|
---|
| 41 | FragmentNode() :
|
---|
| 42 | AtomicNumber(0),
|
---|
| 43 | ConnectedEdges(0)
|
---|
| 44 | {}
|
---|
| 45 |
|
---|
| 46 | /** Constructor for class FragmentNode.
|
---|
| 47 | *
|
---|
| 48 | * @param _AtomicNumber atomic number of represented atom
|
---|
| 49 | * @param _ConnectedEdges number of "bonds" of represented atom
|
---|
| 50 | */
|
---|
| 51 | FragmentNode(const size_t _AtomicNumber, const size_t _ConnectedEdges) :
|
---|
| 52 | AtomicNumber(_AtomicNumber),
|
---|
| 53 | ConnectedEdges(_ConnectedEdges)
|
---|
| 54 | {}
|
---|
| 55 | ~FragmentNode()
|
---|
| 56 | {}
|
---|
| 57 |
|
---|
| 58 | FragmentNode& operator=(const FragmentNode &node);
|
---|
| 59 |
|
---|
| 60 | // comparison operators to allow for sorting
|
---|
| 61 | bool operator<(const FragmentNode &node) const;
|
---|
| 62 | bool operator>(const FragmentNode &node) const;
|
---|
| 63 | bool operator==(const FragmentNode &node) const;
|
---|
| 64 | bool operator!=(const FragmentNode &node) const {
|
---|
| 65 | return (!(*this == node));
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | private:
|
---|
| 69 | //!> the atomic number
|
---|
| 70 | const size_t AtomicNumber;
|
---|
| 71 | //!> number of connecting edges
|
---|
| 72 | const size_t ConnectedEdges;
|
---|
| 73 | };
|
---|
| 74 |
|
---|
| 75 | std::ostream& operator<<(std::ostream &out, const FragmentNode &node);
|
---|
| 76 |
|
---|
| 77 | #endif /* FRAGMENTNODE_HPP_ */
|
---|