ns-3 PLC model
|
00001 /* 00002 * plc-visitor.h 00003 * 00004 * Created on: 2012-01-06 00005 * Author: Alexander Schloegl <alexander.schloegl@gmx.de> 00006 */ 00007 00008 #ifndef PLC_VISITOR_H_ 00009 #define PLC_VISITOR_H_ 00010 00011 00012 #include "plc-defs.h" 00013 #include "plc-time.h" 00014 #include "plc-outlet.h" 00015 #include "plc-backbone.h" 00016 00017 namespace ns3 { 00018 00024 class PLC_OutletDiscoverVisitor : public boost::default_dfs_visitor 00025 { 00026 public: 00027 PLC_OutletDiscoverVisitor(PLC_BackboneBranch *bb_branch) : m_bb_branch(bb_branch) {} 00028 00029 ~PLC_OutletDiscoverVisitor() {} 00030 00031 template < typename Vertex, typename Graph > 00032 void finish_vertex(Vertex u, const Graph & g) 00033 { 00034 this->m_bb_branch->GetNodePeekPtr()->GetGraph()->Lock(); 00035 PLC_Node *node = this->m_bb_branch->GetNodePeekPtr()->GetGraph()->GetNodePeekPtr(u); 00036 this->m_bb_branch->GetNodePeekPtr()->GetGraph()->Unlock(); 00037 00038 node->Lock(); 00039 if (node->HasOutlet()) { 00040 00041 // register outlet on backbone branch 00042 PLC_Outlet *outlet = node->GetOutletPeekPtr(); 00043 outlet->RegisterBackboneBranch(this->m_bb_branch); 00044 00045 if (node->IsTimeVariant()) 00046 { 00047 this->m_bb_branch->SetTimeVariant(); 00048 } 00049 } 00050 node->Unlock(); 00051 } 00052 00053 private: 00054 PLC_BackboneBranch *m_bb_branch; 00055 }; 00056 00057 } 00058 00059 #endif /* PLC_VISITOR_H_ */