BALL::Bond Class Reference
[Miscellaneous]

Bond class. More...

#include <bond.h>

Inheritance diagram for BALL::Bond:
Inheritance graph
[legend]

List of all members.


Classes

class NotBound
Not bound to two atoms. More...

Public Types

Enumerations
enum BondOrder {
ORDER__UNKNOWN = 0, ORDER__SINGLE = 1, ORDER__DOUBLE = 2, ORDER__TRIPLE = 3,
ORDER__QUADRUPLE = 4, ORDER__AROMATIC = 5, ORDER__ANY = 6, NUMBER_OF_BOND_ORDERS
}
Predefined constants for the bond order. More...
enum BondType {
TYPE__UNKNOWN = 0, TYPE__COVALENT = 1, TYPE__HYDROGEN = 2, TYPE__DISULPHIDE_BRIDGE = 3,
TYPE__SALT_BRIDGE = 4, TYPE__PEPTIDE = 5, NUMBER_OF_BOND_TYPES
}
Predefined constants for the bond type. More...
enum Property { IS_AROMATIC = 0, NUMBER_OF_PROPERTIES }
Predefined properties. More...
Type definitions
typedef short Order
Bond type.
typedef short Type

Public Member Functions

Persistence
void persistentWrite (PersistenceManager &pm, const char *name=0) const throw (Exception::GeneralException)
Write a bond to a persistent stream.
void persistentRead (PersistenceManager &pm) throw (Exception::GeneralException)
Read a bond from a persistent stream.
void finalize () throw (Exception::GeneralException)
Finalize the deserialization.
Predicates
bool operator== (const Bond &bond) const
Equality operator. Two bonds are equal, if they are identical instances.
bool operator!= (const Bond &bond) const
Inequality operator. Two bonds are not equal, if they are different instances.
Assignment methods
Bond & operator= (const Bond &bond)
Assignment operator.
void swap (Bond &bond)
Swap the contents of two bonds.
Accessors
void setFirstAtom (Atom *atom)
Set the first atom.
void setSecondAtom (Atom *atom)
Set the second atom.
const Atom * getFirstAtom () const
Return a pointer to the first atom.
const Atom * getSecondAtom () const
Return a pointer to the second atom.
Atom * getPartner (const Atom &atom) const
Return the partner atom of an atom.
void setName (const String &name)
Assign the atom name.
const String & getName () const
Return the atom name.
void setOrder (Order bond_order)
Assign the bond order.
Order getOrder () const
Return the bond order.
bool isAromatic () const
Returns true if this bond is aromatic.
void setType (Type bond_type)
Set the bond type.
Type getType () const
Return the bond type.
float getLength () const throw (NotBound)
Return the bond length
Exceptions:
NotBound if the bond has not two atoms.

const Atom * getBoundAtom (const Atom &atom) const
Return the partner of the atom in this bond.
Atom * getBoundAtom (const Atom &atom)
Return the partner of the atom in this bond.
Predicates
bool isBondOf (const Atom &atom) const
Determine whether the bond belongs to an atom.
bool isBound () const
Determine whether this bond contains any atom.
bool isInterBond () const
Determine whether the bond connects two fragments.
bool isInterBondOf (const AtomContainer &atom_container) const
Request for the intermolecular bonding of this bond within {atom_container}.
bool isIntraBond () const
Request for the intramolecular bonding of this bond.
bool isIntraBondOf (const AtomContainer &atom_container) const
Request for the intramolecular bonding of this bond within {atom_container}.
Debugging and diagnostics
virtual bool isValid () const
Internal state and consistency self-validation.
virtual void dump (std::ostream &s=std::cout, Size depth=0) const
Internal state dump.

Protected Attributes

Atributes
Atom * first_
Atom * second_
String name_
Order bond_order_
Type bond_type_

Friends

class Atom

Constructors and Destructors

Bond ()
Default constructor.
Bond (const Bond &bond, bool deep=true)
Copy constructor.
Bond (const String &name, Atom &first, Atom &second, Order order=BALL_BOND_DEFAULT_ORDER, Type type=BALL_BOND_DEFAULT_TYPE) throw (Exception::TooManyBonds)
Detailed constructor.
virtual ~Bond ()
Destructor.
virtual void clear ()
Disconnect and reset to default state.
virtual void destroy ()
Explicit destructor.
static Bond * createBond (Bond &bond, Atom &first, Atom &second) throw (Exception::TooManyBonds)
Create a bond.

Detailed Description

Bond class.

An instance of Bond represents a bond between two atoms. There can be only one bond between two atoms (double, triple, etc. bonds are represented using just one bond and an appropriate value for the bond order attribute, see setBondOrder ).

The "first" and "second" atom are assigned in a unique way: the first atom is always the atom with the lower Handle than the second atom.
The "state" of a bond is defined by its attributes:

Bond equality is defined as bond identity. A linear ordering of bonds is defined as the linear order of the Object::Handle s.


Member Enumeration Documentation

Predefined constants for the bond order.

Enumerator:
ORDER__UNKNOWN Default value.
ORDER__SINGLE Single bond.
ORDER__DOUBLE Double bond.
ORDER__TRIPLE Triple Bond.
ORDER__QUADRUPLE Quadruple bond.
ORDER__AROMATIC Aromatic bonds.
ORDER__ANY Any bond orders (useful for predicates).
NUMBER_OF_BOND_ORDERS The number of bond orders.

Predefined constants for the bond type.

Those are just defined for convenience but they are not used right now.

Predefined properties.

Enumeration of all properties that are used by Bond.

Enumerator:
IS_AROMATIC This property can be used to store aromaticity information without overwriting bond orders.

Constructor & Destructor Documentation

BALL::Bond::Bond ( )

Default constructor.

The state of this bond is:

BALL::Bond::Bond ( const Bond & bond,
bool deep = true
)

Copy constructor.

Calls Bond::createBond . The state of this bond is initialized to the state of bond.

Note: Deep copying of bonds makes no sense, the parameter deep is therefore ignored. The use of this method is not recommended because it may result in inconcistencies of the whole the kernel data structure. This if for internal use only!
Parameters:
bond the bond to be copied
deep ignored
See also:
createBond

BALL::Bond::Bond ( const String & name,
Atom & first,
Atom & second,
Order order = BALL_BOND_DEFAULT_ORDER,
Type type = BALL_BOND_DEFAULT_TYPE
) throw (Exception::TooManyBonds)

Detailed constructor.

Calls createBond to create a new bond between the two atoms

Parameters:
name name of the constructed bond
first first atom of the constructed bond
second second atom of the constructed bond
order order of the constructed bond
type type of the constructed bond
Exceptions:
TooManyBonds if one of the atom already possesses Atom::MAX_NUMBER_OF_BONDS bonds.

virtual BALL::Bond::~Bond ( ) [virtual]

Destructor.

If the bond is connecting two atoms, they are disconnected.


Member Function Documentation

virtual void BALL::Bond::clear ( ) [virtual]

Disconnect and reset to default state.

Reset the bond attributes to their default values. The state of this bond is:

  • bond has no connectivity with first atom (=0)
  • bond has no connectivity with second atom (=0)
  • bond name is the empty string (="")
  • bond order is unknown (= Bond::ORDER__UNKNOWN )
  • bond type is unknown (= Bond::TYPE__UNKNOWN )

Reimplemented from BALL::Composite.

static Bond* BALL::Bond::createBond ( Bond & bond,
Atom & first,
Atom & second
) throw (Exception::TooManyBonds) [static]

Create a bond.

Connect the two atoms first and second via a bond.

Parameters:
bond the instantiated bond that connects the first atom first to the second atom second
first the first atom of the bond
second the second atom of the bond
Returns:
Bond* this
Exceptions:
TooManyBonds if one of the atom already possesses Atom::MAX_NUMBER_OF_BONDS bonds.

Referenced by BALL::cloneBonds().

virtual void BALL::Bond::destroy ( ) [virtual]

Explicit destructor.

Destroy this bond explicitly without releasing its heap memory thus this bond may exist further. Calls Bond::clear . Set the state of this bond to the default values. Note: Destroy is equivalent to Bond::clear .

See also:
Bond::clear

Reimplemented from BALL::Composite.

virtual void BALL::Bond::dump ( std::ostream & s = std::cout,
Size depth = 0
) const [virtual]

Internal state dump.

Dump the current internal state of this bond to the output ostream s with dumping depth depth .

Parameters:
s output stream where to output the internal state of this bond
depth the dumping depth

Reimplemented from BALL::Composite.

void BALL::Bond::finalize ( ) throw (Exception::GeneralException) [virtual]

Finalize the deserialization.

Bond might have to swap first_ and second_ to ensure the correct order (see Bond ).

Reimplemented from BALL::PersistentObject.

Referenced by BALL::cloneBonds().

Atom* BALL::Bond::getBoundAtom ( const Atom & atom )

Return the partner of the atom in this bond.

Parameters:
atom an atom
Returns:
Atom a pointer to the atom, 0 if the atom is not part of the bond

const Atom* BALL::Bond::getBoundAtom ( const Atom & atom ) const

Return the partner of the atom in this bond.

Parameters:
atom an atom
Returns:
Atom a constant pointer to the atom, 0 if the atom is not part of the bond

float BALL::Bond::getLength ( ) const throw (NotBound)

Return the bond length

Exceptions:
NotBound if the bond has not two atoms.
Returns:
float - the distance between the two atoms

Atom* BALL::Bond::getPartner ( const Atom & atom ) const

Return the partner atom of an atom.

If the given atom is part of this bond, the other atom of the bond is returned. 0 is returned if atom is not one of the bond's atoms.

Parameters:
atom one of the bond's atoms
Returns:
the atom's bond partner

bool BALL::Bond::isAromatic ( ) const

Returns true if this bond is aromatic.

A bond is defined as aromatic, if it has the property Bond::IS_AROMATIC or if it has the order Bond::ORDER__AROMATIC

bool BALL::Bond::isBondOf ( const Atom & atom ) const

Determine whether the bond belongs to an atom.

Calls Atom::hasBond .

Parameters:
atom the atom that is queried to connect this bond to another atom
Returns:
bool - true if bond connects the atom atom with another atom, false otherwise
See also:
Atom::hasBond

bool BALL::Bond::isBound ( ) const

Determine whether this bond contains any atom.

Returns:
bool - true if bond connects the atom atom with another atom, false otherwise
See also:
Atom::hasBond

bool BALL::Bond::isInterBond ( ) const

Determine whether the bond connects two fragments.

If both atoms have no roots, the result is false. Calls Composite::getRoot .

Returns:
bool - true if this bond is intermolecular, false otherwise
See also:
Composite::getRoot

bool BALL::Bond::isInterBondOf ( const AtomContainer & atom_container ) const

Request for the intermolecular bonding of this bond within {atom_container}.

Query, if this bond connects a atom within {atom_container} instance with an atom outside. Calls Composite::isDescendantOf .

Parameters:
atom_container the queried parent fragment.
Returns:
bool - true if this bond is intermolecular, false otherwise
See also:
Composite::isDescendantOf

bool BALL::Bond::isIntraBond ( ) const

Request for the intramolecular bonding of this bond.

Query, if this bond connects its two atoms within a common parent Composite instance. If both atoms have no roots, the result is true. Calls Composite::getRoot .

Returns:
bool - true if this bond is intramolecular, false otherwise
See also:
Composite::getRoot

bool BALL::Bond::isIntraBondOf ( const AtomContainer & atom_container ) const

Request for the intramolecular bonding of this bond within {atom_container}.

Query, if this bond connects its two atoms within the common parent {atom_container} instance. Calls Composite::isDescendantOf .

Parameters:
atom_container the queried parent fragment.
Returns:
bool - true if this bond is intramolecular, false otherwise
See also:
Composite::isDescendantOf

virtual bool BALL::Bond::isValid ( ) const [virtual]

Internal state and consistency self-validation.

Returns:
bool - true if the internal state of this bond is correct (self-validated) and consistent, false otherwise

Reimplemented from BALL::Composite.

Bond& BALL::Bond::operator= ( const Bond & bond )

Assignment operator.

Assign a deep copy (on the level of Composite ).

Note: The use of this method is not recommended because it may result in inconcistencies of the whole system. This is for internal use only.

Parameters:
bond the bond to be copied
Returns:
Bond - this bond
See also:
Bond::set

void BALL::Bond::persistentRead ( PersistenceManager & pm ) throw (Exception::GeneralException) [virtual]

Read a bond from a persistent stream.

Parameters:
pm the persistence manager

Reimplemented from BALL::Composite.

void BALL::Bond::persistentWrite ( PersistenceManager & pm,
const char * name = 0
) const throw (Exception::GeneralException) [virtual]

Write a bond to a persistent stream.

Parameters:
pm the persistence manager

Reimplemented from BALL::Composite.

void BALL::Bond::setFirstAtom ( Atom * atom )

Set the first atom.

This method does not ensure the correct order of atoms (see Bond ), so its use is recommended for internal purposes only.

Referenced by BALL::cloneBonds().

void BALL::Bond::setSecondAtom ( Atom * atom )

Set the second atom.

This method does not ensure the correct order of atoms (see Bond ), so its use is recommended for internal purposes only.

Referenced by BALL::cloneBonds().

void BALL::Bond::swap ( Bond & bond )

Swap the contents of two bonds.

Parameters:
bond the bond this is being swapped with
See also:
Bond::Bond

Generated on Thu Aug 6 18:30:30 2009 for BALL by doxygen 1.5.8