RingInfo.h
Go to the documentation of this file.
//
// Copyright (C) 2004-2006 Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
#ifndef _RD_RINGINFO_H
#define _RD_RINGINFO_H
#include <map>
#include <vector>
namespace RDKit {
//! A class to store information about a molecule's rings
/*!
*/
class RingInfo {
friend class MolPickler;
public:
typedef std::vector<int> MemberType;
typedef std::vector<MemberType> DataType;
typedef std::vector<int> INT_VECT;
typedef std::vector<INT_VECT> VECT_INT_VECT;
RingInfo() : df_init(false){};
RingInfo(const RingInfo &other)
: df_init(other.df_init),
d_atomMembers(other.d_atomMembers),
d_bondMembers(other.d_bondMembers),
d_atomRings(other.d_atomRings),
d_bondRings(other.d_bondRings){};
//! checks to see if we've been properly initialized
bool isInitialized() const { return df_init; };
//! does initialization
void initialize();
//! blows out all current data and de-initializes
void reset();
//! adds a ring to our data
/*!
\param atomIndices the integer indices of the atoms involved in the ring
\param bondIndices the integer indices of the bonds involved in the ring,
this must be the same size as \c atomIndices.
\return the number of rings
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int addRing(const INT_VECT &atomIndices,
const INT_VECT &bondIndices);
//! \name Atom information
//@{
//! returns whether or not the atom with index \c idx is in a \c size - ring.
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
bool isAtomInRingOfSize(unsigned int idx, unsigned int size) const;
//! returns the number of rings atom \c idx is involved in
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int numAtomRings(unsigned int idx) const;
//! returns the size of the smallest ring atom \c idx is involved in
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int minAtomRingSize(unsigned int idx) const;
//! returns our \c atom-rings vectors
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
const VECT_INT_VECT &atomRings() const { return d_atomRings; };
//@}
//! \name Bond information
//@{
//! returns whether or not the bond with index \c idx is in a \c size - ring.
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
bool isBondInRingOfSize(unsigned int idx, unsigned int size) const;
//! returns the number of rings bond \c idx is involved in
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int numBondRings(unsigned int idx) const;
//! returns the size of the smallest ring bond \c idx is involved in
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int minBondRingSize(unsigned int idx) const;
//! returns the total number of rings
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
unsigned int numRings() const;
//! returns our \c bond-rings vectors
/*!
<b>Notes:</b>
- the object must be initialized before calling this
*/
const VECT_INT_VECT &bondRings() const { return d_bondRings; };
//@}
private:
//! pre-allocates some memory to save time later
void preallocate(unsigned int numAtoms, unsigned int numBonds);
bool df_init;
DataType d_atomMembers, d_bondMembers;
VECT_INT_VECT d_atomRings, d_bondRings;
};
}
#endif
RDKit::RingInfo::numBondRings
unsigned int numBondRings(unsigned int idx) const
returns the number of rings bond idx is involved in
RDKit::RingInfo::DataType
std::vector< MemberType > DataType
Definition: RingInfo.h:26
RDKit::RingInfo::addRing
unsigned int addRing(const INT_VECT &atomIndices, const INT_VECT &bondIndices)
adds a ring to our data
RDKit::RingInfo::bondRings
const VECT_INT_VECT & bondRings() const
returns our bond-rings vectors
Definition: RingInfo.h:126
RDKit::RingInfo::minBondRingSize
unsigned int minBondRingSize(unsigned int idx) const
returns the size of the smallest ring bond idx is involved in
RDKit::RingInfo::numRings
unsigned int numRings() const
returns the total number of rings
RDKit::RingInfo::reset
void reset()
blows out all current data and de-initializes
RDKit::RingInfo::MemberType
std::vector< int > MemberType
Definition: RingInfo.h:25
RDKit
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
RDKit::RingInfo
A class to store information about a molecule&#39;s rings.
Definition: RingInfo.h:21
RDKit::RingInfo::atomRings
const VECT_INT_VECT & atomRings() const
returns our atom-rings vectors
Definition: RingInfo.h:88
RDKit::RingInfo::RingInfo
RingInfo(const RingInfo &other)
Definition: RingInfo.h:31
RDKit::RingInfo::VECT_INT_VECT
std::vector< INT_VECT > VECT_INT_VECT
Definition: RingInfo.h:28
RDKit::MolPickler
handles pickling (serializing) molecules
Definition: MolPickler.h:46
RDKit::RingInfo::isAtomInRingOfSize
bool isAtomInRingOfSize(unsigned int idx, unsigned int size) const
returns whether or not the atom with index idx is in a size - ring.
RDKit::RingInfo::INT_VECT
std::vector< int > INT_VECT
Definition: RingInfo.h:27
RDKit::RingInfo::initialize
void initialize()
does initialization
RDKit::RingInfo::RingInfo
RingInfo()
Definition: RingInfo.h:30
RDKit::RingInfo::numAtomRings
unsigned int numAtomRings(unsigned int idx) const
returns the number of rings atom idx is involved in
RDKit::RingInfo::isBondInRingOfSize
bool isBondInRingOfSize(unsigned int idx, unsigned int size) const
returns whether or not the bond with index idx is in a size - ring.
RDKit::RingInfo::minAtomRingSize
unsigned int minAtomRingSize(unsigned int idx) const
returns the size of the smallest ring atom idx is involved in
RDKit::RingInfo::isInitialized
bool isInitialized() const
checks to see if we&#39;ve been properly initialized
Definition: RingInfo.h:39