src/config-store/model/model-node-creator.h
author Jaume Nin <jnin@cttc.cat>
Mon, 24 Oct 2011 18:08:24 +0200
changeset 8254 221fd655f652
parent 8253 6faee3d1d1d0
child 8749 4462ac63d4cf
permissions -rw-r--r--
fixed problems with ns-3-dev ObjectMap implementation
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
diff changeset
    16
 * Authors: Faker Moatamri <faker.moatamri@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:
diff changeset
    17
 *          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:
diff changeset
    18
 */
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    19
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    20
#include "attribute-iterator.h"
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    21
#include <gtk/gtk.h>
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    22
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    23
namespace ns3
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    24
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    25
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    26
enum
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    27
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    28
  COL_NODE = 0, COL_LAST
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    29
};
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    30
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    31
struct ModelNode
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    32
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    33
  enum
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
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:
diff changeset
    35
    // store object + attribute name
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    36
    NODE_ATTRIBUTE,
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    37
    // store object + attribute name
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    38
    NODE_POINTER,
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    39
    // store object + attribute name
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    40
    NODE_VECTOR,
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    41
    // store index + value (object)
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    42
    NODE_VECTOR_ITEM,
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    43
    // store object
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    44
    NODE_OBJECT
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    45
  } type;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    46
  std::string name;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    47
  Ptr<Object> object;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    48
  uint32_t index;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    49
};
7234
0572de06ae29 Make some modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6941
diff changeset
    50
/**
0572de06ae29 Make some modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6941
diff changeset
    51
 * \ingroup configstore
0572de06ae29 Make some modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6941
diff changeset
    52
 *
0572de06ae29 Make some modules show up on doxygen modules page
Mitch Watrous <watrous@u.washington.edu>
parents: 6941
diff changeset
    53
 */
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    54
class ModelCreator : public AttributeIterator
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    55
{
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    56
public:
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    57
  ModelCreator ();
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    58
8254
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    59
  void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    60
  Build (GtkTreeStore *treestore);
5992
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    61
private:
8254
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    62
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    63
  DoVisitAttribute (Ptr<Object> object, std::string name);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    64
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    65
  DoStartVisitObject (Ptr<Object> object);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    66
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    67
  DoEndVisitObject (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    68
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    69
  DoStartVisitPointerAttribute (Ptr<Object> object, std::string name,
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    70
      Ptr<Object> value);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    71
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    72
  DoEndVisitPointerAttribute (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    73
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    74
  DoStartVisitArrayAttribute (Ptr<Object> object, std::string name,
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    75
      const ObjectPtrVectorValue &vector);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    76
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    77
  DoEndVisitArrayAttribute (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    78
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    79
  DoStartVisitArrayItem (const ObjectPtrVectorValue &vector, uint32_t index,
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    80
      Ptr<Object> item);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    81
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    82
  DoEndVisitArrayItem (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    83
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    84
  DoStartVisitMapAttribute (Ptr<Object> object, std::string name,
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    85
      const ObjectPtrMapValue &map);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    86
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    87
  DoEndVisitMapAttribute (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    88
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    89
  DoStartVisitMapItem (const ObjectPtrMapValue &vector, uint32_t index,
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    90
      Ptr<Object> item);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    91
  virtual void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    92
  DoEndVisitMapItem (void);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    93
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    94
  void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    95
  Add (ModelNode *node);
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    96
  void
221fd655f652 fixed problems with ns-3-dev ObjectMap implementation
Jaume Nin <jnin@cttc.cat>
parents: 8253
diff changeset
    97
  Remove (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:
diff changeset
    98
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
    99
  GtkTreeStore *m_treestore;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
   100
  std::vector<GtkTreeIter *> m_iters;
73ea01eb5674 Bug 184: add ConfigureDefaults to GtkConfigStore, refactor the code and coding style, add comments
Faker Moatamri <faker.moatamri@sophia.inria.fr>
parents:
diff changeset
   101
};
5995
017e7a1cfa7c fix build, remove debugging code from tap example
Craig Dowell <craigdo@ee.washington.edu>
parents: 5992
diff changeset
   102
}