⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 link_layer.hpp

📁 RFID reader 语 tag 模拟器
💻 HPP
字号:
 #ifndef LINK_LAYER_H #define LINK_LAYER_H #include <boost/shared_ptr.hpp> #include <boost/weak_ptr.hpp> #include "communication_layer.hpp" #include "mac_protocol.hpp" #include "simulator.hpp" class Node; typedef boost::shared_ptr<Node> NodePtr; // LinkLayer Class class LinkLayer : public CommunicationLayer { friend class MacProtocol; public:    typedef boost::shared_ptr<LinkLayer> LinkLayerPtr;    static inline LinkLayerPtr create(NodePtr node,       MacProtocolPtr macProtocol);    inline LinkLayerPtr thisLinkLayer();    inline SimulationEndListenerPtr thisSimulationEndListener();    virtual void simulationEndHandler();    bool recvFromLayer(CommunicationLayer::Directions direction,       PacketPtr packet, t_uint sendingLayerIdx);    bool recvFromMacProtocol(CommunicationLayer::Directions direction,       PacketPtr packet);    bool channelIsBusy();    inline CommunicationLayer::Types getLayerType() const; protected:    LinkLayer(NodePtr node, MacProtocolPtr macProtocol); private:    boost::weak_ptr<LinkLayer> m_weakThis;    static const t_uint m_LINK_LAYER_QUEUE_LENGTH;    MacProtocolPtr m_macProtocol; }; typedef boost::shared_ptr<LinkLayer> LinkLayerPtr; // Inline Functions inline LinkLayerPtr LinkLayer::create(NodePtr node,    MacProtocolPtr macProtocol) {    LinkLayerPtr p(new LinkLayer(node, macProtocol));    p->m_weakThis = p;    // thisLinkLayer() must be called after m_weakThis has    // been set.    assert(p->m_macProtocol.get() != 0);    p->m_macProtocol->setLinkLayer(p->thisLinkLayer());    Simulator::instance()->addSimulationEndListener(       p->thisSimulationEndListener());    return p; } inline LinkLayerPtr LinkLayer::thisLinkLayer() {    LinkLayerPtr p(m_weakThis);    return p; } inline SimulationEndListenerPtr LinkLayer::thisSimulationEndListener() {    SimulationEndListenerPtr p(m_weakThis);    return p; } inline CommunicationLayer::Types LinkLayer::getLayerType() const {    return CommunicationLayer::Types_Link; } // Overloaded Operators #endif // LINK_LAYER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -