Attention

This API is currently available in C++ and Python.

OESiteHopperDatabase

class OESiteHopperDatabase : public OEShape::OESiteHopperDatabaseBase

This class allows creation and searching of one or more OESiteHopper patches, built from OEDesignUnits. When adding data to the database, it can be opened in either Create or Append mode. For searching, open in Search (ReadOnly) mode for thread safety and to prevent accidentally changing the data.

Constructors

OESiteHopperDatabase()
OESiteHopperDatabase(const OESiteHopperDatabase &)

Default constructors.

Open

bool Open(const std::string &dbfile, const unsigned int mode,
          const OESiteHopperDatabaseOptions &opts=OESiteHopperDatabaseOptions())

Open a file as an OESiteHopperDatabase.

To create a new database, use the mode OESiteHopperDatabaseMode.CREATE. If the file already exists, it will be overwritten. The options used to create the database can be changed by passing an new version of OESiteHopperDatabaseOptions.

To append to an existing database, use the mode OESiteHopperDatabaseMode.APPEND. If the file does not yet exists, it will be created like the Create mode.

To read or search a file, open using the mode OESiteHopperDatabaseMode.SEARCH. This opens the database in read-only mode and will not allow adding new entries.

Note

OESiteHopperDatabaseOptions are only used in CREATE mode. Otherwise, options already stored in the database will be used.

operator bool

operator bool() const

Add

unsigned int Add(const std::string &filename)
unsigned int Add(const OEBio::OEDesignUnit &du)

Add a single OEDesignUnit file or object to an open database. This method will fail if the database is not open or if not opened in Create or Append mode.

Returns the index of the newly added OEDesignUnit or UINT_MAX on failure.

AddDirectory

bool AddDirectory(const std::string &path, unsigned int ncpu=0,
                  OESystem::OETracerBase &tracer=OESystem::OENoTracer)

Add a directory of OEDesignUnit files to the database. This call will recurse the entire directory tree, looking for all available .oedu files.

By default, this call will use all available CPUs to process this set of OEDesignUnits. Setting ncpu can be used to reduce the number of CPUs used.

If you want to see a progress bar during the process, use an OEConsoleProgressTracer instead of the default OENoTracer.

Close

void Close()

Close the database connection. Any operations (except another call to Open) after this will fail.

GetDesignUnit

bool GetDesignUnit(OEBio::OEDesignUnit &du, unsigned int idx) const

Get a specific OEDesignUnit based on the database index.

GetIDByTitle

std::vector<unsigned int> GetIDByTitle(const std::string &title) const

Get a vector of indices based on a substring match of the passed in title to OEDesignUnit titles in the database.

GetMaxMolIdx

unsigned int GetMaxMolIdx() const

Internal use: Get the maximum index in the database. Used by the GPU search.

GetMolecule

bool GetMolecule(OEChem::OEMolBase &mol, unsigned int idx) const

Internal use: Get the patch molecule for the given index.

GetOptions

const OESiteHopperDatabaseOptions &GetOptions() const

Get the options used to create patches as they are added to the database.

GetSequenceInfo

bool GetSequenceInfo(std::vector<std::vector<std::string>> &seq,
                     unsigned int idx) const

Internal use: Get the sequence info for the given database index.

GetTitle

bool GetTitle(std::string &title, unsigned int idx) const

Get the OEDesignUnit title for the given index.