Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
CDPL::ConfGen::FragmentLibrary Class Reference

Data structure representing a library of pre-generated molecular fragment conformer ensembles. More...

#include <FragmentLibrary.hpp>

Public Types

typedef std::shared_ptr< FragmentLibrarySharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated FragmentLibrary instances. More...
 
typedef HashToEntryMap::value_type Entry
 The type of a stored hash-code-to-entry pair. More...
 
typedef HashToEntryMap::const_iterator ConstEntryIterator
 A constant iterator over the stored entries. More...
 
typedef HashToEntryMap::iterator EntryIterator
 A mutable iterator over the stored entries. More...
 

Public Member Functions

 FragmentLibrary ()
 Constructs an empty FragmentLibrary instance. More...
 
 FragmentLibrary (const FragmentLibrary &lib)
 Constructs a copy of the FragmentLibrary instance lib. More...
 
 ~FragmentLibrary ()
 Destructor. More...
 
FragmentLibraryoperator= (const FragmentLibrary &lib)
 Replaces the contents of this library with a copy of the contents of lib. More...
 
void addEntries (const FragmentLibrary &lib)
 Adds all entries from lib to this library. More...
 
bool addEntry (const FragmentLibraryEntry::SharedPointer &entry)
 Adds the given entry to the library. More...
 
const FragmentLibraryEntry::SharedPointergetEntry (std::uint64_t hash_code) const
 Returns the entry with the specified hash code. More...
 
bool containsEntry (std::uint64_t hash_code) const
 Tells whether the library contains an entry with the specified hash code. More...
 
std::size_t getNumEntries () const
 Returns the number of entries stored in the library. More...
 
void clear ()
 Removes all entries from the library. More...
 
bool removeEntry (std::uint64_t hash_code)
 Removes the entry with the specified hash code. More...
 
EntryIterator removeEntry (const EntryIterator &it)
 Removes the entry referenced by the given iterator. More...
 
ConstEntryIterator getEntriesBegin () const
 Returns a constant iterator pointing to the first entry of the library. More...
 
ConstEntryIterator getEntriesEnd () const
 Returns a constant iterator pointing one past the last entry of the library. More...
 
EntryIterator getEntriesBegin ()
 Returns a mutable iterator pointing to the first entry of the library. More...
 
EntryIterator getEntriesEnd ()
 Returns a mutable iterator pointing one past the last entry of the library. More...
 
ConstEntryIterator begin () const
 Returns a constant iterator pointing to the first entry of the library (range-based for support). More...
 
ConstEntryIterator end () const
 Returns a constant iterator pointing one past the last entry of the library (range-based for support). More...
 
EntryIterator begin ()
 Returns a mutable iterator pointing to the first entry of the library (range-based for support). More...
 
EntryIterator end ()
 Returns a mutable iterator pointing one past the last entry of the library (range-based for support). More...
 
void load (std::istream &is)
 Loads the contents of the library from the input stream is. More...
 
void save (std::ostream &os) const
 Writes the contents of the library to the output stream os. More...
 
void loadDefaults ()
 Loads the default fragment library bundled with CDPKit. More...
 
std::mutex & getMutex ()
 Returns the mutex protecting the library state for use by external multi-threaded callers. More...
 

Static Public Member Functions

static void set (const SharedPointer &lib)
 Sets the process-wide default fragment library used by ConfGen routines. More...
 
static const SharedPointerget ()
 Returns the process-wide default fragment library. More...
 

Detailed Description

Data structure representing a library of pre-generated molecular fragment conformer ensembles.

Entries are FragmentLibraryEntry instances keyed by the hash code of the associated ConfGen::CanonicalFragment. The library is iterable, supports lookup/insertion/removal, can be serialized to and from a stream, and provides a process-wide default instance via the static set() / get() accessors. A built-in mutex is exposed via getMutex() to allow callers to coordinate concurrent access.

See also
[CFRG]

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated FragmentLibrary instances.

◆ Entry

typedef HashToEntryMap::value_type CDPL::ConfGen::FragmentLibrary::Entry

The type of a stored hash-code-to-entry pair.

◆ ConstEntryIterator

typedef HashToEntryMap::const_iterator CDPL::ConfGen::FragmentLibrary::ConstEntryIterator

A constant iterator over the stored entries.

◆ EntryIterator

typedef HashToEntryMap::iterator CDPL::ConfGen::FragmentLibrary::EntryIterator

A mutable iterator over the stored entries.

Constructor & Destructor Documentation

◆ FragmentLibrary() [1/2]

CDPL::ConfGen::FragmentLibrary::FragmentLibrary ( )

Constructs an empty FragmentLibrary instance.

◆ FragmentLibrary() [2/2]

CDPL::ConfGen::FragmentLibrary::FragmentLibrary ( const FragmentLibrary lib)

Constructs a copy of the FragmentLibrary instance lib.

Parameters
libThe FragmentLibrary to copy.

◆ ~FragmentLibrary()

CDPL::ConfGen::FragmentLibrary::~FragmentLibrary ( )

Destructor.

Member Function Documentation

◆ operator=()

FragmentLibrary& CDPL::ConfGen::FragmentLibrary::operator= ( const FragmentLibrary lib)

Replaces the contents of this library with a copy of the contents of lib.

Parameters
libThe source FragmentLibrary.
Returns
A reference to itself.

◆ addEntries()

void CDPL::ConfGen::FragmentLibrary::addEntries ( const FragmentLibrary lib)

Adds all entries from lib to this library.

Parameters
libThe source FragmentLibrary.

◆ addEntry()

bool CDPL::ConfGen::FragmentLibrary::addEntry ( const FragmentLibraryEntry::SharedPointer entry)

Adds the given entry to the library.

Parameters
entryThe entry to add.
Returns
true if the entry was added, and false if an entry with the same hash code was already present.

◆ getEntry()

const FragmentLibraryEntry::SharedPointer& CDPL::ConfGen::FragmentLibrary::getEntry ( std::uint64_t  hash_code) const

Returns the entry with the specified hash code.

Parameters
hash_codeThe hash code of the queried entry.
Returns
A const reference to the matching entry's smart pointer, or to an empty smart pointer if no entry with hash_code exists.

◆ containsEntry()

bool CDPL::ConfGen::FragmentLibrary::containsEntry ( std::uint64_t  hash_code) const

Tells whether the library contains an entry with the specified hash code.

Parameters
hash_codeThe hash code of the queried entry.
Returns
true if the entry exists, and false otherwise.

◆ getNumEntries()

std::size_t CDPL::ConfGen::FragmentLibrary::getNumEntries ( ) const

Returns the number of entries stored in the library.

Returns
The number of entries.

◆ clear()

void CDPL::ConfGen::FragmentLibrary::clear ( )

Removes all entries from the library.

◆ removeEntry() [1/2]

bool CDPL::ConfGen::FragmentLibrary::removeEntry ( std::uint64_t  hash_code)

Removes the entry with the specified hash code.

Parameters
hash_codeThe hash code of the entry to remove.
Returns
true if the entry was removed, and false if no matching entry existed.

◆ removeEntry() [2/2]

EntryIterator CDPL::ConfGen::FragmentLibrary::removeEntry ( const EntryIterator it)

Removes the entry referenced by the given iterator.

Parameters
itIterator referencing the entry to remove.
Returns
An iterator pointing to the entry following the removed one.

◆ getEntriesBegin() [1/2]

ConstEntryIterator CDPL::ConfGen::FragmentLibrary::getEntriesBegin ( ) const

Returns a constant iterator pointing to the first entry of the library.

Returns
A constant iterator pointing to the first entry.

◆ getEntriesEnd() [1/2]

ConstEntryIterator CDPL::ConfGen::FragmentLibrary::getEntriesEnd ( ) const

Returns a constant iterator pointing one past the last entry of the library.

Returns
A constant iterator pointing one past the last entry.

◆ getEntriesBegin() [2/2]

EntryIterator CDPL::ConfGen::FragmentLibrary::getEntriesBegin ( )

Returns a mutable iterator pointing to the first entry of the library.

Returns
A mutable iterator pointing to the first entry.

◆ getEntriesEnd() [2/2]

EntryIterator CDPL::ConfGen::FragmentLibrary::getEntriesEnd ( )

Returns a mutable iterator pointing one past the last entry of the library.

Returns
A mutable iterator pointing one past the last entry.

◆ begin() [1/2]

ConstEntryIterator CDPL::ConfGen::FragmentLibrary::begin ( ) const

Returns a constant iterator pointing to the first entry of the library (range-based for support).

Returns
A constant iterator pointing to the first entry.

◆ end() [1/2]

ConstEntryIterator CDPL::ConfGen::FragmentLibrary::end ( ) const

Returns a constant iterator pointing one past the last entry of the library (range-based for support).

Returns
A constant iterator pointing one past the last entry.

◆ begin() [2/2]

EntryIterator CDPL::ConfGen::FragmentLibrary::begin ( )

Returns a mutable iterator pointing to the first entry of the library (range-based for support).

Returns
A mutable iterator pointing to the first entry.

◆ end() [2/2]

EntryIterator CDPL::ConfGen::FragmentLibrary::end ( )

Returns a mutable iterator pointing one past the last entry of the library (range-based for support).

Returns
A mutable iterator pointing one past the last entry.

◆ load()

void CDPL::ConfGen::FragmentLibrary::load ( std::istream &  is)

Loads the contents of the library from the input stream is.

Parameters
isThe input stream to read from.

◆ save()

void CDPL::ConfGen::FragmentLibrary::save ( std::ostream &  os) const

Writes the contents of the library to the output stream os.

Parameters
osThe output stream to write to.

◆ loadDefaults()

void CDPL::ConfGen::FragmentLibrary::loadDefaults ( )

Loads the default fragment library bundled with CDPKit.

◆ getMutex()

std::mutex& CDPL::ConfGen::FragmentLibrary::getMutex ( )

Returns the mutex protecting the library state for use by external multi-threaded callers.

Returns
A reference to the protecting mutex.

◆ set()

static void CDPL::ConfGen::FragmentLibrary::set ( const SharedPointer lib)
static

Sets the process-wide default fragment library used by ConfGen routines.

Parameters
libThe new default fragment library.

◆ get()

static const SharedPointer& CDPL::ConfGen::FragmentLibrary::get ( )
static

Returns the process-wide default fragment library.

Returns
The current default fragment library.

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