Simplified and unified implementation of RocketfuelWeightReader
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index 1d3fd2f..7d26839 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -190,6 +190,8 @@
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
+    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## nstime.h (module 'core'): ns3::Time [class]
@@ -199,7 +201,7 @@
     ## nstime.h (module 'core'): ns3::Time [class]
     root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
     ## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
-    module.add_class('TopologyReader', import_from_module='ns.topology_read', parent=root_module['ns3::Object'])
+    module.add_class('TopologyReader', import_from_module='ns.topology_read', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
     ## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
     module.add_class('Link', import_from_module='ns.topology_read', outer_class=root_module['ns3::TopologyReader'])
     ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
@@ -297,7 +299,9 @@
     ## random-variable.h (module 'core'): ns3::RandomVariableValue [class]
     module.add_class('RandomVariableValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader [class]
-    module.add_class('RocketfuelWeightsReader', parent=root_module['ns3::TopologyReader'])
+    module.add_class('RocketfuelWeightsReader', parent=root_module['ns3::AnnotatedTopologyReader'])
+    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader [enumeration]
+    module.add_enum('', ['WEIGHTS', 'LATENCIES'], outer_class=root_module['ns3::RocketfuelWeightsReader'])
     ## nstime.h (module 'core'): ns3::TimeChecker [class]
     module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
     ## nstime.h (module 'core'): ns3::TimeValue [class]
@@ -414,6 +418,7 @@
     register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
     register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
     register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
+    register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
     register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
     register_Ns3Time_methods(root_module, root_module['ns3::Time'])
     register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
@@ -2920,6 +2925,18 @@
                    is_static=True)
     return
 
+def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
+    cls.add_constructor([])
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
+    cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
+    ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
+    cls.add_method('Cleanup', 
+                   'void', 
+                   [], 
+                   is_static=True)
+    return
+
 def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
     cls.add_constructor([])
@@ -3100,11 +3117,6 @@
                    'std::string', 
                    [], 
                    is_const=True)
-    ## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
     cls.add_method('LinksBegin', 
                    'std::_List_const_iterator< ns3::TopologyReader::Link >', 
@@ -3260,11 +3272,6 @@
     return
 
 def register_Ns3AnnotatedTopologyReader_methods(root_module, cls):
-    ## annotated-topology-reader.h (module 'NDNabstraction'): static ns3::TypeId ns3::AnnotatedTopologyReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::AnnotatedTopologyReader::AnnotatedTopologyReader(std::string const & path="") [constructor]
     cls.add_constructor([param('std::string const &', 'path', default_value='""')])
     ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::AnnotatedTopologyReader::Read() [member function]
@@ -3276,6 +3283,20 @@
     cls.add_method('AssignIpv4Addresses', 
                    'void', 
                    [param('ns3::Ipv4Address', 'base')])
+    ## annotated-topology-reader.h (module 'NDNabstraction'): void ns3::AnnotatedTopologyReader::SetBoundingBox(double ulx, double uly, double lrx, double lry) [member function]
+    cls.add_method('SetBoundingBox', 
+                   'void', 
+                   [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')])
+    ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name) [member function]
+    cls.add_method('CreateNode', 
+                   'ns3::Ptr< ns3::Node >', 
+                   [param('std::string const', 'name')], 
+                   visibility='protected')
+    ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name, double posX, double posY) [member function]
+    cls.add_method('CreateNode', 
+                   'ns3::Ptr< ns3::Node >', 
+                   [param('std::string const', 'name'), param('double', 'posX'), param('double', 'posY')], 
+                   visibility='protected')
     return
 
 def register_Ns3Application_methods(root_module, cls):
@@ -4864,26 +4885,17 @@
     return
 
 def register_Ns3RocketfuelWeightsReader_methods(root_module, cls):
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): static ns3::TypeId ns3::RocketfuelWeightsReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader::RocketfuelWeightsReader() [constructor]
     cls.add_constructor([])
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::RocketfuelWeightsReader::Read(std::string latenciesFile) [member function]
-    cls.add_method('Read', 
-                   'ns3::NodeContainer', 
-                   [param('std::string', 'latenciesFile')])
+    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): void ns3::RocketfuelWeightsReader::SetFileType(uint8_t inputType) [member function]
+    cls.add_method('SetFileType', 
+                   'void', 
+                   [param('uint8_t', 'inputType')])
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::RocketfuelWeightsReader::Read() [member function]
     cls.add_method('Read', 
                    'ns3::NodeContainer', 
                    [], 
                    is_virtual=True)
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): void ns3::RocketfuelWeightsReader::ApplySettings(ns3::NetDeviceContainer * ndc, ns3::NodeContainer * nc) [member function]
-    cls.add_method('ApplySettings', 
-                   'void', 
-                   [param('ns3::NetDeviceContainer *', 'ndc'), param('ns3::NodeContainer *', 'nc')])
     return
 
 def register_Ns3TimeChecker_methods(root_module, cls):
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index 1d3fd2f..7d26839 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -190,6 +190,8 @@
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > [class]
+    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TopologyReader', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
     module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
     ## nstime.h (module 'core'): ns3::Time [class]
@@ -199,7 +201,7 @@
     ## nstime.h (module 'core'): ns3::Time [class]
     root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t'])
     ## topology-reader.h (module 'topology-read'): ns3::TopologyReader [class]
-    module.add_class('TopologyReader', import_from_module='ns.topology_read', parent=root_module['ns3::Object'])
+    module.add_class('TopologyReader', import_from_module='ns.topology_read', parent=root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
     ## topology-reader.h (module 'topology-read'): ns3::TopologyReader::Link [class]
     module.add_class('Link', import_from_module='ns.topology_read', outer_class=root_module['ns3::TopologyReader'])
     ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
@@ -297,7 +299,9 @@
     ## random-variable.h (module 'core'): ns3::RandomVariableValue [class]
     module.add_class('RandomVariableValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader [class]
-    module.add_class('RocketfuelWeightsReader', parent=root_module['ns3::TopologyReader'])
+    module.add_class('RocketfuelWeightsReader', parent=root_module['ns3::AnnotatedTopologyReader'])
+    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader [enumeration]
+    module.add_enum('', ['WEIGHTS', 'LATENCIES'], outer_class=root_module['ns3::RocketfuelWeightsReader'])
     ## nstime.h (module 'core'): ns3::TimeChecker [class]
     module.add_class('TimeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
     ## nstime.h (module 'core'): ns3::TimeValue [class]
@@ -414,6 +418,7 @@
     register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
     register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
     register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
+    register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
     register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
     register_Ns3Time_methods(root_module, root_module['ns3::Time'])
     register_Ns3TopologyReader_methods(root_module, root_module['ns3::TopologyReader'])
@@ -2920,6 +2925,18 @@
                    is_static=True)
     return
 
+def register_Ns3SimpleRefCount__Ns3TopologyReader_Ns3Empty_Ns3DefaultDeleter__lt__ns3TopologyReader__gt___methods(root_module, cls):
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount() [constructor]
+    cls.add_constructor([])
+    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> > const & o) [copy constructor]
+    cls.add_constructor([param('ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter< ns3::TopologyReader > > const &', 'o')])
+    ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount<ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >::Cleanup() [member function]
+    cls.add_method('Cleanup', 
+                   'void', 
+                   [], 
+                   is_static=True)
+    return
+
 def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
     ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
     cls.add_constructor([])
@@ -3100,11 +3117,6 @@
                    'std::string', 
                    [], 
                    is_const=True)
-    ## topology-reader.h (module 'topology-read'): static ns3::TypeId ns3::TopologyReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## topology-reader.h (module 'topology-read'): std::_List_const_iterator<ns3::TopologyReader::Link> ns3::TopologyReader::LinksBegin() const [member function]
     cls.add_method('LinksBegin', 
                    'std::_List_const_iterator< ns3::TopologyReader::Link >', 
@@ -3260,11 +3272,6 @@
     return
 
 def register_Ns3AnnotatedTopologyReader_methods(root_module, cls):
-    ## annotated-topology-reader.h (module 'NDNabstraction'): static ns3::TypeId ns3::AnnotatedTopologyReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::AnnotatedTopologyReader::AnnotatedTopologyReader(std::string const & path="") [constructor]
     cls.add_constructor([param('std::string const &', 'path', default_value='""')])
     ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::AnnotatedTopologyReader::Read() [member function]
@@ -3276,6 +3283,20 @@
     cls.add_method('AssignIpv4Addresses', 
                    'void', 
                    [param('ns3::Ipv4Address', 'base')])
+    ## annotated-topology-reader.h (module 'NDNabstraction'): void ns3::AnnotatedTopologyReader::SetBoundingBox(double ulx, double uly, double lrx, double lry) [member function]
+    cls.add_method('SetBoundingBox', 
+                   'void', 
+                   [param('double', 'ulx'), param('double', 'uly'), param('double', 'lrx'), param('double', 'lry')])
+    ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name) [member function]
+    cls.add_method('CreateNode', 
+                   'ns3::Ptr< ns3::Node >', 
+                   [param('std::string const', 'name')], 
+                   visibility='protected')
+    ## annotated-topology-reader.h (module 'NDNabstraction'): ns3::Ptr<ns3::Node> ns3::AnnotatedTopologyReader::CreateNode(std::string const name, double posX, double posY) [member function]
+    cls.add_method('CreateNode', 
+                   'ns3::Ptr< ns3::Node >', 
+                   [param('std::string const', 'name'), param('double', 'posX'), param('double', 'posY')], 
+                   visibility='protected')
     return
 
 def register_Ns3Application_methods(root_module, cls):
@@ -4864,26 +4885,17 @@
     return
 
 def register_Ns3RocketfuelWeightsReader_methods(root_module, cls):
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): static ns3::TypeId ns3::RocketfuelWeightsReader::GetTypeId() [member function]
-    cls.add_method('GetTypeId', 
-                   'ns3::TypeId', 
-                   [], 
-                   is_static=True)
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::RocketfuelWeightsReader::RocketfuelWeightsReader() [constructor]
     cls.add_constructor([])
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::RocketfuelWeightsReader::Read(std::string latenciesFile) [member function]
-    cls.add_method('Read', 
-                   'ns3::NodeContainer', 
-                   [param('std::string', 'latenciesFile')])
+    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): void ns3::RocketfuelWeightsReader::SetFileType(uint8_t inputType) [member function]
+    cls.add_method('SetFileType', 
+                   'void', 
+                   [param('uint8_t', 'inputType')])
     ## rocketfuel-weights-reader.h (module 'NDNabstraction'): ns3::NodeContainer ns3::RocketfuelWeightsReader::Read() [member function]
     cls.add_method('Read', 
                    'ns3::NodeContainer', 
                    [], 
                    is_virtual=True)
-    ## rocketfuel-weights-reader.h (module 'NDNabstraction'): void ns3::RocketfuelWeightsReader::ApplySettings(ns3::NetDeviceContainer * ndc, ns3::NodeContainer * nc) [member function]
-    cls.add_method('ApplySettings', 
-                   'void', 
-                   [param('ns3::NetDeviceContainer *', 'ndc'), param('ns3::NodeContainer *', 'nc')])
     return
 
 def register_Ns3TimeChecker_methods(root_module, cls):
diff --git a/examples/sprint-topology.cc b/examples/sprint-topology.cc
index ba3d484..5efffeb 100644
--- a/examples/sprint-topology.cc
+++ b/examples/sprint-topology.cc
@@ -30,7 +30,6 @@
 #include <sstream>
 #include "ns3/rocketfuel-topology-reader.h"
 
-
 using namespace ns3;
 
 NS_LOG_COMPONENT_DEFINE ("CcnxSprintTopology");
@@ -40,43 +39,31 @@
 {
     Packet::EnableChecking();
     Packet::EnablePrinting();
-    std::string input ("./src/NDNabstraction/examples/sprint.weights");
+    std::string weights ("./src/NDNabstraction/examples/sprint.weights");
+    std::string latencies ("./src/NDNabstraction/examples/sprint.latencies");
     
     // ------------------------------------------------------------
     // -- Read topology data.
     // --------------------------------------------
     
-    Ptr<RocketfuelWeightsReader> reader = CreateObject<RocketfuelWeightsReader> ();
-    reader->SetFileName (input);
+    RocketfuelWeightsReader reader;
+
+    reader.SetFileName (weights);
+    reader.SetFileType (RocketfuelWeightsReader::WEIGHTS);    
+    NodeContainer nodes = reader.Read ();
+
+    reader.SetFileName (latencies);
+    reader.SetFileType (RocketfuelWeightsReader::LATENCIES);    
+    reader.Read ();
     
-    NodeContainer nodes;
-    if (reader != 0)
-    {
-        nodes = reader->Read ("./src/NDNabstraction/examples/sprint.latencies");
-    }
-    
-    if (reader->LinksSize () == 0)
+    if (reader.LinksSize () == 0)
     {
         NS_LOG_ERROR ("Problems reading the topology file. Failing.");
         return -1;
     }
     
     NS_LOG_INFO("Nodes = " << nodes.GetN());
-    NS_LOG_INFO("Links = " << reader->LinksSize ());
-    
-    int totlinks = reader->LinksSize ();
-    ///*** applying settings
-    NS_LOG_INFO ("creating node containers");
-    NodeContainer* nc = new NodeContainer[totlinks];
-    TopologyReader::ConstLinksIterator iter;
-    int i = 0;
-    for ( iter = reader->LinksBegin (); iter != reader->LinksEnd (); iter++, i++ )
-    {
-        nc[i] = NodeContainer (iter->GetFromNode (), iter->GetToNode ());
-    }
-    
-    NetDeviceContainer* ndc = new NetDeviceContainer[totlinks];
-    reader->ApplySettings(ndc,nc);
+    NS_LOG_INFO("Links = " << reader.LinksSize ());
     
     NS_LOG_INFO ("Run Simulation.");
     Simulator::Run ();
diff --git a/model/annotated-topology-reader.cc b/model/annotated-topology-reader.cc
index 76880a5..eb56339 100644
--- a/model/annotated-topology-reader.cc
+++ b/model/annotated-topology-reader.cc
@@ -39,7 +39,6 @@
 #include "ns3/ipv4-address.h"
 
 #include "ns3/constant-position-mobility-model.h"
-#include "ns3/random-variable.h"
 
 #include <boost/foreach.hpp>
 #include <boost/lexical_cast.hpp>
@@ -53,42 +52,48 @@
 
 NS_LOG_COMPONENT_DEFINE ("AnnotatedTopologyReader");
     
-NS_OBJECT_ENSURE_REGISTERED (AnnotatedTopologyReader);
-    
-TypeId AnnotatedTopologyReader::GetTypeId (void)
-{
-  static TypeId tid = TypeId ("ns3::AnnotatedTopologyReader")
-    .SetParent<Object> ()
-    ;
-  return tid;
-}
-    
 AnnotatedTopologyReader::AnnotatedTopologyReader (const std::string &path)
   : m_path (path)
-  // , m_ulx (0)
-  // , m_uly (0)
-  // , m_lrx (100.0)
-  // , m_lry (100.0)
+  , m_randX (0, 100.0)
+  , m_randY (0, 100.0)
 {
   NS_LOG_FUNCTION (this);
 }
     
-// void
-// AnnotatedTopologyReader::SetBoundingBox (double ulx, double uly, double lrx, double lry)
-// {
-//   NS_LOG_FUNCTION (this << ulx << uly << lrx << lry);
+void
+AnnotatedTopologyReader::SetBoundingBox (double ulx, double uly, double lrx, double lry)
+{
+  NS_LOG_FUNCTION (this << ulx << uly << lrx << lry);
   
-//   m_ulx = ulx;
-//   m_uly = uly;
-//   m_lrx = lrx;
-//   m_lry = lry;
-// }
+  m_randX = UniformVariable (ulx, lrx);
+  m_randY = UniformVariable (uly, lry);
+}
 
 AnnotatedTopologyReader::~AnnotatedTopologyReader ()
 {
   NS_LOG_FUNCTION (this);
 }
 
+Ptr<Node>
+AnnotatedTopologyReader::CreateNode (const std::string name)
+{
+  return CreateNode (name, m_randX.GetValue (), m_randX.GetValue ());
+}
+
+Ptr<Node>
+AnnotatedTopologyReader::CreateNode (const std::string name, double posX, double posY)
+{
+  Ptr<Node> node = CreateObject<Node> ();
+  Ptr<ConstantPositionMobilityModel> loc = CreateObject<ConstantPositionMobilityModel> ();
+  node->AggregateObject (loc);
+
+  loc->SetPosition (Vector (posX, posY, 0));
+
+  Names::Add (m_path, name, node);
+
+  return node;
+}
+
 NodeContainer
 AnnotatedTopologyReader::Read (void)
 {
@@ -102,9 +107,6 @@
       return nodes;
     }
 
-  uint32_t linksNumber = 0;
-  uint32_t nodesNumber = 0;
-
   while (!topgen.eof ())
     {
       string line;
@@ -125,15 +127,8 @@
       double latitude, longitude;
 
       lineBuffer >> name >> city >> latitude >> longitude;
-      Ptr<Node> node = CreateObject<Node> ();
-      Ptr<ConstantPositionMobilityModel> loc = CreateObject<ConstantPositionMobilityModel> ();
-      node->AggregateObject (loc);
-
-      loc->SetPosition (Vector (2*longitude, -2*latitude, 0));
-
-      Names::Add (m_path, name, node);
+      Ptr<Node> node = CreateNode (name, 2*longitude, -2*latitude);
       nodes.Add (node);
-      nodesNumber++;
     }
 
   map<string, set<string> > processedLinks; // to eliminate duplications
@@ -175,11 +170,9 @@
 
       AddLink (link);
       NS_LOG_DEBUG ("New link " << from << " <==> " << to << " / " << capacity << "Kbps with " << metric << " metric");
-                
-      linksNumber++;
     }
         
-  NS_LOG_INFO ("Annotated topology created with " << nodesNumber << " nodes and " << linksNumber << " links");
+  NS_LOG_INFO ("Annotated topology created with " << nodes.GetN () << " nodes and " << LinksSize () << " links");
   topgen.close ();
         
   ApplySettings ();
diff --git a/model/annotated-topology-reader.h b/model/annotated-topology-reader.h
index d97209b..06bbe2a 100644
--- a/model/annotated-topology-reader.h
+++ b/model/annotated-topology-reader.h
@@ -22,23 +22,18 @@
 #define __ANNOTATED_TOPOLOGY_READER_H__
 
 #include "ns3/topology-reader.h"
+#include "ns3/random-variable.h"
 
 namespace ns3 
 {
     
 /**
-* \brief This class reads annotated topology and apply settings to the corresponding nodes and links
-* Input File Format
-* 1st line is     NumberOfNodes    TAB     NumberofLinks
-* Nth line is     NodeID1  TAB    NodeID2   TAB  DataRateKBPS TAB OSPF   TAB    DelayMiliseconds   TAB   QueueSizeInPacketsNode1     TAB    QueueSizeInPacketsNode2    TAB    X-coordinate-node1     TAB    Y-coordinate-node1  TAB    X-coordinate-node2     TAB    Y-coordinate-node2
-*
-*/
+ * \brief This class reads annotated topology and apply settings to the corresponding nodes and links
+ *
+ */
 class AnnotatedTopologyReader : public TopologyReader
 {
 public:
-    typedef std::list< Link >::iterator LinksIterator;
-    static TypeId GetTypeId (void);
-        
   /**
    * \brief Constructor
    *
@@ -47,24 +42,18 @@
    * \see ns3::Names class
    */
   AnnotatedTopologyReader (const std::string &path="");
-    virtual ~AnnotatedTopologyReader ();
+  virtual ~AnnotatedTopologyReader ();
         
-    /**
-    * \brief Main annotated topology reading function.
-    *
-    * This method opens an input stream and reads topology file with annotations.
-    *
-    * \return the container of the nodes created (or empty container if there was an error)
-    */
+  /**
+   * \brief Main annotated topology reading function.
+   *
+   * This method opens an input stream and reads topology file with annotations.
+   *
+   * \return the container of the nodes created (or empty container if there was an error)
+   */
   virtual
   NodeContainer Read (void);
     
-  // /**
-  //  * \brief Set bounding box for the nodes
-  //  */
-  // void
-  // SetBoundingBox (double ulx, double uly, double lrx, double lry);
-
   /**
    * \brief Assign IPv4 addresses to all links
    *
@@ -76,28 +65,38 @@
    */
   void
   AssignIpv4Addresses (Ipv4Address base);
+
+  void
+  SetBoundingBox (double ulx, double uly, double lrx, double lry);
+
+protected:
+  Ptr<Node>
+  CreateNode (const std::string name);
+
+  Ptr<Node>
+  CreateNode (const std::string name, double posX, double posY);
   
 private:
   /**
-     * \brief This method applies setting to corresponding nodes and links
-     * NetDeviceContainer must be allocated
-     * NodeContainer from Read method
-     */
+   * \brief This method applies setting to corresponding nodes and links
+   * NetDeviceContainer must be allocated
+   * NodeContainer from Read method
+   */
   void ApplySettings ();
   void ApplyOspfMetric ();
     
+protected:
+  std::string m_path;
+
 private:
   AnnotatedTopologyReader (const AnnotatedTopologyReader&);
   AnnotatedTopologyReader& operator= (const AnnotatedTopologyReader&);
 
-  std::string m_path;
-  // double m_ulx;
-  // double m_uly;
-  // double m_lrx;
-  // double m_lry;
+  UniformVariable m_randX;
+  UniformVariable m_randY;
 };
-}
 
+}
 
 #endif
 
diff --git a/model/rocketfuel-weights-reader.cc b/model/rocketfuel-weights-reader.cc
index 246d1b0..ac7f6b1 100644
--- a/model/rocketfuel-weights-reader.cc
+++ b/model/rocketfuel-weights-reader.cc
@@ -50,518 +50,114 @@
 #include <iomanip>
 #include <set>
 
+using namespace std;
+
+NS_LOG_COMPONENT_DEFINE ("RocketfuelWeightsReader");
 
 namespace ns3 {
     
-    NS_LOG_COMPONENT_DEFINE ("RocketfuelWeightsReader");
-    
-    NS_OBJECT_ENSURE_REGISTERED (RocketfuelWeightsReader);
-    
-    TypeId RocketfuelWeightsReader::GetTypeId (void)
-    {
-        static TypeId tid = TypeId ("ns3::RocketfuelWeightsReader")
-        .SetParent<Object> ()
-        ;
-        return tid;
-    }
-    
-    RocketfuelWeightsReader::RocketfuelWeightsReader ()
-    {
-        NS_LOG_FUNCTION (this);
-    }
-    
-    RocketfuelWeightsReader::~RocketfuelWeightsReader ()
-    {
-        NS_LOG_FUNCTION (this);
-    }
-    
-    /* uid @loc [+] [bb] (num_neigh) [&ext] -> <nuid-1> <nuid-2> ... {-euid} ... =name[!] rn */
-    
-#define REGMATCH_MAX 16
-    
-#define START "^"
-#define END "$"
-#define SPACE "[ \t]+"
-#define MAYSPACE "[ \t]*"
-    
-#define ROCKETFUEL_MAPS_LINE \
-START "(-*[0-9]+)" SPACE "(@[?A-Za-z0-9,+]+)" SPACE \
-"(\\+)*" MAYSPACE "(bb)*" MAYSPACE \
-"\\(([0-9]+)\\)" SPACE "(&[0-9]+)*" MAYSPACE \
-"->" MAYSPACE "(<[0-9 \t<>]+>)*" MAYSPACE \
-"(\\{-[0-9\\{\\} \t-]+\\})*" SPACE \
-"=([A-Za-z0-9.!-]+)" SPACE "r([0-9])" \
-MAYSPACE END
-    
-#define ROCKETFUEL_WEIGHTS_LINE \
-START "([^ \t]+)" SPACE "([^ \t]+)" SPACE "([0-9.]+)" MAYSPACE END
-    
-    int linksNumber = 0;
-    int nodesNumber = 0;
-    std::map<std::string, Ptr<Node> > nodeMap;
-    
-    NodeContainer
-    RocketfuelWeightsReader::GenerateFromWeightsFile (int argc, char *argv[], char *argl[])
-    {
-        /* uid @loc [+] [bb] (num_neigh) [&ext] -> <nuid-1> <nuid-2> ... {-euid} ... =name[!] rn */
-        std::string sname;
-        std::string tname;
-        char *endptr;
-        NodeContainer nodes;
-        
-        sname = argv[0];
-        tname = argv[1];
-        double v = strtod (argv[2], &endptr); // weight
-        double l = strtod (argl[2], &endptr); //latency
-        // cast v to void , to suppress 'v' set but not used compiler warning
-        //(void) v;
-        
-        
-        
-        if (*endptr != '\0')
-        {
-            NS_LOG_WARN ("invalid weight: " << argv[2]);
-            return nodes;
-        }
-        
-        // Create node and link
-        if (!sname.empty () && !tname.empty ())
-        {
-            if (nodeMap[sname] == 0)
-            {
-                Ptr<Node> tmpNode = CreateObject<Node> ();
-                nodeMap[sname] = tmpNode;
-                nodes.Add (tmpNode);
-                nodesNumber++;
-            }
-            
-            if (nodeMap[tname] == 0)
-            {
-                Ptr<Node> tmpNode = CreateObject<Node> ();
-                nodeMap[tname] = tmpNode;
-                nodes.Add (tmpNode);
-                nodesNumber++;
-            }
-            NS_LOG_INFO (linksNumber << ":" << nodesNumber << " From: " << sname << " to: " << tname);
-            TopologyReader::ConstLinksIterator iter;
-            bool found = false;
-            for (iter = LinksBegin (); iter != LinksEnd (); iter++)
-            {
-                if ((iter->GetFromNode () == nodeMap[tname])
-                    && (iter->GetToNode () == nodeMap[sname]))
-                {
-                    found = true;
-                    break;
-                }
-            }
-            
-            if (!found)
-            {
-                Link link (nodeMap[sname], sname, nodeMap[tname], tname);
-                
-                std::ostringstream s;
-                s << std::setprecision(2) << v;
-                std::string ss = s.str();
-                link.SetAttribute ("OSPF", ss);
-                
-                std::ostringstream s2;
-                s2 << std::setprecision(2) << l;
-                std::string ss2 = s2.str();
-                link.SetAttribute("Latency", ss2);
-                NS_LOG_INFO("Written Latency = " << ss2);
-                
-                
-                AddLink (link);
-                linksNumber++;
-            }
-        }
-        return nodes;
-    }
-    
-    enum RocketfuelWeightsReader::RF_FileType
-    RocketfuelWeightsReader::GetFileType (const char *line)
-    {
-        int ret;
-        regmatch_t regmatch[REGMATCH_MAX];
-        regex_t regex;
-        char errbuf[512];
-        
-        // Check whether MAPS file or not
-        ret = regcomp (&regex, ROCKETFUEL_MAPS_LINE, REG_EXTENDED | REG_NEWLINE);
-        if (ret != 0)
-        {
-            regerror (ret, &regex, errbuf, sizeof (errbuf));
-            return RF_UNKNOWN;
-        }
-        ret = regexec (&regex, line, REGMATCH_MAX, regmatch, 0);
-        if (ret != REG_NOMATCH)
-        {
-            regfree (&regex);
-            return RF_MAPS;
-        }
-        regfree (&regex);
-        
-        // Check whether Weights file or not
-        ret = regcomp (&regex, ROCKETFUEL_WEIGHTS_LINE, REG_EXTENDED | REG_NEWLINE);
-        if (ret != 0)
-        {
-            regerror (ret, &regex, errbuf, sizeof (errbuf));
-            return RF_UNKNOWN;
-        }
-        ret = regexec (&regex, line, REGMATCH_MAX, regmatch, 0);
-        if (ret != REG_NOMATCH)
-        {
-            regfree (&regex);
-            return RF_WEIGHTS;
-        }
-        regfree (&regex);
-        
-        return RF_UNKNOWN;
-    }
-    
-    NodeContainer
-    RocketfuelWeightsReader::Read (void)
-    {
-        NodeContainer nodes;
-        NS_LOG_INFO("Not implemented");
-        return nodes;
-    }
-    
-    NodeContainer
-    RocketfuelWeightsReader::Read (std::string latenciesFile)
-    {
-        std::ifstream topgen;
-        topgen.open (GetFileName ().c_str ());
-        NodeContainer nodes;
-        
-        std::ifstream latencies;
-        latencies.open(latenciesFile.c_str());
-        
-        std::istringstream lineBuffer;
-        std::istringstream lineBuffer2;
-        std::string line;
-        std::string line2;
-        
-        int lineNumber = 0;
-        enum RF_FileType ftype = RF_UNKNOWN;
-        char errbuf[512];
-        
-        if (!topgen.is_open ())
-        {
-            NS_LOG_WARN ("Couldn't open the file " << GetFileName ());
-            return nodes;
-        }
-        
-        if (!latencies.is_open ())
-        {
-            NS_LOG_WARN ("Couldn't open Latencies file " << latenciesFile);
-            return nodes;
-        }
-        
-        while (!topgen.eof ())
-        {
-            int ret;
-            int argc;
-            char *argv[REGMATCH_MAX];
-            char *argl[REGMATCH_MAX];
-            char *buf;
-            char *buf2;
-            
-            lineNumber++;
-            line.clear ();
-            line2.clear ();
-            lineBuffer.clear ();
-            lineBuffer2.clear ();
-            
-            getline (topgen, line);
-            getline (latencies, line2);
-            buf = (char *)line.c_str ();
-            buf2 = (char *)line2.c_str ();
-            
-            if (lineNumber == 1)
-            {
-                ftype = GetFileType (buf);
-                if (ftype == RF_UNKNOWN)
-                {
-                    NS_LOG_INFO ("Unknown File Format (" << GetFileName () << ")");
-                    break;
-                }
-            }
-            
-            regmatch_t regmatch[REGMATCH_MAX];
-            regex_t regex;
-            
-            if (ftype == RF_MAPS)
-            {
-                ret = regcomp (&regex, ROCKETFUEL_MAPS_LINE, REG_EXTENDED | REG_NEWLINE);
-                if (ret != 0)
-                {
-                    regerror (ret, &regex, errbuf, sizeof (errbuf));
-                    regfree (&regex);
-                    break;
-                }
-                
-                ret = regexec (&regex, buf, REGMATCH_MAX, regmatch, 0);
-                if (ret == REG_NOMATCH)
-                {
-                    NS_LOG_WARN ("match failed (maps file): %s" << buf);
-                    regfree (&regex);
-                    break;
-                }
-            }
-            else if (ftype == RF_WEIGHTS)
-            {
-                ret = regcomp (&regex, ROCKETFUEL_WEIGHTS_LINE, REG_EXTENDED | REG_NEWLINE);
-                if (ret != 0)
-                {
-                    regerror (ret, &regex, errbuf, sizeof (errbuf));
-                    regfree (&regex);
-                    break;
-                }
-                
-                ret = regexec (&regex, buf, REGMATCH_MAX, regmatch, 0);
-                regexec (&regex, buf2, REGMATCH_MAX, regmatch, 0);
-                if (ret == REG_NOMATCH)
-                {
-                    NS_LOG_WARN ("match failed (weights file): %s" << buf);
-                    regfree (&regex);
-                    break;
-                }
-            }
-            
-            line = buf;
-            line2 = buf2;
-            argc = 0;
-            
-            /* regmatch[0] is the entire strings that matched */
-            for (int i = 1; i < REGMATCH_MAX; i++)
-            {
-                if (regmatch[i].rm_so == -1)
-                {
-                    argv[i - 1] = NULL;
-                    argl[i - 1] = NULL;
-                }
-                else
-                {
-                    line[regmatch[i].rm_eo] = '\0';
-                    line2[regmatch[i].rm_eo] = '\0';
-                    argv[i - 1] = &line[regmatch[i].rm_so];
-                    argl[i - 1] = &line2[regmatch[i].rm_so];
-                    argc = i;
-                }
-            }
-            
-            if (ftype == RF_MAPS)
-            {
-                NS_LOG_INFO("MAPS FILE is not supported");
-                //nodes.Add (GenerateFromMapsFile (argc, argv));
-            }
-            else if (ftype == RF_WEIGHTS)
-            {
-                nodes.Add (GenerateFromWeightsFile (argc, argv, argl));
-            }
-            else
-            {
-                NS_LOG_WARN ("Unsupported file format (only Maps/Weights are supported)");
-            }
-            
-            regfree (&regex);
-        }
-        
-        
-        topgen.close ();
-        latencies.close ();
-        NS_LOG_INFO ("Rocketfuel topology created with " << nodesNumber << " nodes and " << linksNumber << " links");
-        return nodes;
-    }
-    
-    
-void
-RocketfuelWeightsReader::ApplySettings(NetDeviceContainer* ndc, NodeContainer* nc)
+RocketfuelWeightsReader::RocketfuelWeightsReader ()
 {
-  InternetStackHelper stack;
-  Ipv4AddressHelper address;
-  address.SetBase ("10.1.0.0", "255.255.0.0");
-        
-  Ipv4GlobalRoutingHelper ipv4RoutingHelper ("ns3::Ipv4GlobalRoutingOrderedNexthops");
-  stack.SetRoutingHelper (ipv4RoutingHelper);
-        
-  //This loop passes all links and checks if ipv4 is installed on the node
-  // if not, it installs. 
-  // We can't use stack.Install(nc) because in nc there are duplicates and assertion fails
-        TopologyReader::ConstLinksIterator iter;
-        int j = 0;
-        for ( iter = this->LinksBegin (); iter != this->LinksEnd (); iter++, j++ )
-        {
-            NodeContainer twoNodes = nc[j];
-            
-            Ptr<Node> nd = twoNodes.Get(0);
-            if(nd==NULL)
-                NS_LOG_INFO("nd = null");
-            
-            Ptr<Node> nd2 = twoNodes.Get(1);
-            if(nd2==NULL)
-                NS_LOG_INFO("nd2 = null");
-            
-            Ptr<Ipv4> ipv4 = nd->GetObject<Ipv4>();
-            if(ipv4 == 0)
-            {
-                NS_LOG_INFO("ipv4 = null");
-                stack.Install(nd);
-            }
-            
-            Ptr<Ipv4> ipv42 = nd2->GetObject<Ipv4>();
-            if(ipv42 == 0)
-            {
-                NS_LOG_INFO("ipv42 = null");
-                stack.Install(nd2);
-            }
-            
-            //NS_LOG_INFO("#netdevices = " << nd->GetNDevices());
-            //NS_LOG_INFO("#netdevices = " << nd2->GetNDevices());
-        }
-        
-        NS_LOG_INFO("ITER2");
-        
-        PointToPointHelper p2p;
-        TopologyReader::ConstLinksIterator iter2;
-        int i = 0;
-        for ( iter2 = this->LinksBegin (); iter2 != this->LinksEnd (); iter2++, i++ )
-        {
-            p2p.SetDeviceAttribute("DataRate", StringValue("9920000Kbps"));
-            //p2p.SetChannelAttribute("Delay", StringValue("10ms"));
-            NS_LOG_INFO("Latency = " + iter2->GetAttribute("Latency")+"ms");
-            p2p.SetChannelAttribute("Delay", StringValue(iter2->GetAttribute("Latency")+"ms"));
-            
+  NS_LOG_FUNCTION (this);
+}
+    
+RocketfuelWeightsReader::~RocketfuelWeightsReader ()
+{
+  NS_LOG_FUNCTION (this);
+}
 
-            p2p.SetQueue("ns3::DropTailQueue","MaxPackets",StringValue("100"));
-            ndc[i] = p2p.Install(nc[i]);
-            
-            
-            NodeContainer twoNodes = nc[i];
-            
-            Ptr<Node> nd = twoNodes.Get(0);
-            if(nd==NULL)
-                NS_LOG_INFO("nd = null");
-            
-            
-            
-            Ptr<Node> nd2 = twoNodes.Get(1);
-            if(nd2==NULL)
-                NS_LOG_INFO("nd2 = null");
-            
-            //NS_LOG_INFO("1");
-            NS_LOG_INFO("#netdevices = " << nd->GetNDevices());
-            NS_LOG_INFO("#netdevices = " << nd2->GetNDevices());
-            
-            Ptr<NetDevice> device = nd->GetDevice(nd->GetNDevices()-1)->GetObject<PointToPointNetDevice> ();
-            
-            if(device==NULL)
-                NS_LOG_INFO("device = 0");
-            
-            std::string ospf = iter2->GetAttribute("OSPF");
-            double metric_d = atof(ospf.c_str());
-            uint16_t metric = static_cast<int>(metric_d * 10); 
-            NS_LOG_INFO("OSPF metric = " << metric);
-            
-            {
-                NetDeviceContainer* temp = new NetDeviceContainer[1];
-                temp->Add(device);
-                address.Assign (*temp);
-            }
-            
-            Ptr<Ipv4> ipv4 = nd->GetObject<Ipv4>();
-            if(ipv4 == 0)
-            {
-                NS_LOG_INFO("ipv4 = null");
-                //stack.Install(nd);
-                /*NetDeviceContainer* temp = new NetDeviceContainer[1];
-                 temp->Add(device);
-                 address.Assign (*temp);
-                 ipv4 = nd->GetObject<Ipv4>();*/
-            }
-            
-            NS_LOG_INFO("Before GetID");
-            int32_t interfaceId = ipv4->GetInterfaceForDevice(device);
-            NS_LOG_INFO("InterfaceID = " << interfaceId);
-            ipv4->SetMetric(interfaceId,metric);
-            
-            
-            
-            
-            
-            /*Ptr<Ipv4> ipv4 = nd->GetObject<Ipv4>();
-             
-             if(ipv4 == 0)
-             NS_LOG_INFO("ipv4 = null");
-             int32_t interfaceId = ipv4->GetInterfaceForDevice(device);
-             ipv4->SetMetric(interfaceId,metric);*/
-            
-            //Ptr<Ipv4Interface> interface = nd->GetDevice(nd->GetNDevices()-1)->GetObject<Ipv4Interface> ();
-            //ipv4->SetMetric(metric);
-            
-            //NS_LOG_INFO("2");
-            
-            Ptr<NetDevice> device2 = nd2->GetDevice(nd2->GetNDevices()-1)->GetObject<PointToPointNetDevice> ();
-            
-            if(device2==NULL)
-                NS_LOG_INFO("device2 = 0");
-            
-            {
-                NetDeviceContainer* temp = new NetDeviceContainer[1];
-                temp->Add(device2);
-                address.Assign (*temp);
-            }
-            
-            Ptr<Ipv4> ipv42 = nd2->GetObject<Ipv4>();
-            if(ipv42 == 0)
-            {
-                NS_LOG_INFO("ipv42 = null");
-                /*stack.Install(nd2);
-                 NetDeviceContainer* temp = new NetDeviceContainer[1];
-                 temp->Add(device2);
-                 address.Assign (*temp);
-                 ipv42 = nd2->GetObject<Ipv4>();*/
-            }
-            
-            NS_LOG_INFO("Before GetID");
-            interfaceId = ipv42->GetInterfaceForDevice(device2);
-            NS_LOG_INFO("InterfaceID = " << interfaceId);
-            ipv42->SetMetric(interfaceId,metric);
-            
-            
-            
-            /*PointerValue tmp1;
-            device->GetAttribute ("TxQueue", tmp1);
-            //NS_LOG_INFO("2.5");
-            Ptr<Object> txQueue1 = tmp1.GetObject ();
-            
-            PointerValue tmp2;
-            device2->GetAttribute ("TxQueue", tmp2);
-            Ptr<Object> txQueue2 = tmp2.GetObject ();
-            //NS_LOG_INFO("3");
-            Ptr<DropTailQueue> dtq1 = txQueue1->GetObject <DropTailQueue> ();
-            NS_ASSERT (dtq1 != 0);
-            
-            Ptr<DropTailQueue> dtq2 = txQueue2->GetObject <DropTailQueue> ();
-            NS_ASSERT (dtq2 != 0);
-            
-            std::string queuesize1 = iter2->GetAttribute("QueueSizeNode1");
-            std::string queuesize2 = iter2->GetAttribute("QueueSizeNode2");
-            //NS_LOG_INFO("4");
-            txQueue1->SetAttribute("MaxPackets", UintegerValue (atoi(queuesize1.c_str())));
-            txQueue2->SetAttribute("MaxPackets", UintegerValue (atoi(queuesize2.c_str())));
-            
-            UintegerValue limit;
-            txQueue1->GetAttribute ("MaxPackets", limit);
-            NS_LOG_INFO ("NetDevice #"<< device->GetIfIndex() << "has queue limit " << limit.Get () << " packets");
-            
-            txQueue2->GetAttribute ("MaxPackets", limit);
-            NS_LOG_INFO ("NetDevice #"<< device2->GetIfIndex() << "has queue limit " << limit.Get () << " packets");*/
-        }
+void
+RocketfuelWeightsReader::SetFileType (uint8_t inputType)
+{
+  m_inputType = inputType;
+}
+
+NodeContainer
+RocketfuelWeightsReader::Read ()
+{
+  ifstream topgen;
+  topgen.open (GetFileName ().c_str ());
+  NodeContainer nodes;
+        
+  if ( !topgen.is_open () )
+    {
+      NS_LOG_ERROR ("Cannot open file " << GetFileName () << " for reading");
+      return nodes;
     }
 
+  map<string, set<string> > processedLinks; // to eliminate duplications
+  bool repeatedRun = LinksSize () > 0;
+  std::list<Link>::iterator linkIterator = m_linksList.begin ();
+  
+  while (!topgen.eof ())
+    {
+      string line;
+      getline (topgen,line);
+      if (line == "") continue;
+      if (line[0] == '#') continue; // comments
+
+      // NS_LOG_DEBUG ("Input: [" << line << "]");
+      
+      istringstream lineBuffer (line);
+      string from, to, attribute;
+
+      lineBuffer >> from >> to >> attribute;
+
+      if (processedLinks[to].size () != 0 &&
+          processedLinks[to].find (from) != processedLinks[to].end ())
+        {
+          continue; // duplicated link
+        }
+      processedLinks[from].insert (to);
+      
+      Ptr<Node> fromNode = Names::Find<Node> (m_path, from);
+      if (fromNode == 0)
+        {
+          fromNode = CreateNode (from);
+          nodes.Add (fromNode);
+        }
+
+      Ptr<Node> toNode   = Names::Find<Node> (m_path, to);
+      if (toNode == 0)
+        {
+          toNode = CreateNode (to);
+          nodes.Add (toNode);
+        }
+
+      Link *link;
+      if (!repeatedRun)
+        link = new Link (fromNode, from, toNode, to);
+      else
+        {
+          NS_ASSERT (linkIterator != m_linksList.end ());
+          link = &(*linkIterator);
+
+          linkIterator++;
+        }
+
+      switch (m_inputType)
+        {
+        case WEIGHTS:
+          link->SetAttribute ("OSPF", attribute);
+          break;
+        case LATENCIES:
+          link->SetAttribute ("Delay", attribute);
+          break;
+        default:
+          ; //
+        }
+
+      NS_LOG_DEBUG ("Link " << from << " <==> " << to << " / " << attribute);
+      if (!repeatedRun)
+        {
+          AddLink (*link);
+          delete link;
+        }
+    }
+        
+  topgen.close ();
+  NS_LOG_INFO ("Rocketfuel topology created with " << nodes.GetN () << " nodes and " << LinksSize () << " links");
+  return nodes;
+}
     
 } /* namespace ns3 */
-
-
diff --git a/model/rocketfuel-weights-reader.h b/model/rocketfuel-weights-reader.h
index 21c2144..2b73c11 100644
--- a/model/rocketfuel-weights-reader.h
+++ b/model/rocketfuel-weights-reader.h
@@ -19,72 +19,60 @@
  *         Ilya Moiseenko <iliamo@cs.ucla.edu>
  */
 
-#ifndef ROCKETFUEL_TOPOLOGY_READER_H
-#define ROCKETFUEL_TOPOLOGY_READER_H
+#ifndef ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H
+#define ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H
 
-#include "ns3/topology-reader.h"
+#include "annotated-topology-reader.h"
 #include "ns3/net-device-container.h"
 
 namespace ns3 {
     
-    
-    // ------------------------------------------------------------
-    // --------------------------------------------
-    /**
-     * \brief Topology file reader (Rocketfuel-format type).
-     *
-     * http://www.cs.washington.edu/research/networking/rocketfuel/
-     *
-     * May 2nd, 2010: Currently only support "weights" file and "cch" file.
-     * http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
-     * http://www.cs.washington.edu/research/networking/rocketfuel/maps/rocketfuel_maps_cch.tar.gz
-     */
-    class RocketfuelWeightsReader : public TopologyReader
+// ------------------------------------------------------------
+// --------------------------------------------
+/**
+ * \brief Topology file reader (extension of Rocketfuel-format type).
+ *
+ * http://www.cs.washington.edu/research/networking/rocketfuel/
+ *
+ * Only weights and latencies file is supported
+ */
+class RocketfuelWeightsReader : public AnnotatedTopologyReader
+{
+public:
+  RocketfuelWeightsReader ();
+  virtual ~RocketfuelWeightsReader ();
+
+  void
+  SetFileType (uint8_t inputType);
+  
+  /**
+   * \brief Main topology reading function.
+   *
+   * This method opens an input stream and reads the Rocketfuel-format file.
+   * Every row represents a topology link (the ids of a couple of nodes),
+   * so the input file is read line by line to figure out how many links
+   * and nodes are in the topology.
+   *
+   * \return the container of the nodes created (or empty container if there was an error)
+   */
+  virtual NodeContainer Read (void);
+
+  enum
     {
-    public:
-        static TypeId GetTypeId (void);
-        
-        RocketfuelWeightsReader ();
-        virtual ~RocketfuelWeightsReader ();
-        
-        /**
-         * \brief Main topology reading function.
-         *
-         * This method opens an input stream and reads the Rocketfuel-format file.
-         * Every row represents a topology link (the ids of a couple of nodes),
-         * so the input file is read line by line to figure out how many links
-         * and nodes are in the topology.
-         *
-         * \return the container of the nodes created (or empty container if there was an error)
-         */
-        NodeContainer Read (std::string latenciesFile);
-        
-        virtual NodeContainer Read (void);
-        
-        void ApplySettings(NetDeviceContainer* ndc, NodeContainer* nc);
-        
-    private:
-        RocketfuelWeightsReader (const RocketfuelWeightsReader&);
-        RocketfuelWeightsReader& operator= (const RocketfuelWeightsReader&);
-        // Parser for the weights.* file available at:
-        // http://www.cs.washington.edu/research/networking/rocketfuel/maps/weights-dist.tar.gz
-        NodeContainer GenerateFromWeightsFile (int argc, char *argv[], char *argl[]);
-        
-        enum RF_FileType
-        {
-            RF_MAPS,
-            RF_WEIGHTS,
-            RF_UNKNOWN
-        };
-        enum RF_FileType GetFileType (const char *);
-        
-        // end class RocketfuelWeightsReader
+      WEIGHTS,
+      LATENCIES
     };
-    
-    // end namespace ns3
-};
+
+private:
+  RocketfuelWeightsReader (const RocketfuelWeightsReader&);
+  RocketfuelWeightsReader& operator= (const RocketfuelWeightsReader&);
+  
+private:
+  uint8_t m_inputType;
+  
+}; // end class RocketfuelWeightsReader
+
+}; // end namespace ns3
 
 
-#endif /* ROCKETFUEL_TOPOLOGY_READER_H */
-
-
+#endif /* ROCKETFUEL_TOPOLOGY_WEIGHTS_READER_H */