Replaced ported prdfScanFacility.[HC]
The ScanFacility was just a bunch of wrapper functions for the
flyweights. I eliminated the wrappers by making singletons for each
flyweight.
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I8ff96f33da2d52e2c1abc3556d094dabcf441945
diff --git a/src/util/hei_flyweight.hpp b/src/util/hei_flyweight.hpp
index 45d6727..f308e3c 100644
--- a/src/util/hei_flyweight.hpp
+++ b/src/util/hei_flyweight.hpp
@@ -11,7 +11,7 @@
template <class T>
class Flyweight
{
- public:
+ private: // This class cannot be instantiated. Use getSingleton() instead.
/** @brief Default constructor. */
Flyweight() = default;
@@ -25,6 +25,15 @@
/** @brief Default assignment operator. */
Flyweight & operator=( const Flyweight & ) = delete;
+ public:
+
+ /** @brief Provides access to a singleton instance of this object. */
+ static Flyweight & getSingleton()
+ {
+ static Flyweight theFlyweight;
+ return theFlyweight;
+ }
+
/**
* @brief Adds the given entry to the factory, if it does not already
* exist. Then returns a reference to that entry in the factory.