Disabled copy contructor for ScomRegister and IdScomRegister

In general, these objects will be stored in the flyweights and once
created there shouldn't be copies made of them. Allowing the copy
constructor will allow something like 'SR sr = fw.get(...)' (note that
code used copy instead of assignment). Instead, that code should keep a
reference to the object in the flyweight like: 'SR & sr = fw.get(...)'.
Deleting the copy constructor forces this behavior.

The slight complication to this is that the flyweights need to use the
copy constructor in the get() function. So to work around this the
flyweights have been made a friend class in the associated register
classes so that it will have access to the private copy constructor.

Change-Id: I0e2f31a2bbf16b69e5210da8fefffd5bd51fcf6d
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index b781694..bebfb26 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <register/hei_hardware_register.hpp>
+#include <util/hei_flyweight.hpp>
 
 namespace libhei
 {
@@ -34,11 +35,16 @@
     /** @brief Destructor. */
     ~ScomRegister() = default;
 
+  private:
+
+    // This is needed to allow the flyweights to use the copy constructor, but
+    // not allow it to be used in general.
+    friend class Flyweight<ScomRegister>;
+
     /**
      * @brief Copy constructor.
      *
-     * Would prefer to delete this to prevent implicit copy assignments, but it
-     * is needed by the Flyweight class.
+     * Needed by Flyweight class, but should not be allowed in general.
      */
     ScomRegister( const ScomRegister & ) = default;
 
@@ -127,11 +133,16 @@
     /** @brief Destructor. */
     ~IdScomRegister() = default;
 
+  private:
+
+    // This is needed to allow the flyweights to use the copy constructor, but
+    // not allow it to be used in general.
+    friend class Flyweight<IdScomRegister>;
+
     /**
      * @brief Copy constructor.
      *
-     * Would prefer to delete this to prevent implicit copy assignments, but it
-     * is needed by the Flyweight class.
+     * Needed by Flyweight class, but should not be allowed in general.
      */
     IdScomRegister( const IdScomRegister & ) = default;