Skip to content

Commit

Permalink
Make get_relation_items const and comment that update_reference_items…
Browse files Browse the repository at this point in the history
… behaves as const.
  • Loading branch information
emilyfertig committed Sep 24, 2024
1 parent d285826 commit 57e25d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cxx/gendb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ T_items GenDB::sample_class_ancestors(std::mt19937* prng,
// class_item equal to a primary key value (which goes in the last element of
// items and determines the rest of the values).
void GenDB::get_relation_items(const std::string& rel_name, const int ind,
const int class_item, T_items& items) {
const int class_item, T_items& items) const {
const std::vector<std::string>& domains = std::visit(
[&](auto tr) { return tr.domains; }, hirm->schema.at(rel_name));
items[ind] = class_item;
Expand Down
5 changes: 3 additions & 2 deletions cxx/gendb.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GenDB {
// Populates "items" with entities by walking the DAG of reference indices,
// starting with "ind".
void get_relation_items(const std::string& rel_name, const int ind,
const int class_item, T_items& items);
const int class_item, T_items& items) const;

// Unincorporates all data where class_name refers to ref_field amd has
// primary key value class_item.
Expand All @@ -88,7 +88,8 @@ class GenDB {
// Returns a copy of stored_values, with the items updated to associate
// class_name.ref_field at index class_item with new_ref_val. This update is
// recursive, such that the reference fields of the class corresponding to
// ref_field are updated as well.
// ref_field are updated as well. This method behaves as const (although it
// modifies/restores the state of reference_values).
std::map<std::string,
std::unordered_map<T_items, ObservationVariant, H_items>>
update_reference_items(
Expand Down

0 comments on commit 57e25d5

Please sign in to comment.