Internal change

PiperOrigin-RevId: 528560402
Change-Id: I97b538c7ed532f0850af90c2d076a80c614272b1
diff --git a/mpact/sim/generic/counters.h b/mpact/sim/generic/counters.h
index 2f9c2bd..bf5b7ff 100644
--- a/mpact/sim/generic/counters.h
+++ b/mpact/sim/generic/counters.h
@@ -86,6 +86,12 @@
   // to Initialize(..) is required before it can be added to a component.
   CounterValueOutputBase() : is_enabled_(false), is_initialized_(false) {}
   // Constructs and initializes the counter.
+  CounterValueOutputBase(std::string name, std::string about, const T initial)
+      : name_(std::move(name)),
+        about_(about),
+        is_enabled_(true),
+        is_initialized_(true),
+        value_(std::move(initial)) {}
   CounterValueOutputBase(std::string name, const T initial)
       : name_(std::move(name)),
         about_(),
@@ -198,8 +204,12 @@
 
   // Constructor and destructor.
   SimpleCounter() : CounterValueOutputBase<T>() {}
+  SimpleCounter(std::string name, std::string about, const T &initial)
+      : CounterValueOutputBase<T>(std::move(name), std::move(about), initial) {}
   SimpleCounter(std::string name, const T &initial)
       : CounterValueOutputBase<T>(std::move(name), initial) {}
+  SimpleCounter(std::string name, std::string about)
+      : SimpleCounter(std::move(name), std::move(about), T()) {}
   explicit SimpleCounter(std::string name)
       : SimpleCounter(std::move(name), T()) {}
   SimpleCounter &operator=(const SimpleCounter &) = delete;
diff --git a/mpact/sim/generic/test/counters_test.cc b/mpact/sim/generic/test/counters_test.cc
index b949ddf..045fe8d 100644
--- a/mpact/sim/generic/test/counters_test.cc
+++ b/mpact/sim/generic/test/counters_test.cc
@@ -97,7 +97,7 @@
 TEST(CountersTest, CounterBaseInterface) {
   std::string myname("this_is_a_name");
   char myname2[] = "this_is_also_a_name";
-  SimpleCounter<int64_t> counterone(myname);
+  SimpleCounter<int64_t> counterone(myname, "about this counter");
   SimpleCounter<int64_t> countertwo(myname2);
   SimpleCounter<int64_t> int64_counter(kSimpleCounterName);
   EXPECT_EQ(int64_counter.GetName(), kSimpleCounterName);
@@ -157,6 +157,10 @@
   CounterValue cv = int64_counter.GetCounterValue();
   EXPECT_EQ(std::get<int64_t>(cv), kMinusFive);
   EXPECT_EQ(int64_counter.ToString(), absl::StrCat(kMinusFive));
+  EXPECT_EQ(static_cast<mpact::sim::generic::CounterValueOutputBase<int64_t> *>(
+                &int64_counter)
+                ->ToString(),
+            absl::StrCat(kMinusFive));
 }
 
 // Tests the SetValue call in the input interface.
@@ -223,11 +227,13 @@
   }
   // Verify that the element count is the same as the vector size.
   EXPECT_EQ(count.GetValue(), values.size());
+  EXPECT_EQ(count.ToString(), absl::StrCat(values.size()));
 }
 
 // Tests export of counter values to proto message.
 TEST(CountersTest, ExportTest) {
-  SimpleCounter<uint64_t> uint64_counter(kUint64CounterName, kUint64Value);
+  SimpleCounter<uint64_t> uint64_counter(kUint64CounterName,
+                                         "About this counter", kUint64Value);
   SimpleCounter<int64_t> int64_counter(kInt64CounterName, kInt64Value);
   SimpleCounter<double> double_counter(kDoubleCounterName, kDoubleValue);