--- 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)