--- a/src/core/object.h Thu Apr 17 16:24:43 2008 -0700
+++ b/src/core/object.h Fri Apr 18 14:35:10 2008 -0700
@@ -137,6 +137,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;
@@ -203,8 +205,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.
@@ -314,6 +319,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)