EPONImplementationforOMNet++  0.8Beta
ONUTableEntry Class Reference

This class holds a single ONUTable entry... More...

#include <ONUTableEntry.h>

List of all members.

Public Member Functions

 ONUTableEntry ()
 ONUTableEntry (const ONUTableEntry &en)
virtual ~ONUTableEntry ()
void setId (MACAddress &mac)
void setRTT (uint32_t rtt)
int addLLID (uint16_t llid)
 Check the LLID is unique and add.
void removeLLID (int idx)
void setComTime (CommitedTime t)
MACAddress getId ()
uint16_t getRTT ()
uint16_t getLLID (int idx)
vector< uint16_t > & getLLIDs () const
int getLLIDsNum ()
CommitedTime getComTime ()
bool isValid ()
virtual cObject * dup ()
virtual std::string info ()
ONUTableEntryoperator= (const ONUTableEntry &en)

Public Attributes

uint32_t req [8]
uint32_t totalReq

Protected Attributes

MACAddress id
uint16_t RTT
vector< uint16_t > LLIDs
CommitedTime comTimes

Friends

std::ostream & operator<< (std::ostream &out, const ONUTableEntry &en)

Detailed Description

This class holds a single ONUTable entry...


Constructor & Destructor Documentation

                             {
      id.setAddress("00:00:00:00:00:00");
      RTT=0;
      comTimes.length=0;
      comTimes.start=0;
      totalReq=0;
      for (uint i=0; i<8; i++) req[i]=0;
}
                                                    {
      id=en.id;
      RTT=en.RTT;

      for (uint32_t i=0; i<en.LLIDs.size(); i++)
                  LLIDs.push_back(en.LLIDs[i]);

      // Copy queues
      for (uint i=0; i<8; i++) req[i]=en.req[i];
      totalReq=en.totalReq;

      comTimes=en.comTimes;
}
                              {
      LLIDs.clear();
}

Member Function Documentation

int ONUTableEntry::addLLID ( uint16_t  llid)

Check the LLID is unique and add.

IF it is not return -1;

                                       {
      for (uint32_t i=0; i<LLIDs.size(); i++){
            if (LLIDs[i] == llid) return -1;
      }

      LLIDs.push_back(llid);
      return 0;
}
cObject * ONUTableEntry::dup ( ) [virtual]
                            {
      return new ONUTableEntry(*this);
}
MACAddress ONUTableEntry::getId ( )
{return id;}
uint16_t ONUTableEntry::getLLID ( int  idx)
{return LLIDs[idx];}
vector< uint16_t > & ONUTableEntry::getLLIDs ( ) const
                                                {
      return (vector<uint16_t> &)LLIDs;
}
{return LLIDs.size();}
uint16_t ONUTableEntry::getRTT ( )
{return RTT;}
std::string ONUTableEntry::info ( ) [virtual]
                             {
      return "A single ONU entry";
}
                           {
      return !id.equals("00:00:00:00:00:00");
}
ONUTableEntry & ONUTableEntry::operator= ( const ONUTableEntry en)
                                                              {
      id=en.id;
      RTT=en.RTT;

      LLIDs.clear();

      for (uint32_t i=0; i<en.LLIDs.size(); i++)
            LLIDs.push_back(en.LLIDs[i]);


      comTimes=en.comTimes;
      return *this;
}
void ONUTableEntry::removeLLID ( int  idx)
{LLIDs.erase(LLIDs.begin()+idx);}
void ONUTableEntry::setId ( MACAddress &  mac)
{id=mac;}
void ONUTableEntry::setRTT ( uint32_t  rtt)
{RTT=rtt;}

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const ONUTableEntry en 
) [friend]
                                                                 {
      out<<"ID: "<<en.id<<"  RTT: "<<en.RTT<<"  # of LLIDs: "<<en.LLIDs.size()
            << " Start: "<<en.comTimes.start<<" Length: "<<en.comTimes.length<<endl
            <<"Requests ";

      for (int i=0; i<8; i++){
            out<<"["<<i<<"]"<<"="<<en.req[i]<<", ";
      }

      out<<"TotalReq="<<en.totalReq;
      return out;
}

Member Data Documentation

MACAddress ONUTableEntry::id [protected]
vector<uint16_t> ONUTableEntry::LLIDs [protected]
uint32_t ONUTableEntry::req[8]
uint16_t ONUTableEntry::RTT [protected]

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends Defines