Chemical Data Processing Library C++ API - Version 1.4.0
Classes | Public Types | Public Member Functions | List of all members
CDPL::Biomol::MMCIFData Class Reference

Data structure for the storage of imported MMCIF data (see [MMCIF]). More...

#include <MMCIFData.hpp>

Classes

class  Category
 A single mmCIF data category, holding an ordered list of data items (columns). More...
 
class  Item
 A single data item (column) of an mmCIF category, holding an ordered list of string values. More...
 

Public Types

typedef std::shared_ptr< MMCIFDataSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated MMCIFData instances. More...
 
typedef CategoryList::const_iterator ConstCategoryIterator
 A constant iterator over the categories of the data record. More...
 
typedef CategoryList::iterator CategoryIterator
 A mutable iterator over the categories of the data record. More...
 

Public Member Functions

 MMCIFData ()=default
 Constructs an empty MMCIFData instance with an empty data-block ID. More...
 
 MMCIFData (const std::string &id)
 Constructs an empty MMCIFData instance with the data-block ID id. More...
 
void setID (const std::string &id)
 Sets the mmCIF data-block ID to id. More...
 
const std::string & getID () const
 Returns the mmCIF data-block ID. More...
 
void clear ()
 Removes all categories from the data record (without changing the data-block ID). More...
 
std::size_t getNumCategories () const
 Returns the number of categories in the data record. More...
 
CategorygetCategory (std::size_t index)
 Returns a mutable reference to the category at the zero-based index index. More...
 
const CategorygetCategory (std::size_t index) const
 Returns a const reference to the category at the zero-based index index. More...
 
CategorygetCategory (const std::string &name)
 Returns a mutable reference to the category with name name. More...
 
const CategorygetCategory (const std::string &name) const
 Returns a const reference to the category with name name. More...
 
const CategoryfindCategory (const std::string &name) const
 Returns a pointer to the category with name name, or nullptr if no matching category exists. More...
 
CategoryfindCategory (const std::string &name)
 Returns a mutable pointer to the category with name name, or nullptr if no matching category exists. More...
 
const CategorylastCategory () const
 Returns a const reference to the last category of the data record. More...
 
CategorylastCategory ()
 Returns a mutable reference to the last category of the data record. More...
 
CategoryaddCategory (const std::string &name, bool front=false)
 Adds a new (empty) category with name name to the data record. More...
 
CategoryIterator removeCategory (const CategoryIterator &it)
 Removes the category pointed to by the iterator it. More...
 
bool removeCategory (const std::string &name)
 Removes the category with name name. More...
 
void removeCategory (std::size_t index)
 Removes the category at the zero-based index index. More...
 
void swap (MMCIFData &data)
 Swaps the contents of this data record with those of data. More...
 
ConstCategoryIterator getCategoriesBegin () const
 Returns a constant iterator pointing to the beginning of the category list. More...
 
CategoryIterator getCategoriesBegin ()
 Returns a mutable iterator pointing to the beginning of the category list. More...
 
ConstCategoryIterator getCategoriesEnd () const
 Returns a constant iterator pointing one past the last category. More...
 
CategoryIterator getCategoriesEnd ()
 Returns a mutable iterator pointing one past the last category. More...
 
ConstCategoryIterator begin () const
 Returns a constant iterator pointing to the beginning of the category list (alias of getCategoriesBegin()). More...
 
CategoryIterator begin ()
 Returns a mutable iterator pointing to the beginning of the category list (alias of getCategoriesBegin()). More...
 
ConstCategoryIterator end () const
 Returns a constant iterator pointing one past the last category (alias of getCategoriesEnd()). More...
 
CategoryIterator end ()
 Returns a mutable iterator pointing one past the last category (alias of getCategoriesEnd()). More...
 

Detailed Description

Data structure for the storage of imported MMCIF data (see [MMCIF]).

Since
1.2

Member Typedef Documentation

◆ SharedPointer

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

◆ ConstCategoryIterator

typedef CategoryList::const_iterator CDPL::Biomol::MMCIFData::ConstCategoryIterator

A constant iterator over the categories of the data record.

◆ CategoryIterator

typedef CategoryList::iterator CDPL::Biomol::MMCIFData::CategoryIterator

A mutable iterator over the categories of the data record.

Constructor & Destructor Documentation

◆ MMCIFData() [1/2]

CDPL::Biomol::MMCIFData::MMCIFData ( )
default

Constructs an empty MMCIFData instance with an empty data-block ID.

◆ MMCIFData() [2/2]

CDPL::Biomol::MMCIFData::MMCIFData ( const std::string &  id)

Constructs an empty MMCIFData instance with the data-block ID id.

Parameters
idThe mmCIF data-block ID.

Member Function Documentation

◆ setID()

void CDPL::Biomol::MMCIFData::setID ( const std::string &  id)

Sets the mmCIF data-block ID to id.

Parameters
idThe new data-block ID.

◆ getID()

const std::string& CDPL::Biomol::MMCIFData::getID ( ) const

Returns the mmCIF data-block ID.

Returns
A const reference to the data-block ID.

◆ clear()

void CDPL::Biomol::MMCIFData::clear ( )

Removes all categories from the data record (without changing the data-block ID).

◆ getNumCategories()

std::size_t CDPL::Biomol::MMCIFData::getNumCategories ( ) const

Returns the number of categories in the data record.

Returns
The category count.

◆ getCategory() [1/4]

Category& CDPL::Biomol::MMCIFData::getCategory ( std::size_t  index)

Returns a mutable reference to the category at the zero-based index index.

Parameters
indexThe zero-based category index.
Returns
A mutable reference to the category.
Exceptions
Base::IndexErrorif the number of categories is zero or index is not in the range [0, getNumCategories() - 1].

◆ getCategory() [2/4]

const Category& CDPL::Biomol::MMCIFData::getCategory ( std::size_t  index) const

Returns a const reference to the category at the zero-based index index.

Parameters
indexThe zero-based category index.
Returns
A const reference to the category.
Exceptions
Base::IndexErrorif the number of categories is zero or index is not in the range [0, getNumCategories() - 1].

◆ getCategory() [3/4]

Category& CDPL::Biomol::MMCIFData::getCategory ( const std::string &  name)

Returns a mutable reference to the category with name name.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A mutable reference to the matching category.
Exceptions
Base::ItemNotFoundif no matching category exists.

◆ getCategory() [4/4]

const Category& CDPL::Biomol::MMCIFData::getCategory ( const std::string &  name) const

Returns a const reference to the category with name name.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A const reference to the matching category.
Exceptions
Base::ItemNotFoundif no matching category exists.

◆ findCategory() [1/2]

const Category* CDPL::Biomol::MMCIFData::findCategory ( const std::string &  name) const

Returns a pointer to the category with name name, or nullptr if no matching category exists.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A const pointer to the matching category, or nullptr.

◆ findCategory() [2/2]

Category* CDPL::Biomol::MMCIFData::findCategory ( const std::string &  name)

Returns a mutable pointer to the category with name name, or nullptr if no matching category exists.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
A mutable pointer to the matching category, or nullptr.

◆ lastCategory() [1/2]

const Category& CDPL::Biomol::MMCIFData::lastCategory ( ) const

Returns a const reference to the last category of the data record.

Returns
A const reference to the last category.
Exceptions
Base::OperationFailedif the data record is empty.

◆ lastCategory() [2/2]

Category& CDPL::Biomol::MMCIFData::lastCategory ( )

Returns a mutable reference to the last category of the data record.

Returns
A mutable reference to the last category.
Exceptions
Base::OperationFailedif the data record is empty.

◆ addCategory()

Category& CDPL::Biomol::MMCIFData::addCategory ( const std::string &  name,
bool  front = false 
)

Adds a new (empty) category with name name to the data record.

If a category with the given name already exists, no new category is added and a reference to the existing category is returned.

Parameters
nameThe mmCIF category name (without the leading underscore).
frontIf true, the new category is inserted at the front of the category list; if false, it is appended.
Returns
A mutable reference to the added (or pre-existing) category.

◆ removeCategory() [1/3]

CategoryIterator CDPL::Biomol::MMCIFData::removeCategory ( const CategoryIterator it)

Removes the category pointed to by the iterator it.

Parameters
itAn iterator pointing to the category to remove.
Returns
An iterator pointing to the category immediately following the removed one.

◆ removeCategory() [2/3]

bool CDPL::Biomol::MMCIFData::removeCategory ( const std::string &  name)

Removes the category with name name.

Parameters
nameThe mmCIF category name (without the leading underscore).
Returns
true if a matching category was removed, and false if no such category existed.

◆ removeCategory() [3/3]

void CDPL::Biomol::MMCIFData::removeCategory ( std::size_t  index)

Removes the category at the zero-based index index.

Parameters
indexThe zero-based category index.
Exceptions
Base::IndexErrorif the number of categories is zero or index is not in the range [0, getNumCategories() - 1].

◆ swap()

void CDPL::Biomol::MMCIFData::swap ( MMCIFData data)

Swaps the contents of this data record with those of data.

Parameters
dataThe other data record to swap with.

◆ getCategoriesBegin() [1/2]

ConstCategoryIterator CDPL::Biomol::MMCIFData::getCategoriesBegin ( ) const

Returns a constant iterator pointing to the beginning of the category list.

Returns
A constant iterator to the first category.

◆ getCategoriesBegin() [2/2]

CategoryIterator CDPL::Biomol::MMCIFData::getCategoriesBegin ( )

Returns a mutable iterator pointing to the beginning of the category list.

Returns
A mutable iterator to the first category.

◆ getCategoriesEnd() [1/2]

ConstCategoryIterator CDPL::Biomol::MMCIFData::getCategoriesEnd ( ) const

Returns a constant iterator pointing one past the last category.

Returns
A constant iterator to the end of the category list.

◆ getCategoriesEnd() [2/2]

CategoryIterator CDPL::Biomol::MMCIFData::getCategoriesEnd ( )

Returns a mutable iterator pointing one past the last category.

Returns
A mutable iterator to the end of the category list.

◆ begin() [1/2]

ConstCategoryIterator CDPL::Biomol::MMCIFData::begin ( ) const

Returns a constant iterator pointing to the beginning of the category list (alias of getCategoriesBegin()).

Returns
A constant iterator to the first category.

◆ begin() [2/2]

CategoryIterator CDPL::Biomol::MMCIFData::begin ( )

Returns a mutable iterator pointing to the beginning of the category list (alias of getCategoriesBegin()).

Returns
A mutable iterator to the first category.

◆ end() [1/2]

ConstCategoryIterator CDPL::Biomol::MMCIFData::end ( ) const

Returns a constant iterator pointing one past the last category (alias of getCategoriesEnd()).

Returns
A constant iterator to the end of the category list.

◆ end() [2/2]

CategoryIterator CDPL::Biomol::MMCIFData::end ( )

Returns a mutable iterator pointing one past the last category (alias of getCategoriesEnd()).

Returns
A mutable iterator to the end of the category list.

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