text: // Copyright @2012 JDSU Xtreme
  
  #ifndef XTREME_COMMON_REFDATA_RDTYPE_TOPOLOGY_H_
  #define XTREME_COMMON_REFDATA_RDTYPE_TOPOLOGY_H_
  
  #include <vector>
  // As this file is visible(included) in other components,
  // DO NOT include any internal headers, use forward declarations
  #include "xtreme/common/refdata/refdata_types.h"
  #include "xtreme/common/ipaddress.h"
  #include "xtreme/common/pubsub_filter/ipaddress.h"
  
  namespace xtreme {
    namespace refdata {
  
      // typedef std::vector<uint16_t>  VLan_List_t;
      enum {
        MAX_NUMOF_VLANID = 8
      };
      // typedef uint16_t VLan_List_t [MAX_NUMOF_VLANID];
      typedef struct VLan_List {
        typedef uint16_t*       iterator;
        typedef const uint16_t* const_iterator;
  
        uint16_t vlanIDs [MAX_NUMOF_VLANID];
        uint8_t  vlanCnt;
  
        VLan_List() : vlanCnt(0) {}
        bool empty() const { return (vlanCnt <= 0); }
  
        uint16_t* begin() { return  vlanIDs; }
        const uint16_t* begin() const { return  vlanIDs; }
  
        uint16_t* end() { return  vlanIDs + MAX_NUMOF_VLANID; }
        const uint16_t* end() const { return  vlanIDs + MAX_NUMOF_VLANID; }
      } VLan_List_t;
  
  
      struct TOPOLOGY_KEY_IPVLAN : public RDKey {
        static REFDATA_KEY_TYPEID const TYPEID;
        VLan_List_t m_vlanList;
        xtreme::IPAddress   m_nwIpAddr;
  
        TOPOLOGY_KEY_IPVLAN(const VLan_List_t& _vlanList, const xtreme::IPAddress& _ipAddr):
            RDKey(TOPOLOGY_T, TYPEID),
            m_vlanList(_vlanList),
            m_nwIpAddr(_ipAddr) {
        }
        explicit TOPOLOGY_KEY_IPVLAN(const xtreme::IPAddress& _ipAddr):
          RDKey(TOPOLOGY_T, TYPEID),
          m_vlanList(),
          m_nwIpAddr(_ipAddr) {
        }
      };
  
      struct TOPOLOGY_REC : public RDRecord {
          public:
          enum TOPOLOGY_COLTYPE {
              TOPOLOGY_COL_CUSTOM_IGNORE,
              TOPOLOGY_COL_VLANIDANY,
              TOPOLOGY_COL_NWIPADDR,
              TOPOLOGY_COL_NODENAME,
              TOPOLOGY_COL_NODETYPE,
              TOPOLOGY_COL_NODEGROUP1,
              TOPOLOGY_COL_NODEGROUP2,
              TOPOLOGY_COL_NODEGROUP3,
              NUM_OF_TOPOLOGY_COLTYPE
          };
          typedef std::bitset<NUM_OF_TOPOLOGY_COLTYPE> AvailCols_t;
  
        static REFDATA_REC_TYPEID const TYPEID;
        VLAN_t           m_vlanIdAny;
        IPADDR_t         m_nwIpAddr;
        NODENAME_t       m_nodeName;
        NODETYPE_t       m_nodeType;
        NODEGROUP_t      m_nodeGroup1;
        NODEGROUP_t      m_nodeGroup2;
        NODEGROUP_t      m_nodeGroup3;
        //VLan_List_t      m_vlanList;
  
        AvailCols_t      m_unknownCols;
  
        TOPOLOGY_REC(const VLAN_t& _vlanIdAny,
          const IPADDR_t& _nwIpAddr,
          const NODENAME_t& _nodeName,
          const NODETYPE_t& _nodeType,
          const NODEGROUP_t& _nodeGroup1,
          const NODEGROUP_t& _nodeGroup2,
          const NODEGROUP_t& _nodeGroup3) :
              RDRecord(TOPOLOGY_T, TYPEID),
              m_vlanIdAny(_vlanIdAny),
              m_nwIpAddr(_nwIpAddr),
              m_nodeName(_nodeName),
              m_nodeType(_nodeType),
              m_nodeGroup1(_nodeGroup1),
              m_nodeGroup2(_nodeGroup2),
              m_nodeGroup3(_nodeGroup3) {
        }
        explicit TOPOLOGY_REC(const TOPOLOGY_KEY_IPVLAN& idKey);
      };
  
      // Type-defs for this sub-type
      typedef boost::intrusive_ptr<TOPOLOGY_REC > iptr_RDRec_Topology_t;
  
  #ifndef XTREME_COMMON_REFDATA_RDTYPE_TOPOLOGY_H_IMPL_
      // Use extern template(s) ... for compilation efficiency
      extern template TOPOLOGY_REC * refdata_downcast <TOPOLOGY_REC, RDRecord > (RDRecord * pBase);
      extern template TOPOLOGY_KEY_IPVLAN * refdata_downcast <TOPOLOGY_KEY_IPVLAN, RDKey > (RDKey * pBase);
  #endif
    }
  }  // end of namespace xtreme
  
  #endif  // XTREME_COMMON_REFDATA_RDTYPE_TOPOLOGY_H_
  