ns-3 PLC model
model/plc-backbone.h
00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
00002 /*
00003  * Copyright (c) 2012 University of British Columbia, Vancouver
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation;
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  * Author: Alexander Schloegl <alexander.schloegl@gmx.de>
00019  */
00020 
00021 #ifndef PLC_BACKBONE_H_
00022 #define PLC_BACKBONE_H_
00023 
00024 #include <map>
00025 
00026 #include "ns3/plc-defs.h"
00027 #include "ns3/plc-value.h"
00028 
00029 namespace ns3 {
00030 
00031 class PLC_Graph;
00032 class PLC_TxInterface;
00033 class PLC_RxInterface;
00034 
00049 class PLC_BackboneBranch : public Object
00050 {
00051         friend class PLC_Outlet;
00052 
00053 public:
00054         static TypeId GetTypeId(void);
00055 
00063         PLC_BackboneBranch(Ptr<PLC_Node> node, Ptr<PLC_Node> before, Ptr<PLC_Node> next, Ptr<const SpectrumModel> sm);
00064         ~PLC_BackboneBranch() {}
00065 
00069         Ptr<PLC_Node> GetNodePtr(void)          { return this->m_node; }
00070         PLC_Node *GetNodePeekPtr(void)          { return PeekPointer(m_node); }
00071 
00075         Ptr<PLC_Node> GetBeforeNodePtr(void) { return this->m_node_before; }
00076         PLC_Node *GetBeforeNodePeekPtr(void) { return PeekPointer(m_node_before); }
00077 
00081         Ptr<PLC_Node> GetNextNodePtr(void)      { return this->m_node_next; }
00082 
00090         void AddInterfacePair(PLC_TxInterface *txInterface, PLC_RxInterface *rxInterface);
00091 
00098         void DiscoverOutlets(boost::UGraph& graph_copy, PLC_Mutex *graph_copy_mutex);
00099 
00103         void CalculateEquivalentBridgeTapImpedance(void);
00104 
00108         Ptr<PLC_Impedance> GetEquivalentBridgeTapImpedance(void) const
00109         {
00110                 NS_ASSERT(m_is_up_2_date);
00111                 return m_equivalent_bridge_tap_impedance;
00112         }
00113 
00117         bool IsUp2Date(void) const { return m_is_up_2_date; }
00118 
00122         bool IsTimeVariant(void) const { return m_is_time_variant; }
00123 
00127         void SetTimeVariant(void);
00128 
00132         std::pair<unsigned int, std::pair<unsigned int, unsigned int> > GetKey(void) { return m_key; }
00133 
00137         void Lock(void) { m_branch_mutex.Lock(); }
00138         void Unlock(void) { m_branch_mutex.Unlock(); }
00139 
00140 private:
00141         virtual void DoStart(void);
00142         virtual void DoDispose(void);
00143 
00144         Ptr<const SpectrumModel>        m_spectrum_model;
00145         mutable PLC_Mutex                       m_branch_mutex;
00146         Ptr<PLC_Node>                           m_node, m_node_before, m_node_next;
00147         Ptr<PLC_Impedance>                      m_equivalent_bridge_tap_impedance;
00148 
00149         std::map<PLC_Node *, Ptr<PLC_Impedance> > m_parallel_output_impedances;
00150         std::pair<unsigned int, std::pair<unsigned int, unsigned int> > m_key;
00151 
00152         PLC_InterfaceTupel      m_registered_ifPairs;
00153         bool                            m_is_up_2_date;
00154         bool                            m_is_time_variant;
00155 };
00156 
00157 }
00158 
00159 #endif /* PLC_BACKBONE_H_ */
 All Classes Functions Variables Enumerations