xorp

port_manager.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2011 XORP, Inc and Others
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, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 // $XORP: xorp/rip/port_manager.hh,v 1.15 2008/10/02 21:58:17 bms Exp $
00021 
00022 #ifndef __RIP_PORT_MANAGER_HH__
00023 #define __RIP_PORT_MANAGER_HH__
00024 
00025 
00026 
00027 #include "libfeaclient/ifmgr_atoms.hh"
00028 
00029 template <typename A>
00030 class Port;
00031 
00032 template <typename A>
00033 class System;
00034 
00042 template <typename A>
00043 class PortManagerBase {
00044 public:
00045     typedef list<Port<A>*>  PortList;
00046     typedef System<A>       SystemType;
00047 
00048 public:
00049     PortManagerBase(SystemType& system, const IfMgrIfTree& iftree)
00050     : _system(system), _iftree(iftree) {}
00051 
00059     virtual ~PortManagerBase();
00060 
00064     SystemType& system()        { return _system; }
00065 
00069     const SystemType& system() const    { return _system; }
00070 
00074     const PortList& const_ports() const { return _ports; }
00075 
00079     EventLoop& eventloop()      { return _system.eventloop(); }
00080 
00084     const EventLoop& eventloop() const  { return _system.eventloop(); }
00085 
00089     const IfMgrIfTree& iftree() const   { return _iftree; }
00090 
00091 protected:
00095     PortList& ports()           { return _ports; }
00096 
00100     const PortList& ports() const   { return _ports; }
00101 
00102 protected:
00103     SystemType& _system;
00104     PortList    _ports;
00105     const IfMgrIfTree& _iftree;
00106 };
00107 
00108 // ----------------------------------------------------------------------------
00109 // Inline PortManagerBase methods
00110 //
00111 
00112 template <typename A>
00113 PortManagerBase<A>::~PortManagerBase()
00114 {
00115 }
00116 
00117 #endif // __RIP_PORT_MANAGER_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations