Fix some typos and bugs on the attribute to map implementation

This commit is contained in:
jnin
2011-03-21 13:02:15 +01:00
parent c5bff31a9f
commit d7e161bbd8
7 changed files with 56 additions and 8 deletions

View File

@@ -223,7 +223,7 @@ void
AttributeIterator::EndVisitMapAttribute (void)
{
m_currentPath.pop_back ();
DoEndVisitArrayAttribute ();
DoEndVisitMapAttribute ();
}
void
@@ -304,7 +304,6 @@ AttributeIterator::DoIterate (Ptr<Object> object)
NS_LOG_DEBUG ("map attribute " << tid.GetAttributeName (i));
ObjectMapValue map;
object->GetAttribute (tid.GetAttributeName (i), map);
// JNG Fix this
StartVisitMapAttribute (object, tid.GetAttributeName (i), map);
for (ObjectMapValue::Iterator it = map.Begin () ; it != map.End(); it++ )
{

View File

@@ -127,4 +127,42 @@ ModelCreator::DoEndVisitArrayItem (void)
g_free (iter);
m_iters.pop_back ();
}
void
ModelCreator::DoStartVisitMapAttribute (Ptr<Object> object, std::string name, const ObjectMapValue &map)
{
ModelNode *node = new ModelNode ();
node->type = ModelNode::NODE_VECTOR;
node->object = object;
node->name = name;
Add (node);
}
void
ModelCreator::DoEndVisitMapAttribute (void)
{
Remove ();
}
void
ModelCreator::DoStartVisitMapItem (const ObjectMapValue &map, uint32_t index, Ptr<Object> item)
{
GtkTreeIter *parent = m_iters.back ();
GtkTreeIter *current = g_new (GtkTreeIter, 1);
ModelNode *node = new ModelNode ();
node->type = ModelNode::NODE_VECTOR_ITEM;
node->object = item;
node->index = index;
gtk_tree_store_append (m_treestore, current, parent);
gtk_tree_store_set (m_treestore, current,
COL_NODE, node,
-1);
m_iters.push_back (current);
}
void
ModelCreator::DoEndVisitMapItem (void)
{
GtkTreeIter *iter = m_iters.back ();
g_free (iter);
m_iters.pop_back ();
}
}//end namespace ns3

View File

@@ -64,6 +64,13 @@ private:
virtual void DoStartVisitArrayItem (const ObjectVectorValue &vector,
uint32_t index, Ptr<Object> item);
virtual void DoEndVisitArrayItem (void);
virtual void DoStartVisitMapAttribute (Ptr<Object> object, std::string name, const ObjectMapValue &map);
virtual void DoEndVisitMapAttribute (void);
virtual void DoStartVisitMapItem (const ObjectMapValue &vector, uint32_t index, Ptr<Object> item);
virtual void DoEndVisitMapItem (void);
void Add (ModelNode *node);
void Remove (void);

View File

@@ -154,7 +154,7 @@ MakeObjectMapAccessor (U T::*memberMap)
{
if (k == i)
{
return std::pair<uint32_t, Ptr<Object> > ( k, (*j).second);
return std::pair<uint32_t, Ptr<Object> > ( (*j).first, (*j).second);
break;
}
}

View File

@@ -23,20 +23,20 @@
#include "ns3/network-module.h"
#include "ns3/mobility-module.h"
#include "ns3/lte-module.h"
#include "ns3/gtk-config-store.h"
using namespace ns3;
int main (int argc, char *argv[])
{
LenaHelper lena;
lena.EnableLogComponents ();
//lena.EnableLogComponents ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;
NodeContainer ueNodes;
enbNodes.Create (1);
ueNodes.Create (1);
ueNodes.Create (4);
// Install Mobility Model
MobilityHelper mobility;
@@ -63,6 +63,10 @@ int main (int argc, char *argv[])
Simulator::Stop (Seconds (0.005));
Simulator::Run ();
GtkConfigStore config;
config.ConfigureAttributes ();
Simulator::Destroy ();
return 0;
}

View File

@@ -119,7 +119,7 @@ void EnbRadioBearerInfo::SetRlc(Ptr<LteRlc> rlc)
* Manages all the radio bearer information possessed by the ENB RRC for a single UE
*
*/
class UeInfo : public Object //public SimpleRefCount<UeInfo>
class UeInfo : public Object
{
public:
/**

View File

@@ -106,7 +106,7 @@ LteUeNetDevice::InitLteUeNetDevice (void)
m_targetEnb = 0;
SetNode (0);
m_mac = CreateObject<LteUeMac> ();
m_rrc = Create<LteUeRrc> ();
m_rrc = CreateObject<LteUeRrc> ();
m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ());
m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ());
m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());