Debugging NameInfo, FullState, and DiffState

Now NameInfo is thread-safe and has automatic garbage collector.
Internal container is managed by weak_ptr instead of shared_ptr as it
was before.
diff --git a/model/sync-ns3-name-info.cc b/model/sync-ns3-name-info.cc
index d1c8e31..9e0ef78 100644
--- a/model/sync-ns3-name-info.cc
+++ b/model/sync-ns3-name-info.cc
@@ -27,6 +27,7 @@
 
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/make_shared.hpp>
 #include <utility>
 
 using namespace std;
@@ -40,11 +41,17 @@
 {
   string key = lexical_cast<string> (*name);
 
-  NameInfoPtr value = NameInfoPtr (new Ns3NameInfo (name));
-  pair<NameMap::iterator,bool> item =
-    m_names.insert (make_pair (key, value));
+  NameMap::iterator item = m_names.find (key);
+  if (item == m_names.end ())
+    {
+      NameInfoPtr value = NameInfoPtr (new Ns3NameInfo (name));
+      pair<NameMap::iterator,bool> inserted =
+        m_names.insert (make_pair (key, value));
+      BOOST_ASSERT (inserted.second); // previous call has to insert value
+      item = inserted.first;
+    }
 
-  return item.first->second;
+  return item->second;
 }
 
 Ns3NameInfo::Ns3NameInfo (ns3::Ptr<const ns3::CcnxNameComponents> name)