Regina Calculation Engine
Public Member Functions | List of all members
regina::NCensusDB Class Reference

Stores the location and description of one of Regina's in-built census databases. More...

#include <census/ncensus.h>

Public Member Functions

 NCensusDB (const std::string &filename, const std::string &desc)
 Creates a new reference to one of Regina's census databases. More...
 
const std::string & filename () const
 Returns the filename where this database is stored. More...
 
const std::string & desc () const
 Returns a human-readable description of this database. More...
 
bool lookup (const std::string &isoSig, NCensusHits *hits) const
 Searches for the given isomorphism signature in this database. More...
 

Detailed Description

Stores the location and description of one of Regina's in-built census databases.

A census database stores a list of key-value pairs. The keys are isomorphism signatures of triangulations (as returned by NTriangulation::isoSig(), for instance), and the values are human-readable names (typically the names of the triangulations and/or the names of the underlying manifolds). An isomorphism signature may appear multiple times (with different names) within the same database.

The format used to store census databases is an internal implementation detail that may change in future releases of Regina. End users should only search census databases using high-level routines such as NCensus::lookup() and NCensusDB::lookup().

Constructor & Destructor Documentation

regina::NCensusDB::NCensusDB ( const std::string &  filename,
const std::string &  desc 
)
inline

Creates a new reference to one of Regina's census databases.

This constructor will not run any checks (e.g., it will not verify that the database exists, or that it is stored in the correct format). Note that even if the database does not exist, the lookup() routine will fail gracefully.

Parameters
filenamethe filename where the database is stored.
desca human-readable description of the database. See the desc() routine for further information on how this description might be used.

Member Function Documentation

const std::string & regina::NCensusDB::desc ( ) const
inline

Returns a human-readable description of this database.

The description could (for instance) be shown to users when giving a list of all available databases, or when identifying in which particular database a match was found.

Returns
the database description.
const std::string & regina::NCensusDB::filename ( ) const
inline

Returns the filename where this database is stored.

Returns
the database filename.
bool regina::NCensusDB::lookup ( const std::string &  isoSig,
NCensusHits hits 
) const

Searches for the given isomorphism signature in this database.

All matches (if any) will be appended to the given list of hits.

Note that the database will be opened and closed every time this routine is called.

Parameters
isoSigthe isomorphism signature to search for.
hitsthe list of hits to which all matches will be appended.
Returns
true if the lookup was correctly performed, or false if some error occurred (e.g., the database could not be opened). Note in particular that if there were no matches but no errors, then the return value will be true.

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

Copyright © 1999-2014, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).