RDCatalog::HierarchCatalog< entryType, paramType, orderType > Class Template Reference

A Catalog with a hierarchical structure. More...

`#include <Catalog.h>`

Inheritance diagram for RDCatalog::HierarchCatalog< entryType, paramType, orderType >:

## Classes

struct | vertex_entry_t
| used by the BGL to set up the node properties in our graph More...

## Public Types

typedef boost::property< vertex_entry_t, entryType * > | EntryProperty
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, EntryProperty > | CatalogGraph
| the type of the graph itself: More...
typedef boost::graph_traits< CatalogGraph > | CAT_GRAPH_TRAITS
typedef CAT_GRAPH_TRAITS::vertex_iterator | VER_ITER
typedef std::pair< VER_ITER, VER_ITER > | ENT_ITER_PAIR
typedef CAT_GRAPH_TRAITS::adjacency_iterator | DOWN_ENT_ITER
typedef std::pair< DOWN_ENT_ITER, DOWN_ENT_ITER > | DOWN_ENT_ITER_PAIR
Public Types inherited from RDCatalog::Catalog< entryType, paramType >
typedef entryType | entryType_t
typedef paramType | paramType_t

## Public Member Functions

| HierarchCatalog ()
| HierarchCatalog (const paramType *params)
| Construct by making a copy of the input `params` object. More...
| HierarchCatalog (const std::string &pickle)
| Construct from a `pickle` (a serialized form of the HierarchCatalog) More...
| ~HierarchCatalog ()
void | toStream (std::ostream &ss) const
| serializes this object to a stream More...
std::string | Serialize () const
| serializes this object and returns the resulting `pickle` More...
void | initFromStream (std::istream &ss)
| fills the contents of this object from a stream containing a `pickle` More...
unsigned int | getNumEntries () const
| returns the number of entries More...
void | initFromString (const std::string &text)
| fills the contents of this object from a string containing a `pickle` More...
unsigned int | addEntry (entryType *entry, bool updateFPLength=true)
| add a new entry to the catalog More...
void | addEdge (unsigned int id1, unsigned int id2)
| adds an edge between two entries in the catalog More...
const entryType * | getEntryWithIdx (unsigned int idx) const
| returns a pointer to our entry with a particular index More...
const entryType * | getEntryWithBitId (unsigned int idx) const
| returns a pointer to our entry with a particular bit ID More...
int | getIdOfEntryWithBitId (unsigned int idx) const
| returns the index of the entry with a particular bit ID More...
RDKit::INT_VECT | getDownEntryList (unsigned int idx) const
| returns a list of the indices of entries below the one passed in More...
const RDKit::INT_VECT & | getEntriesOfOrder (orderType ord)
| returns a list of the indices that have a particular order More...
const RDKit::INT_VECT & | getEntriesOfOrder (orderType ord) const
| returns a list of the indices that have a particular order More...
Public Member Functions inherited from RDCatalog::Catalog< entryType, paramType >
| Catalog ()
virtual | ~Catalog ()
unsigned int | getFPLength () const
| returns the length of our fingerprint More...
void | setFPLength (unsigned int val)
| sets our fingerprint length More...
virtual void | setCatalogParams (const paramType *params)
| sets our parameters by copying the `params` argument More...
const paramType * | getCatalogParams () const
| returns a pointer to our parameters More...

## Additional Inherited Members

Protected Attributes inherited from RDCatalog::Catalog< entryType, paramType >
unsigned int | d_fpLength
| the length of our fingerprint More...
paramType * | dp_cParams
| our params object More...

## Detailed Description

### template<class entryType, class paramType, class orderType>
class RDCatalog::HierarchCatalog< entryType, paramType, orderType >

A Catalog with a hierarchical structure.

The entries of a HierarchCatalog are arranged in a directed graph

The difference between Indices and Bit Ids

A HierarchCatalog may contain more entries than the user is actually interested in. For example a HierarchCatalog constructed to contain orders 5 through 8 may well contain information about orders 1-5, in order to facilitate some search optimizations.

- Bit Ids refer to the "interesting" bits. So, in the above example, Bit Id `0` will be the first entry with order 5.
- Indices refer to the underlying structure of the catalog. So, in the above example, the entry with index `0` will be the first entry with order 1.

Definition at line 135 of file Catalog.h.

## Member Typedef Documentation

## CAT_GRAPH_TRAITS

template<class entryType , class paramType , class orderType >

typedef boost::graph_traits<CatalogGraph> RDCatalog::HierarchCatalog< entryType, paramType, orderType >::CAT_GRAPH_TRAITS

Definition at line 155 of file Catalog.h.

## CatalogGraph

template<class entryType , class paramType , class orderType >

typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, EntryProperty> RDCatalog::HierarchCatalog< entryType, paramType, orderType >::CatalogGraph

the type of the graph itself:

Definition at line 153 of file Catalog.h.

## DOWN_ENT_ITER

template<class entryType , class paramType , class orderType >

typedef CAT_GRAPH_TRAITS::adjacency_iterator RDCatalog::HierarchCatalog< entryType, paramType, orderType >::DOWN_ENT_ITER

Definition at line 158 of file Catalog.h.

## DOWN_ENT_ITER_PAIR

template<class entryType , class paramType , class orderType >

typedef std::pair<DOWN_ENT_ITER, DOWN_ENT_ITER> RDCatalog::HierarchCatalog< entryType, paramType, orderType >::DOWN_ENT_ITER_PAIR

Definition at line 159 of file Catalog.h.

## ENT_ITER_PAIR

template<class entryType , class paramType , class orderType >

typedef std::pair<VER_ITER, VER_ITER> RDCatalog::HierarchCatalog< entryType, paramType, orderType >::ENT_ITER_PAIR

Definition at line 157 of file Catalog.h.

## EntryProperty

template<class entryType , class paramType , class orderType >

typedef boost::property<vertex_entry_t, entryType *> RDCatalog::HierarchCatalog< entryType, paramType, orderType >::EntryProperty

Definition at line 144 of file Catalog.h.

## VER_ITER

template<class entryType , class paramType , class orderType >

typedef CAT_GRAPH_TRAITS::vertex_iterator RDCatalog::HierarchCatalog< entryType, paramType, orderType >::VER_ITER

Definition at line 156 of file Catalog.h.

## Constructor & Destructor Documentation

## HierarchCatalog() [1/3]

template<class entryType , class paramType , class orderType >

RDCatalog::HierarchCatalog< entryType, paramType, orderType >::HierarchCatalog | ( |  | ) |

inline

Definition at line 162 of file Catalog.h.

## HierarchCatalog() [2/3]

template<class entryType , class paramType , class orderType >

RDCatalog::HierarchCatalog< entryType, paramType, orderType >::HierarchCatalog | ( | const paramType * | params | ) |

inline

Construct by making a copy of the input `params` object.

Definition at line 166 of file Catalog.h.

References RDCatalog::Catalog< entryType, paramType >::setCatalogParams().

## HierarchCatalog() [3/3]

template<class entryType , class paramType , class orderType >

RDCatalog::HierarchCatalog< entryType, paramType, orderType >::HierarchCatalog | ( | const std::string & | pickle | ) |

inline

Construct from a `pickle` (a serialized form of the HierarchCatalog)

Definition at line 173 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromString().

## ~HierarchCatalog()

template<class entryType , class paramType , class orderType >

RDCatalog::HierarchCatalog< entryType, paramType, orderType >::~HierarchCatalog | ( |  | ) |

inline

Definition at line 178 of file Catalog.h.

## Member Function Documentation

## addEdge()

template<class entryType , class paramType , class orderType >

void RDCatalog::HierarchCatalog< entryType, paramType, orderType >::addEdge | ( | unsigned int | id1,
|  | unsigned int | id2
| ) |  |

inline

adds an edge between two entries in the catalog

Since we are using a bidirectional graph - the order in which the ids are supplied here makes a difference

Parameters

  id1 | index of the edge's beginning
  id2 | index of the edge's end

Definition at line 341 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries(), and URANGE_CHECK.

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromStream().

## addEntry()

template<class entryType , class paramType , class orderType >

unsigned int RDCatalog::HierarchCatalog< entryType, paramType, orderType >::addEntry | ( | entryType * | entry,
|  | bool | updateFPLength = `true`
| ) |  |

inline virtual

add a new entry to the catalog

Parameters

  entry | the entry to be added
  updateFPLength | (optional) if this is true, our internal fingerprint length will also be updated.

Implements RDCatalog::Catalog< entryType, paramType >.

Definition at line 309 of file Catalog.h.

References RDCatalog::Catalog< entryType, paramType >::getFPLength(), PRECONDITION, and RDCatalog::Catalog< entryType, paramType >::setFPLength().

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromStream().

## getDownEntryList()

template<class entryType , class paramType , class orderType >

RDKit::INT_VECT RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getDownEntryList | ( | unsigned int | idx | ) | const

inline

returns a list of the indices of entries below the one passed in

Definition at line 404 of file Catalog.h.

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::toStream().

## getEntriesOfOrder() [1/2]

template<class entryType , class paramType , class orderType >

const RDKit::INT_VECT& RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntriesOfOrder | ( | orderType | ord | ) |

inline

returns a list of the indices that have a particular order

Definition at line 418 of file Catalog.h.

## getEntriesOfOrder() [2/2]

template<class entryType , class paramType , class orderType >

const RDKit::INT_VECT& RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntriesOfOrder | ( | orderType | ord | ) | const

inline

returns a list of the indices that have a particular order

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 427 of file Catalog.h.

References CHECK_INVARIANT.

## getEntryWithBitId()

template<class entryType , class paramType , class orderType >

const entryType* RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntryWithBitId | ( | unsigned int | idx | ) | const

inline

returns a pointer to our entry with a particular bit ID

Definition at line 370 of file Catalog.h.

References RDCatalog::Catalog< entryType, paramType >::getFPLength(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries(), and URANGE_CHECK.

## getEntryWithIdx()

template<class entryType , class paramType , class orderType >

const entryType* RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntryWithIdx | ( | unsigned int | idx | ) | const

inline virtual

returns a pointer to our entry with a particular index

Implements RDCatalog::Catalog< entryType, paramType >.

Definition at line 360 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries(), and URANGE_CHECK.

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::toStream().

## getIdOfEntryWithBitId()

template<class entryType , class paramType , class orderType >

int RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getIdOfEntryWithBitId | ( | unsigned int | idx | ) | const

inline

returns the index of the entry with a particular bit ID

Definition at line 387 of file Catalog.h.

References RDCatalog::Catalog< entryType, paramType >::getFPLength(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries(), and URANGE_CHECK.

## getNumEntries()

template<class entryType , class paramType , class orderType >

unsigned int RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries | ( |  | ) | const

inline virtual

returns the number of entries

Implements RDCatalog::Catalog< entryType, paramType >.

Definition at line 285 of file Catalog.h.

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::addEdge(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntryWithBitId(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntryWithIdx(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getIdOfEntryWithBitId(), and RDCatalog::HierarchCatalog< entryType, paramType, orderType >::toStream().

## initFromStream()

template<class entryType , class paramType , class orderType >

void RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromStream | ( | std::istream & | ss | ) |

inline

fills the contents of this object from a stream containing a `pickle`

Definition at line 237 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::addEdge(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::addEntry(), RDCatalog::Catalog< entryType, paramType >::setCatalogParams(), RDCatalog::Catalog< entryType, paramType >::setFPLength(), and RDKit::streamRead().

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromString().

## initFromString()

template<class entryType , class paramType , class orderType >

void RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromString | ( | const std::string & | text | ) |

inline

fills the contents of this object from a string containing a `pickle`

Definition at line 291 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::initFromStream().

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::HierarchCatalog().

## Serialize()

template<class entryType , class paramType , class orderType >

std::string RDCatalog::HierarchCatalog< entryType, paramType, orderType >::Serialize | ( |  | ) | const

inline virtual

serializes this object and returns the resulting `pickle`

Implements RDCatalog::Catalog< entryType, paramType >.

Definition at line 228 of file Catalog.h.

References RDCatalog::HierarchCatalog< entryType, paramType, orderType >::toStream().

## toStream()

template<class entryType , class paramType , class orderType >

void RDCatalog::HierarchCatalog< entryType, paramType, orderType >::toStream | ( | std::ostream & | ss | ) | const

inline

serializes this object to a stream

Definition at line 182 of file Catalog.h.

References RDCatalog::endianId, RDCatalog::Catalog< entryType, paramType >::getCatalogParams(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getDownEntryList(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getEntryWithIdx(), RDCatalog::Catalog< entryType, paramType >::getFPLength(), RDCatalog::HierarchCatalog< entryType, paramType, orderType >::getNumEntries(), PRECONDITION, RDKit::streamWrite(), RDCatalog::versionMajor, RDCatalog::versionMinor, and RDCatalog::versionPatch.

Referenced by RDCatalog::HierarchCatalog< entryType, paramType, orderType >::Serialize().

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

- Catalog.h