src/contrib/attribute-iterator.cc
author Mitch Watrous <watrous@u.washington.edu>
Mon, 21 Mar 2011 11:26:56 -0700
changeset 6925 43d9c7eedf7b
parent 5992 73ea01eb5674
child 7900 8b7b2dcd71dc
permissions -rw-r--r--
Test implicitly dependent modules
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     2
/*
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     3
 *  This program is free software; you can redistribute it and/or modify
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     4
 * it under the terms of the GNU General Public License version 2 as
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     5
 * published by the Free Software Foundation;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     6
 *
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     7
 * This program is distributed in the hope that it will be useful,
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
     9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    10
 * GNU General Public License for more details.
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    11
 *
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    12
 * You should have received a copy of the GNU General Public License
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    13
 * along with this program; if not, write to the Free Software
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    14
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    15
 * 
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    16
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    17
 */
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    18
 
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
#include "attribute-iterator.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "ns3/config.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#include "ns3/log.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "ns3/pointer.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "ns3/object-vector.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "ns3/string.h"
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <fstream>
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
NS_LOG_COMPONENT_DEFINE ("AttributeIterator");
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
AttributeIterator::AttributeIterator ()
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    34
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    35
}
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
AttributeIterator::~AttributeIterator ()
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    38
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    39
}
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
void 
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
AttributeIterator::Iterate (void)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
{
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  for (uint32_t i = 0; i < Config::GetRootNamespaceObjectN (); ++i)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
      Ptr<Object> object = Config::GetRootNamespaceObject (i);
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    47
      StartVisitObject (object);
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
      DoIterate (object);
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    49
      EndVisitObject ();
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
  NS_ASSERT (m_currentPath.empty ());
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
  NS_ASSERT (m_examined.empty ());
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
bool
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
AttributeIterator::IsExamined (Ptr<const Object> object)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
{
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
  for (uint32_t i = 0; i < m_examined.size (); ++i)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
      if (object == m_examined[i])
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    61
        {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    62
          return true;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    63
        }
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
  return false;
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
std::string
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
AttributeIterator::GetCurrentPath (std::string attr) const
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
{
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
  std::ostringstream oss;
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
  for (uint32_t i = 0; i < m_currentPath.size (); ++i)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
      oss << "/" << m_currentPath[i];
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
  if (attr != "")
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
      oss << "/" << attr;
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
  return oss.str ();
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    84
std::string
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    85
AttributeIterator::GetCurrentPath (void) const
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    86
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    87
  std::ostringstream oss;
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    88
  for (uint32_t i = 0; i < m_currentPath.size (); ++i)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    89
    {
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    90
      oss << "/" << m_currentPath[i];
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    91
    }
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    92
  return oss.str ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    93
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    94
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
void 
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    96
AttributeIterator::DoStartVisitObject (Ptr<Object> object)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    97
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
    98
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
    99
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   100
AttributeIterator::DoEndVisitObject (void)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   101
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   102
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   103
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   104
AttributeIterator::DoStartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> item)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   105
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   106
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   107
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   108
AttributeIterator::DoEndVisitPointerAttribute (void)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   109
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   110
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   111
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   112
AttributeIterator::DoStartVisitArrayAttribute (Ptr<Object> object, std::string name, const ObjectVectorValue &vector)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   113
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   114
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   115
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   116
AttributeIterator::DoEndVisitArrayAttribute (void)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   117
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   118
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   119
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   120
AttributeIterator::DoStartVisitArrayItem (const ObjectVectorValue &vector, uint32_t index, Ptr<Object> item)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   121
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   122
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   123
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   124
AttributeIterator::DoEndVisitArrayItem (void)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   125
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   126
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   127
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   128
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   129
AttributeIterator::VisitAttribute (Ptr<Object> object, std::string name)
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
{
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  m_currentPath.push_back (name);
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   132
  DoVisitAttribute (object, name);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   133
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   134
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   135
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   136
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   137
AttributeIterator::StartVisitObject (Ptr<Object> object)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   138
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   139
  m_currentPath.push_back ("$" + object->GetInstanceTypeId ().GetName ());
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   140
  DoStartVisitObject (object);
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   141
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
void 
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   143
AttributeIterator::EndVisitObject (void)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   144
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   145
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   146
  DoEndVisitObject ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   147
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   148
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   149
AttributeIterator::StartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value)
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
{
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   151
  m_currentPath.push_back (name);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   152
  m_currentPath.push_back ("$" + value->GetInstanceTypeId ().GetName ());
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   153
  DoStartVisitPointerAttribute (object, name, value);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   154
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   155
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   156
AttributeIterator::EndVisitPointerAttribute (void)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   157
{
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
  m_currentPath.pop_back ();
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   159
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   160
  DoEndVisitPointerAttribute ();
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
}
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   162
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   163
AttributeIterator::StartVisitArrayAttribute (Ptr<Object> object, std::string name, const ObjectVectorValue &vector)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   164
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   165
  m_currentPath.push_back (name);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   166
  DoStartVisitArrayAttribute (object, name, vector);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   167
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   168
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   169
AttributeIterator::EndVisitArrayAttribute (void)
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
{
3069
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   171
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   172
  DoEndVisitArrayAttribute ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   173
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   174
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   175
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   176
AttributeIterator::StartVisitArrayItem (const ObjectVectorValue &vector, uint32_t index, Ptr<Object> item)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   177
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   178
  std::ostringstream oss;
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   179
  oss << index;
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   180
  m_currentPath.push_back (oss.str ());
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   181
  m_currentPath.push_back ("$" + item->GetInstanceTypeId ().GetName ());
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   182
  DoStartVisitArrayItem (vector, index, item);
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   183
}
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   184
void 
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   185
AttributeIterator::EndVisitArrayItem (void)
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   186
{
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   187
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   188
  m_currentPath.pop_back ();
4730d8d6d63c make the iteration code more flexible. add tooltips to gtk config store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3063
diff changeset
   189
  DoEndVisitArrayItem ();
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   190
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   191
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   192
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   193
void
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   194
AttributeIterator::DoIterate (Ptr<Object> object)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   195
{
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   196
  if (IsExamined (object))
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   197
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   198
      return;
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
    }
3071
99722b888be3 make sure we iterate over the parent's attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3069
diff changeset
   200
  TypeId tid;
99722b888be3 make sure we iterate over the parent's attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3069
diff changeset
   201
  for (tid = object->GetInstanceTypeId (); tid.HasParent (); tid = tid.GetParent ())
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   202
    {
3071
99722b888be3 make sure we iterate over the parent's attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3069
diff changeset
   203
      NS_LOG_DEBUG ("store " << tid.GetName ());
99722b888be3 make sure we iterate over the parent's attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3069
diff changeset
   204
      for (uint32_t i = 0; i < tid.GetAttributeN (); ++i)
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   205
        {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   206
          Ptr<const AttributeChecker> checker = tid.GetAttributeChecker (i);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   207
          const PointerChecker *ptrChecker = dynamic_cast<const PointerChecker *> (PeekPointer (checker));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   208
          if (ptrChecker != 0)
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   209
            {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   210
              NS_LOG_DEBUG ("pointer attribute " << tid.GetAttributeName (i));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   211
              PointerValue ptr;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   212
              object->GetAttribute (tid.GetAttributeName (i), ptr);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   213
              Ptr<Object> tmp = ptr.Get<Object> ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   214
              if (tmp != 0)
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   215
                {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   216
                  StartVisitPointerAttribute (object, tid.GetAttributeName (i),
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   217
                                              tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   218
                  m_examined.push_back (object);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   219
                  DoIterate (tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   220
                  m_examined.pop_back ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   221
                  EndVisitPointerAttribute ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   222
                }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   223
              continue;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   224
            }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   225
          // attempt to cast to an object vector.
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   226
          const ObjectVectorChecker *vectorChecker = dynamic_cast<const ObjectVectorChecker *> (PeekPointer (checker));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   227
          if (vectorChecker != 0)
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   228
            {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   229
              NS_LOG_DEBUG ("vector attribute " << tid.GetAttributeName (i));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   230
              ObjectVectorValue vector;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   231
              object->GetAttribute (tid.GetAttributeName (i), vector);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   232
              StartVisitArrayAttribute (object, tid.GetAttributeName (i), vector);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   233
              for (uint32_t j = 0; j < vector.GetN (); ++j)
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   234
                {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   235
                  NS_LOG_DEBUG ("vector attribute item " << j);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   236
                  Ptr<Object> tmp = vector.Get (j);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   237
                  StartVisitArrayItem (vector, j, tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   238
                  m_examined.push_back (object);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   239
                  DoIterate (tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   240
                  m_examined.pop_back ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   241
                  EndVisitArrayItem ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   242
                }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   243
              EndVisitArrayAttribute ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   244
              continue;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   245
            }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   246
          uint32_t flags = tid.GetAttributeFlags (i);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   247
          Ptr<const AttributeAccessor> accessor = tid.GetAttributeAccessor (i);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   248
          if ((flags & TypeId::ATTR_GET) && accessor->HasGetter () && 
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   249
              (flags & TypeId::ATTR_SET) && accessor->HasSetter ())
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   250
            {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   251
              VisitAttribute (object, tid.GetAttributeName (i));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   252
            }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   253
          else
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   254
            {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   255
              NS_LOG_DEBUG ("could not store " << tid.GetAttributeName (i));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   256
            }
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   257
        }
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   259
  Object::AggregateIterator iter = object->GetAggregateIterator ();
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   260
  bool recursiveAggregate = false;
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
  while (iter.HasNext ())
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
      Ptr<const Object> tmp = iter.Next ();
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
      if (IsExamined (tmp))
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   265
        {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   266
          recursiveAggregate = true;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   267
        }
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   269
  if (!recursiveAggregate)
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   270
    {
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
      iter = object->GetAggregateIterator ();
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
      while (iter.HasNext ())
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   273
        {
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   274
          Ptr<Object> tmp = const_cast<Object *> (PeekPointer (iter.Next ()));
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   275
          StartVisitObject (tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   276
          m_examined.push_back (object);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   277
          DoIterate (tmp);
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   278
          m_examined.pop_back ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   279
          EndVisitObject ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents: 4273
diff changeset
   280
        }
3063
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
    }
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
}
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
a1c532e3bf18 a basic but useful Gtk+-based config-store
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
} // namespace ns3