From 6eff31f3fcd653d54e56ad6fbf6ccd552dfcf11e Mon Sep 17 00:00:00 2001 From: Jonathan Guiang Date: Thu, 6 Jun 2024 10:48:59 -0700 Subject: [PATCH] added virtual clone function to Cut --- src/cutflow.cc | 5 +++++ src/cutflow.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/cutflow.cc b/src/cutflow.cc index 897e5d6..0cdf5c6 100755 --- a/src/cutflow.cc +++ b/src/cutflow.cc @@ -15,6 +15,11 @@ Cut::Cut(std::string new_name) Cut::~Cut() {} +virtual Cut* Cut::clone(std::string new_name) +{ + return new Cut(new_name); +} + void Cut::print() { std::cout << "---- " << name << " ----" << std::endl; diff --git a/src/cutflow.h b/src/cutflow.h index 0b2e390..aad5ca5 100755 --- a/src/cutflow.h +++ b/src/cutflow.h @@ -56,6 +56,13 @@ class Cut */ virtual ~Cut(); + /** + * Create a copy of this cut object + * @param new_name name of cut copy + * @return pointer to a copy of this cut object + */ + virtual Cut* clone(std::string new_name); + /** * Print cut object properties * @return none