Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterate over properties #191

Merged
merged 4 commits into from Sep 17, 2018
Merged

Iterate over properties #191

merged 4 commits into from Sep 17, 2018

Conversation

Luthaf
Copy link
Member

@Luthaf Luthaf commented Aug 30, 2018

This replaces #163

Copy link
Contributor

@frodofine frodofine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few minor comments.

One thing to consider is the removal of properties such as Atom.remove("my prop");, but that is probably the subject of a different PR. Such code can now be tested because we can iterate over the properties themselves.

I'll need to update the SDF writer now because I want to save atom properties with this format.

@@ -213,6 +215,20 @@ class property_map final {
/// Get the property with the given `name` if it exists.
optional<const Property&> get(const std::string& name) const;

size_t size() const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add documentation here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@@ -75,87 +75,87 @@ extern "C" chfl_status chfl_topology_remove(CHFL_TOPOLOGY* const topology, uint6
)
}

extern "C" chfl_status chfl_topology_bonds_count(const CHFL_TOPOLOGY* const topology, uint64_t* nbonds) {
extern "C" chfl_status chfl_topology_bonds_count(const CHFL_TOPOLOGY* const topology, uint64_t* const count) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new consistency in variable names!

const char* names[2] = {NULL};
chfl_atom_list_properties(atom, names, count);

// Properties are not ordered
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is implementation dependent due to an unordered map.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I think it it better to document it as not ordered for now, this can be changed later without breaking code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, I just wanted to make sure.

@Luthaf Luthaf merged commit f09d387 into chemfiles:master Sep 17, 2018
@Luthaf Luthaf deleted the iterate-properties branch September 17, 2018 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants