File row.hpp
↰ Parent directory (cif++
)
Definition (cif++/row.hpp
)
Detailed Description
The class Class row should be an opaque type. It is used to store the internal data per row in a category. You should use Class row_handle to get access to the contents in a row.
One could think of rows as vectors of Class item. But internally that’s not the case.
You can access the values of stored items by name or index. The return value of operator[] is an Struct item_handle object.
:ref:`exhale_class_classcif_1_1category`&atom_site=my_db[“atom_site”]; :ref:`exhale_class_classcif_1_1row__handle`rh=atom_site.front();
//byname: std::stringname=rh[“label_atom_id”].as<std::string>();
//byindex: uint16_tix=atom_site.get_item_ix(“label_atom_id”); assert(rh[ix].as<std::string()==name);
There some template magic here to allow easy extracting of data from rows. This can be done using Template Function cif::tie e.g.:
std::stringname; floatx,y,z;
:ref:`exhale_function_namespacecif_1ac3d9a984c107208b0abbabe5f9e05289`(name,x,y,z)=rh.get(“label_atom_id”,”cartn_x”,”cartn_y”,”cartn_z”);
However, a more modern way uses structured binding:
constauto&[name,x,y,z]=rh.get<std::string,float,float,float>(“label_atom_id”,”cartn_x”,”cartn_y”,”cartn_z”);
Includes
array
cif++/item.hpp
(File item.hpp)