A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
attribute-iterator.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
17  */
18 
19 #ifndef ATTRIBUTE_ITERATOR_H
20 #define ATTRIBUTE_ITERATOR_H
21 
22 #include "ns3/ptr.h"
23 #include "ns3/object.h"
24 #include "ns3/object-ptr-container.h"
25 #include <vector>
26 
27 namespace ns3 {
28 
35 {
36 public:
38  virtual ~AttributeIterator ();
39 
40  void Iterate (void);
41 protected:
42  std::string GetCurrentPath (void) const;
43 private:
44  virtual void DoVisitAttribute (Ptr<Object> object, std::string name) = 0;
45  virtual void DoStartVisitObject (Ptr<Object> object);
46  virtual void DoEndVisitObject (void);
47  virtual void DoStartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value);
48  virtual void DoEndVisitPointerAttribute (void);
49  virtual void DoStartVisitArrayAttribute (Ptr<Object> object, std::string name, const ObjectPtrContainerValue &vector);
50  virtual void DoEndVisitArrayAttribute (void);
51  virtual void DoStartVisitArrayItem (const ObjectPtrContainerValue &vector, uint32_t index, Ptr<Object> item);
52  virtual void DoEndVisitArrayItem (void);
53 
54  void DoIterate (Ptr<Object> object);
55  bool IsExamined (Ptr<const Object> object);
56  std::string GetCurrentPath (std::string attr) const;
57 
58  void VisitAttribute (Ptr<Object> object, std::string name);
59  void StartVisitObject (Ptr<Object> object);
60  void EndVisitObject (void);
61  void StartVisitPointerAttribute (Ptr<Object> object, std::string name, Ptr<Object> value);
62  void EndVisitPointerAttribute (void);
63  void StartVisitArrayAttribute (Ptr<Object> object, std::string name, const ObjectPtrContainerValue &vector);
64  void EndVisitArrayAttribute (void);
65  void StartVisitArrayItem (const ObjectPtrContainerValue &vector, uint32_t index, Ptr<Object> item);
66  void EndVisitArrayItem (void);
67 
68 
69  std::vector<Ptr<Object> > m_examined;
70  std::vector<std::string> m_currentPath;
71 };
72 
73 } // namespace ns3
74 
75 #endif /* ATTRIBUTE_ITERATOR_H */
contain a set of ns3::Object pointers.