src/core/object.h
changeset 2973 e8d8a0650927
parent 2965 4b28e9740e3b
parent 2924 70a02c24d5eb
child 3182 61fe7fe81ebd
--- a/src/core/object.h	Thu Apr 17 15:50:49 2008 -0700
+++ b/src/core/object.h	Mon Apr 21 08:05:34 2008 -0700
@@ -177,6 +177,8 @@
   friend Ptr<T> CreateObject (const AttributeList &attributes);
   template <typename T>
   friend Ptr<T> CopyObject (Ptr<T> object);
+  template <typename T>
+  friend Ptr<T> CopyObject (Ptr<const T> object);
 
   friend class ObjectFactory;
   friend class AggregateIterator;
@@ -244,8 +246,11 @@
  * and returns the new instance.
  */
 template <typename T>
+Ptr<T> CopyObject (Ptr<const T> object);
+template <typename T>
 Ptr<T> CopyObject (Ptr<T> object);
 
+
 /**
  * \param attributes a list of attributes to set on the 
  *        object during construction.
@@ -355,6 +360,14 @@
   return p;
 }
 
+template <typename T>
+Ptr<T> CopyObject (Ptr<const T> object)
+{
+  Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
+  NS_ASSERT (p->m_tid == object->m_tid);
+  return p;
+}
+
 
 template <typename T>
 Ptr<T> CreateObject (const AttributeList &attributes)