Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

LMAddrs Class Reference

#include <landmark.h>

Collaboration diagram for LMAddrs:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LMAddrs ()
 ~LMAddrs ()
void add_lm_addr (int64_t lmaddr)
void delete_lm_addrs ()
void get_lm_addrs (int *num_lm_addrs, int64_t **lmaddr)
int match_lm_addr (int *addr, int level)

Private Attributes

int64_tlmaddr_
int num_lm_addrs_

Constructor & Destructor Documentation

LMAddrs::LMAddrs  )  [inline]
 

Definition at line 112 of file landmark.h.

References lmaddr_, and num_lm_addrs_.

00112             {
00113     lmaddr_ = 0;
00114     num_lm_addrs_ = 0;
00115   }

LMAddrs::~LMAddrs  )  [inline]
 

Definition at line 117 of file landmark.h.

References delete_lm_addrs().

00117              {  
00118     delete_lm_addrs();
00119   }

Here is the call graph for this function:


Member Function Documentation

void LMAddrs::add_lm_addr int64_t  lmaddr  )  [inline]
 

Definition at line 121 of file landmark.h.

References int64_t, lmaddr_, and num_lm_addrs_.

00121                                    {
00122     int i = 0;
00123     assert(num_lm_addrs_ >= 0);
00124 
00125     if(num_lm_addrs_) {
00126        int64_t *tmp_addrs = new int64_t[num_lm_addrs_];
00127        for(i = 0; i < num_lm_addrs_; ++i) {
00128           tmp_addrs[i] = lmaddr_[i];
00129        }
00130        delete[] lmaddr_;
00131 
00132        lmaddr_ = new int64_t[num_lm_addrs_+1];
00133        for(i = 0; i < num_lm_addrs_; ++i) {
00134          lmaddr_[i] = tmp_addrs[i];
00135        }
00136        delete[] tmp_addrs;
00137     }
00138     else 
00139       lmaddr_ = new int64_t[num_lm_addrs_+1];
00140 
00141     lmaddr_[num_lm_addrs_] = lmaddr;
00142     ++num_lm_addrs_;
00143   }

void LMAddrs::delete_lm_addrs  )  [inline]
 

Definition at line 145 of file landmark.h.

References lmaddr_, and num_lm_addrs_.

Referenced by ~LMAddrs().

00145                          {
00146     if(!num_lm_addrs_) return;
00147     num_lm_addrs_ = 0;
00148     delete[] lmaddr_;
00149     lmaddr_ = NULL;
00150   }

void LMAddrs::get_lm_addrs int *  num_lm_addrs,
int64_t **  lmaddr
[inline]
 

Definition at line 152 of file landmark.h.

References int64_t, lmaddr_, and num_lm_addrs_.

00152                                                          {
00153     *num_lm_addrs = num_lm_addrs_;
00154     *lmaddr = NULL;
00155     if(num_lm_addrs_) {
00156       *lmaddr = new int64_t[num_lm_addrs_];
00157       for(int i = 0; i < num_lm_addrs_; ++i) {
00158           (*lmaddr)[i] = lmaddr_[i];
00159       }
00160     }
00161   }

int LMAddrs::match_lm_addr int *  addr,
int  level
[inline]
 

Definition at line 163 of file landmark.h.

References FALSE, lmaddr_, num_lm_addrs_, and TRUE.

00163                                           {
00164     int i[8];
00165     int num_addrs = 0;
00166     int match = FALSE;
00167 
00168     assert(level < 8);
00169 
00170     for(num_addrs = 0; num_addrs < num_lm_addrs_; ++num_addrs) {
00171        i[7] = (lmaddr_[num_addrs] >> 56) & 0xFF;
00172        i[6] = (lmaddr_[num_addrs] >> 48) & 0xFF;
00173        i[5] = (lmaddr_[num_addrs] >> 40) & 0xFF;
00174        i[4] = (lmaddr_[num_addrs] >> 32) & 0xFF;
00175        i[3] = (lmaddr_[num_addrs] >> 24) & 0xFF;
00176        i[2] = (lmaddr_[num_addrs] >> 16) & 0xFF;
00177        i[1] = (lmaddr_[num_addrs] >> 8) & 0xFF;
00178        i[0] = (lmaddr_[num_addrs]) & 0xFF;
00179 
00180        match = TRUE;
00181        for(int j = 7; j >= level; --j) {
00182           if(addr[j] != i[j]) {
00183             match = FALSE;
00184             break;
00185           }
00186        }
00187        if(match == TRUE)
00188           return(match);
00189     }
00190     return(match);
00191   }


Member Data Documentation

int64_t* LMAddrs::lmaddr_ [private]
 

Definition at line 194 of file landmark.h.

Referenced by add_lm_addr(), delete_lm_addrs(), get_lm_addrs(), LMAddrs(), and match_lm_addr().

int LMAddrs::num_lm_addrs_ [private]
 

Definition at line 195 of file landmark.h.

Referenced by add_lm_addr(), delete_lm_addrs(), get_lm_addrs(), LMAddrs(), and match_lm_addr().


The documentation for this class was generated from the following file:
Generated on Tue Apr 20 12:55:40 2004 for NS2.26SourcesOriginal by doxygen 1.3.3