Develop Biology
The language of life
bio::chemical::Bond Class Reference

#include <Bond.h>

Public Member Functions

 Bond ()
 
 Bond (AtomicNumber id, physical::Wave *bonded, BondType type=bond_type::Unknown())
 
 ~Bond ()
 
void Break ()
 
bool Form (AtomicNumber id, physical::Wave *bonded, BondType type=bond_type::Unknown())
 
physical::WaveGetBonded ()
 
const physical::WaveGetBonded () const
 
AtomicNumber GetId () const
 
BondType GetType () const
 
bool IsEmpty () const
 
bool operator== (const AtomicNumber id) const
 
bool operator== (const Bond &other) const
 

Detailed Description

Bonds are used by Atom to form relationships to Waves. These can be thought of as edges in a directed graph. See Atom.h for more info.

NOTE: Bonds may currently only be of a single BondType. This may change in a future release.

Definition at line 43 of file Bond.h.

Constructor & Destructor Documentation

◆ Bond() [1/2]

bio::chemical::Bond::Bond ( )

Definition at line 30 of file Bond.cpp.

31 :
32 m_id(PeriodicTable::InvalidId()),
33 m_bonded(NULL),
34 m_type(bond_type::Empty())
35{
36}
BondType Empty()

◆ Bond() [2/2]

bio::chemical::Bond::Bond ( AtomicNumber  id,
physical::Wave bonded,
BondType  type = bond_type::Unknown() 
)
Parameters
id
bonded
type

Definition at line 38 of file Bond.cpp.

43 :
44 m_id(id),
45 m_bonded(bonded),
46 m_type(type)
47{
48}

◆ ~Bond()

bio::chemical::Bond::~Bond ( )

Definition at line 50 of file Bond.cpp.

51{
52
53}

Member Function Documentation

◆ Break()

void bio::chemical::Bond::Break ( )

Empties the contents of *this.

Definition at line 94 of file Bond.cpp.

95{
96 //leave m_id intact.
97 m_bonded = NULL;
98 m_type = bond_type::Empty();
99}

References bio::bond_type::Empty().

Referenced by bio::molecular::Surface::~Surface(), bio::molecular::Surface::Release(), and bio::molecular::Surface::ReleaseAll().

◆ Form()

bool bio::chemical::Bond::Form ( AtomicNumber  id,
physical::Wave bonded,
BondType  type = bond_type::Unknown() 
)

Update the contents of *this. Only works if *this IsEmpty().

Parameters
id
bonded
type
Returns
true if *this was updated; false otherwise (e.g. if *this is already pointing to something)

Definition at line 55 of file Bond.cpp.

60{
61 BIO_SANITIZE(bonded, ,
62 return false);
63 m_id = id;
64 m_bonded = bonded;
65 m_type = type;
66 return true;
67}
#define BIO_SANITIZE(test, success, failure)

References BIO_SANITIZE.

Referenced by bio::chemical::Atom::FormBondImplementation().

◆ GetBonded() [1/2]

◆ GetBonded() [2/2]

const physical::Wave * bio::chemical::Bond::GetBonded ( ) const
Returns
the m_bonded of *this.

Definition at line 79 of file Bond.cpp.

80{
81 return m_bonded;
82}

◆ GetId()

AtomicNumber bio::chemical::Bond::GetId ( ) const
Returns
the m_id of *this.

Definition at line 69 of file Bond.cpp.

70{
71 return m_id;
72}

Referenced by bio::chemical::UnorderedStructureInterface::ImportAll(), and bio::chemical::LinearMotif< CONTENT_TYPE >::InsertImplementation().

◆ GetType()

BondType bio::chemical::Bond::GetType ( ) const
Returns
the m_type of *this.

Definition at line 84 of file Bond.cpp.

85{
86 return m_type;
87}

Referenced by bio::molecular::Surface::~Surface(), bio::molecular::Surface::Release(), and bio::molecular::Surface::ReleaseAll().

◆ IsEmpty()

bool bio::chemical::Bond::IsEmpty ( ) const

◆ operator==() [1/2]

bool bio::chemical::Bond::operator== ( const AtomicNumber  id) const
Parameters
id
Returns
whether or not the given id matches that of *this.

Definition at line 101 of file Bond.cpp.

102{
103 return m_id == id;
104}

◆ operator==() [2/2]

bool bio::chemical::Bond::operator== ( const Bond other) const
Parameters
other
Returns
whether or not id of other matches that of *this.

Definition at line 106 of file Bond.cpp.

107{
108 return m_id == other.m_id;
109}

The documentation for this class was generated from the following files: