29 #ifndef CDPL_BIOMOL_MMCIFDATA_HPP
30 #define CDPL_BIOMOL_MMCIFDATA_HPP
37 #include <boost/ptr_container/ptr_vector.hpp>
38 #include <boost/ptr_container/ptr_deque.hpp>
66 typedef std::vector<std::string> ValueList;
78 Item(
const std::string& name):
104 const std::string&
getValue(std::size_t index)
const;
112 void setValue(std::size_t index,
const std::string& value);
120 void setValue(std::size_t index, std::string&& value);
213 typedef boost::ptr_vector<Item> ItemList;
393 typedef boost::ptr_deque<Category> CategoryList;
588 CategoryList categories;
Definition of the preprocessor macro CDPL_BIOMOL_API.
#define CDPL_BIOMOL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
A single mmCIF data category, holding an ordered list of data items (columns).
Definition: MMCIFData.hpp:211
ConstItemIterator getItemsBegin() const
Returns a constant iterator pointing to the beginning of the item list.
const Item & getItem(const std::string &name) const
Returns a const reference to the item with name name.
ConstItemIterator end() const
Returns a constant iterator pointing one past the last item (alias of getItemsEnd()).
void clear()
Removes all items from the category.
ItemIterator begin()
Returns a mutable iterator pointing to the beginning of the item list (alias of getItemsBegin()).
std::size_t getNumItems() const
Returns the number of items in the category.
void swap(Category &cat)
Swaps the contents of this category with those of cat.
Item * findItem(const std::string &name)
Returns a mutable pointer to the item with name name, or nullptr if no matching item exists.
bool removeItem(const std::string &name)
Removes the item with name name.
std::size_t getNumValueRows() const
Returns the number of value rows of the category, i.e. the maximum value count over all items.
ItemIterator getItemsEnd()
Returns a mutable iterator pointing one past the last item.
Item & getItem(std::size_t index)
Returns a mutable reference to the item at the zero-based index index.
Item & getItem(const std::string &name)
Returns a mutable reference to the item with name name.
ItemList::const_iterator ConstItemIterator
A constant iterator over the items of the category.
Definition: MMCIFData.hpp:217
ConstItemIterator begin() const
Returns a constant iterator pointing to the beginning of the item list (alias of getItemsBegin()).
ConstItemIterator getItemsEnd() const
Returns a constant iterator pointing one past the last item.
ItemIterator removeItem(const ItemIterator &it)
Removes the item pointed to by the iterator it.
ItemIterator end()
Returns a mutable iterator pointing one past the last item (alias of getItemsEnd()).
ItemIterator getItemsBegin()
Returns a mutable iterator pointing to the beginning of the item list.
const std::string & getName() const
Returns the mmCIF category name.
ItemList::iterator ItemIterator
A mutable iterator over the items of the category.
Definition: MMCIFData.hpp:219
void removeItem(std::size_t index)
Removes the item at the zero-based index index.
Category(const std::string &name)
Constructs an empty Category with the name name.
Definition: MMCIFData.hpp:225
const Item & getItem(std::size_t index) const
Returns a const reference to the item at the zero-based index index.
const Item * findItem(const std::string &name) const
Returns a pointer to the item with name name, or nullptr if no matching item exists.
Item & addItem(const std::string &name)
Appends a new (empty) item with name name to the category.
A single data item (column) of an mmCIF category, holding an ordered list of string values.
Definition: MMCIFData.hpp:64
ValueIterator removeValue(const ValueIterator &it)
Removes the value pointed to by the iterator it.
ConstValueIterator getValuesEnd() const
Returns a constant iterator pointing one past the last value.
void addValue(const std::string &value)
Appends the value value to the item's value list.
ValueList::const_iterator ConstValueIterator
A constant iterator over the value list of the item.
Definition: MMCIFData.hpp:70
Item(const std::string &name)
Constructs an empty Item with the data-item name name.
Definition: MMCIFData.hpp:78
std::size_t getNumValues() const
Returns the number of values stored in the item.
void setValue(std::size_t index, std::string &&value)
Replaces the value at the zero-based index index by moving value.
ValueIterator begin()
Returns a mutable iterator pointing to the beginning of the value list (alias of getValuesBegin()).
ValueList::iterator ValueIterator
A mutable iterator over the value list of the item.
Definition: MMCIFData.hpp:72
ValueIterator end()
Returns a mutable iterator pointing one past the last value (alias of getValuesEnd()).
ConstValueIterator end() const
Returns a constant iterator pointing one past the last value (alias of getValuesEnd()).
void clear()
Removes all values from the item.
void setValue(std::size_t index, const std::string &value)
Replaces the value at the zero-based index index by value.
ConstValueIterator getValuesBegin() const
Returns a constant iterator pointing to the beginning of the value list.
ValueIterator getValuesBegin()
Returns a mutable iterator pointing to the beginning of the value list.
ValueIterator getValuesEnd()
Returns a mutable iterator pointing one past the last value.
const std::string & getName() const
Returns the fully-qualified mmCIF data-item name.
ConstValueIterator begin() const
Returns a constant iterator pointing to the beginning of the value list (alias of getValuesBegin()).
void removeValue(std::size_t index)
Removes the value at the zero-based index index.
const std::string & getValue(std::size_t index) const
Returns the value at the zero-based index index.
void swap(Item &item)
Swaps the contents of this item with those of item.
void addValue(std::string &&value)
Appends the value value to the item's value list by moving.
Data structure for the storage of imported MMCIF data (see [MMCIF]).
Definition: MMCIFData.hpp:54
Category & addCategory(const std::string &name, bool front=false)
Adds a new (empty) category with name name to the data record.
std::shared_ptr< MMCIFData > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MMCIFData instances.
Definition: MMCIFData.hpp:58
const Category & getCategory(std::size_t index) const
Returns a const reference to the category at the zero-based index index.
MMCIFData()=default
Constructs an empty MMCIFData instance with an empty data-block ID.
const std::string & getID() const
Returns the mmCIF data-block ID.
void setID(const std::string &id)
Sets the mmCIF data-block ID to id.
const Category * findCategory(const std::string &name) const
Returns a pointer to the category with name name, or nullptr if no matching category exists.
Category & getCategory(const std::string &name)
Returns a mutable reference to the category with name name.
CategoryIterator end()
Returns a mutable iterator pointing one past the last category (alias of getCategoriesEnd()).
CategoryIterator begin()
Returns a mutable iterator pointing to the beginning of the category list (alias of getCategoriesBegi...
Category * findCategory(const std::string &name)
Returns a mutable pointer to the category with name name, or nullptr if no matching category exists.
void clear()
Removes all categories from the data record (without changing the data-block ID).
std::size_t getNumCategories() const
Returns the number of categories in the data record.
CategoryIterator removeCategory(const CategoryIterator &it)
Removes the category pointed to by the iterator it.
const Category & getCategory(const std::string &name) const
Returns a const reference to the category with name name.
CategoryIterator getCategoriesBegin()
Returns a mutable iterator pointing to the beginning of the category list.
bool removeCategory(const std::string &name)
Removes the category with name name.
CategoryList::const_iterator ConstCategoryIterator
A constant iterator over the categories of the data record.
Definition: MMCIFData.hpp:397
Category & lastCategory()
Returns a mutable reference to the last category of the data record.
CategoryList::iterator CategoryIterator
A mutable iterator over the categories of the data record.
Definition: MMCIFData.hpp:399
ConstCategoryIterator getCategoriesBegin() const
Returns a constant iterator pointing to the beginning of the category list.
void swap(MMCIFData &data)
Swaps the contents of this data record with those of data.
CategoryIterator getCategoriesEnd()
Returns a mutable iterator pointing one past the last category.
Category & getCategory(std::size_t index)
Returns a mutable reference to the category at the zero-based index index.
MMCIFData(const std::string &id)
Constructs an empty MMCIFData instance with the data-block ID id.
const Category & lastCategory() const
Returns a const reference to the last category of the data record.
ConstCategoryIterator getCategoriesEnd() const
Returns a constant iterator pointing one past the last category.
ConstCategoryIterator end() const
Returns a constant iterator pointing one past the last category (alias of getCategoriesEnd()).
ConstCategoryIterator begin() const
Returns a constant iterator pointing to the beginning of the category list (alias of getCategoriesBeg...
void removeCategory(std::size_t index)
Removes the category at the zero-based index index.
CDPL_BIOMOL_API std::ostream & operator<<(std::ostream &os, const MMCIFData &data)
Writes the mmCIF data record data in textual mmCIF format to the output stream os.
The namespace of the Chemical Data Processing Library.