Skip to content

Commit

Permalink
fix virtuals
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed Feb 28, 2024
1 parent 3213380 commit 4937f93
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void Material::ChangePackageId(int new_package_id) {
package_id_ = new_package_id;
return;
}

Package::Ptr p = ctx_->GetPackageById(package_id_);
double min = p->fill_min();
double max = p->fill_max();
Expand Down
5 changes: 2 additions & 3 deletions src/material.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ class Material: public Resource {
/// DEPRECATED - use non-const comp() function.
Composition::Ptr comp() const;

/// Returns the package id.
virtual int package_id();
int package_id();

/// Changes the package id. Checks that the resource fits the package
/// type minimum and maximum mass criteria.
virtual void ChangePackageId(int new_package_id = default_package_id_);
void ChangePackageId(int new_package_id = default_package_id_);

protected:
Material(Context* ctx, double quantity, Composition::Ptr c, int package_id = default_package_id_);
Expand Down
4 changes: 4 additions & 0 deletions src/product.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Resource::Ptr Product::ExtractRes(double qty) {
return boost::static_pointer_cast<Resource>(Extract(qty));
}

int Product::package_id() {
return package_id_;
}

void Product::ChangePackageId(int new_package_id) {
if (ctx_ != NULL) {
throw ValueError("Package Id cannot be changed with NULL context");
Expand Down
3 changes: 3 additions & 0 deletions src/product.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class Product : public Resource {
/// @throws ValueError 'other' resource is of different quality
void Absorb(Product::Ptr other);

// Returns the package id.
int package_id();

/// Changes the product's package id
void ChangePackageId(int new_package_id);

Expand Down

0 comments on commit 4937f93

Please sign in to comment.