STORMM Source Documentation
Loading...
Searching...
No Matches
mdlmol_property.h
1// -*-c++-*-
2#ifndef STORMM_MOLOBJ_PROPERTY_H
3#define STORMM_MOLOBJ_PROPERTY_H
4
5#include <string>
6#include <vector>
7#include "copyright.h"
8#include "Parsing/textfile.h"
9#include "molecule_format_enumerators.h"
10
11namespace stormm {
12namespace structure {
13
14using parse::TextFile;
15
18public:
19
29 MdlMolProperty(const char4 code_in = { ' ', ' ', ' ', ' ' }, int substrate_in = -1,
30 int entry_count_in = 0, int entry_depth_in = 0, bool exclusions_in = false,
31 int substrate_line_pos_in = -1, int entry_count_line_pos_in = -1,
32 int entry_read_start_pos_in = 0,
33 const std::vector<int> &entry_data_bounds_in = {},
34 const std::vector<MolObjPropField> &entry_detail_in = {},
35 const std::vector<MolObjIndexKind> &entry_adjustment_in = {},
36 const std::vector<int> &int_data_in = {},
37 const std::vector<double> &real_data_in = {},
38 const std::vector<std::string> &str_data_in = {},
39 const std::vector<std::string> &data_lines_in = {});
40
41 MdlMolProperty(const TextFile &tf, int line_number, int *line_advance,
42 const std::string &title = std::string(""));
44
48 MdlMolProperty(const MdlMolProperty &original) = default;
49 MdlMolProperty(MdlMolProperty &&original) = default;
50 MdlMolProperty& operator=(const MdlMolProperty &other) = default;
51 MdlMolProperty& operator=(MdlMolProperty &&other) = default;
53
55 MdlMolPropertyKind getKind() const;
56
59 char4 getCode() const;
60
63 int getSubstrate() const;
64
69 int getPrintedSubstrate() const;
70
74 bool applyToExclusions() const;
75
78 char getExclusionCode() const;
79
81 int getEntryCount() const;
82
84 int getDataLineCount() const;
85
92 int getIntegerValue(int entry_index, int attribute_index) const;
93 int getPrintedIntegerValue(int entry_index, int attribute_index) const;
94 double getRealValue(int entry_index, int attribute_index) const;
95 char4 getChar4Value(int entry_index, int attribute_index) const;
96 std::string getStringValue(int entry_index, int attribute_index) const;
98
100 const std::string& getDataLine(int index) const;
101
103 std::string getMdlText() const;
104
119 void setCode(char x, char y, char z, char major = 'M');
120
121 void setCode(char4 code_in);
123
129 void setSubstrate(int index);
130
139 void setEntryFormat(const std::vector<MolObjPropField> &entry_detail_in,
140 const std::vector<MolObjIndexKind> &entry_adjustment_in);
141
155 void addEntry(const std::vector <int> &int_data_in, const std::vector <char4> &char4_data_in,
156 const std::vector<double> &real_data_in,
157 const std::vector<std::string> &str_data_in);
158
159private:
160 char4 code;
163 MdlMolPropertyKind kind;
164 int substrate;
166 int entry_count;
168 int entry_depth;
169 bool exclusions;
172 int substrate_line_pos;
176 int entry_count_line_pos;
179 int entry_read_start_pos;
181
184 std::vector<int> entry_data_bounds;
185
188 std::vector<MolObjPropField> entry_detail;
189
192 std::vector<MolObjIndexKind> entry_adjustment;
193
194 std::vector<int> int_data;
197 std::vector<double> real_data;
202 std::vector<std::string> str_data;
208 std::vector<std::string> data_lines;
210
218 bool readEntryCount(const char* line_ptr, int start_pos = 6, int length = 3);
219
227 bool readSubstrateIndex(const char* line_ptr, int start_pos = 7, int length = 3);
228
240 void parseEntries(const TextFile &tf, int line_number, int start_pos,
241 const std::vector<int> &limits);
242
250 void checkAttributeValidity(int entry_index, int attribute_index,
251 MolObjPropField expectation) const;
252};
253
254} // namespace structure
255} // namespace stormm
256
257#endif
Structure for translating a text file into a compact, rapidly parsable vector of characters in CPU RA...
Definition textfile.h:45
MdlMolProperty(const char4 code_in={ ' ', ' ', ' ', ' ' }, int substrate_in=-1, int entry_count_in=0, int entry_depth_in=0, bool exclusions_in=false, int substrate_line_pos_in=-1, int entry_count_line_pos_in=-1, int entry_read_start_pos_in=0, const std::vector< int > &entry_data_bounds_in={}, const std::vector< MolObjPropField > &entry_detail_in={}, const std::vector< MolObjIndexKind > &entry_adjustment_in={}, const std::vector< int > &int_data_in={}, const std::vector< double > &real_data_in={}, const std::vector< std::string > &str_data_in={}, const std::vector< std::string > &data_lines_in={})
The constructor takes all member variable inputs, or the original text and a line number within it.
Definition mdlmol_property.cpp:21
int getSubstrate() const
Get the substrate atom or S-group. The nature of the property will indicate which type of substrate t...
Definition mdlmol_property.cpp:445
int getEntryCount() const
Get the number of entries for this property.
Definition mdlmol_property.cpp:472
char getExclusionCode() const
Get a code ('T' if TRUE, 'F' if FALSE) to indicate whether the atom list describes exclusions.
Definition mdlmol_property.cpp:465
int getIntegerValue(int entry_index, int attribute_index) const
Get a value from the property for a specific entry. Inputs to these functions will be checked by chec...
Definition mdlmol_property.cpp:482
void addEntry(const std::vector< int > &int_data_in, const std::vector< char4 > &char4_data_in, const std::vector< double > &real_data_in, const std::vector< std::string > &str_data_in)
Add an entry to the MDL MOL V2000 format property. The layout must match that established in the deta...
int getDataLineCount() const
Get the number of data lines for this property.
Definition mdlmol_property.cpp:477
MdlMolProperty(const MdlMolProperty &original)=default
The default copy and move constructors, as well as copy and move assignment operators,...
void setEntryFormat(const std::vector< MolObjPropField > &entry_detail_in, const std::vector< MolObjIndexKind > &entry_adjustment_in)
Define the entry format for the property. If applied to an existing MdlMolProperty with nonzero depth...
Definition mdlmol_property.cpp:634
MdlMolPropertyKind getKind() const
Get the kind of property according to the internal enumerator.
Definition mdlmol_property.cpp:435
bool applyToExclusions() const
Indicate whether the atom list encoded by this property is based on excluded elements (return TRUE) o...
Definition mdlmol_property.cpp:455
void setCode(char x, char y, char z, char major='M')
Define the property code.
Definition mdlmol_property.cpp:616
int getPrintedSubstrate() const
Get the substrate atom or S-group for the purposes of printing. The nature of the property will indic...
Definition mdlmol_property.cpp:450
char4 getCode() const
Get the property code. This will indicate whether to obliterate certain types of information from the...
Definition mdlmol_property.cpp:440
std::string getMdlText() const
Recompose the text string for this property as it would appear in an MDL MOL file.
Definition mdlmol_property.cpp:536
void setSubstrate(int index)
Define the substrate to be used, whether an atom or an S-group.
Definition mdlmol_property.cpp:629
const std::string & getDataLine(int index) const
Get a const pointer to one of the data lines.
Definition mdlmol_property.cpp:525
Definition stormm_vector_types.h:141