NRSimpleAttribute< void * > Class Template Reference

#include <nr.hh>

Inheritance diagram for NRSimpleAttribute< void * >:

NRAttribute Collaboration diagram for NRSimpleAttribute< void * >:

Collaboration graph
[legend]

Detailed Description

template<>
class NRSimpleAttribute< void * >

Definition at line 262 of file nr.hh.

Public Types

enum  algorithms { ONE_PHASE_PULL_ALGORITHM = 12010, TWO_PHASE_PULL_ALGORITHM, ONE_PHASE_PUSH_ALGORITHM }
enum  classes { INTEREST_CLASS = 10010, DISINTEREST_CLASS, DATA_CLASS }
enum  keys {
  SCOPE_KEY = 1001, CLASS_KEY = 1002, ALGORITHM_KEY = 1003, SUBSCRIPTION_ID_KEY = 1004,
  FLOWS_KEY = 1005, REINFORCEMENT_KEY = 1500, LATITUDE_KEY = 1501, LONGITUDE_KEY = 1502,
  ROUTE_KEY = 1503, SOURCE_ROUTE_KEY = 1504, DATABLOCK_KEY = 2001, TASK_FREQUENCY_KEY = 2002,
  TASK_NAME_KEY = 2003, TASK_QUERY_DETAIL_KEY = 2004, TARGET_KEY = 2005, TARGET_RANGE_KEY = 2006,
  CONFIDENCE_KEY = 2007, RMST_DATA_KEY = 2010, RMST_ID_KEY = 2011, RMST_FRAG_KEY = 2012,
  RMST_MAX_FRAG_KEY = 2013, RMST_TSPRT_CTL_KEY = 2014, RMST_PKTS_SENT_KEY = 2015, RMST_TARGET_KEY = 2016
}
enum  operators {
  IS, LE, GE, LT,
  GT, EQ, NE, EQ_ANY
}
enum  scopes { NODE_LOCAL_SCOPE = 11010, GLOBAL_SCOPE }
enum  types {
  INT32_TYPE, FLOAT32_TYPE, FLOAT64_TYPE, STRING_TYPE,
  BLOB_TYPE
}

Public Member Functions

NRAttributefind_matching_key (NRAttrVec *attrs, NRAttrVec::iterator *place=NULL)
NRAttributefind_matching_key_from (NRAttrVec *attrs, NRAttrVec::iterator start, NRAttrVec::iterator *place=NULL)
void * getGenericVal ()
int32_t getKey ()
int getLen ()
int8_t getOp ()
int8_t getType ()
void * getVal ()
bool isEQ (NRAttribute *attr)
bool isGE (NRAttribute *attr)
bool isGT (NRAttribute *attr)
bool isLE (NRAttribute *attr)
bool isLT (NRAttribute *attr)
bool isNE (NRAttribute *attr)
bool isSameKey (NRAttribute *attr)
 NRSimpleAttribute (int key, int type, int op, void *val, int size)
void setVal (void *value, int len)
 ~NRSimpleAttribute ()

Static Public Member Functions

static NRAttributefind_key (int key, NRAttrVec *attrs, NRAttrVec::iterator *place=NULL)
static NRAttributefind_key_from (int key, NRAttrVec *attrs, NRAttrVec::iterator start, NRAttrVec::iterator *place=NULL)

Protected Attributes

int32_t key_
int16_t len_
int8_t op_
int8_t type_
void * val_


Member Enumeration Documentation

enum NRAttribute::algorithms [inherited]
 

Enumerator:
ONE_PHASE_PULL_ALGORITHM 
TWO_PHASE_PULL_ALGORITHM 
ONE_PHASE_PUSH_ALGORITHM 

Definition at line 137 of file nr.hh.

enum NRAttribute::classes [inherited]
 

Enumerator:
INTEREST_CLASS 
DISINTEREST_CLASS 
DATA_CLASS 

Definition at line 135 of file nr.hh.

enum NRAttribute::keys [inherited]
 

Enumerator:
SCOPE_KEY 
CLASS_KEY 
ALGORITHM_KEY 
SUBSCRIPTION_ID_KEY 
FLOWS_KEY 
REINFORCEMENT_KEY 
LATITUDE_KEY 
LONGITUDE_KEY 
ROUTE_KEY 
SOURCE_ROUTE_KEY 
DATABLOCK_KEY 
TASK_FREQUENCY_KEY 
TASK_NAME_KEY 
TASK_QUERY_DETAIL_KEY 
TARGET_KEY 
TARGET_RANGE_KEY 
CONFIDENCE_KEY 
RMST_DATA_KEY 
RMST_ID_KEY 
RMST_FRAG_KEY 
RMST_MAX_FRAG_KEY 
RMST_TSPRT_CTL_KEY 
RMST_PKTS_SENT_KEY 
RMST_TARGET_KEY 

Definition at line 95 of file nr.hh.

00095             {
00096     // reserved constant values used for key
00097     // range 1000-1499 is diffusion-specific
00098     SCOPE_KEY = 1001,             // INT32_TYPE
00099     CLASS_KEY = 1002,             // INT32_TYPE
00100     ALGORITHM_KEY = 1003,         // INT32_TYPE
00101     SUBSCRIPTION_ID_KEY = 1004,   // INT32_TYPE
00102     FLOWS_KEY = 1005,             // BLOB_TYPE
00103 
00104     // range 1500-1999 is reserved for system filters
00105     REINFORCEMENT_KEY = 1500,     // BLOB_TYPE
00106     LATITUDE_KEY = 1501,          // FLOAT_TYPE
00107     LONGITUDE_KEY = 1502,         // FLOAT_TYPE
00108     ROUTE_KEY = 1503,             // STRING_TYPE
00109     SOURCE_ROUTE_KEY = 1504,      // STRING_TYPE
00110 
00111     // range 2000-2999 is app specific
00112     DATABLOCK_KEY = 2001,         // BLOB_TYPE
00113     TASK_FREQUENCY_KEY = 2002,    // FLOAT_TYPE, in secs
00114     TASK_NAME_KEY = 2003,         // STRING_TYPE
00115     TASK_QUERY_DETAIL_KEY = 2004, // BLOB_TYPE
00116     TARGET_KEY = 2005,            // STRING_TYPE
00117     TARGET_RANGE_KEY = 2006,      // FLOAT_TYPE
00118     CONFIDENCE_KEY = 2007,        // FLOAT_TYPE
00119 
00120     // RMST Keys
00121     RMST_DATA_KEY = 2010,         // BLOB_TYPE  The actual data (fragment)
00122     RMST_ID_KEY = 2011,           // INT32_TYPE Unique ID for the frag set
00123     RMST_FRAG_KEY = 2012,         // INT32_TYPE Fragment ID
00124     RMST_MAX_FRAG_KEY = 2013,     // INT32_TYPE Largest frag id in set
00125     RMST_TSPRT_CTL_KEY = 2014,    // INT32_TYPE Transport Control Messages
00126     RMST_PKTS_SENT_KEY = 2015,    // INT32_TYPE Support for blacklisting
00127     RMST_TARGET_KEY = 2016        // STRING_TYPE Type of Rmst Data
00128 
00129     // range 3000-3999 is reserved for experimentation
00130     // and user-defined keys
00131   };

enum NRAttribute::operators [inherited]
 

Enumerator:
IS 
LE 
GE 
LT 
GT 
EQ 
NE 
EQ_ANY 

Definition at line 149 of file nr.hh.

00149 { IS, LE, GE, LT, GT, EQ, NE, EQ_ANY };

enum NRAttribute::scopes [inherited]
 

Enumerator:
NODE_LOCAL_SCOPE 
GLOBAL_SCOPE 

Definition at line 136 of file nr.hh.

00136 { NODE_LOCAL_SCOPE = 11010, GLOBAL_SCOPE };

enum NRAttribute::types [inherited]
 

Enumerator:
INT32_TYPE 
FLOAT32_TYPE 
FLOAT64_TYPE 
STRING_TYPE 
BLOB_TYPE 

Definition at line 142 of file nr.hh.

00142              { INT32_TYPE,    // 32-bit signed integer
00143            FLOAT32_TYPE,  // 32-bit
00144            FLOAT64_TYPE,  // 64-bit
00145            STRING_TYPE,   // UTF-8 format, max length 1024 chars
00146            BLOB_TYPE };   // uninterpreted binary data


Constructor & Destructor Documentation

NRSimpleAttribute< void * >::NRSimpleAttribute int  key,
int  type,
int  op,
void *  val,
int  size
 

Definition at line 272 of file nr.cc.

References NRAttribute::BLOB_TYPE, NRAttribute::len_, NRSimpleAttribute< T >::setVal(), and NRAttribute::val_.

00272                                                                                            :
00273    NRAttribute(key, type, op, size)
00274 {
00275    assert(type == BLOB_TYPE);
00276    val_ = NULL;
00277    setVal(val, len_);
00278 }

Here is the call graph for this function:

NRSimpleAttribute< void * >::~NRSimpleAttribute  )  [inline]
 

Definition at line 266 of file nr.hh.

References NRAttribute::BLOB_TYPE, NRAttribute::type_, and NRAttribute::val_.

00266                        {
00267     assert(type_ == BLOB_TYPE);
00268     delete [] (char *) val_;
00269   };


Member Function Documentation

static NRAttribute* NRAttribute::find_key int  key,
NRAttrVec attrs,
NRAttrVec::iterator *  place = NULL
[inline, static, inherited]
 

Definition at line 157 of file nr.hh.

References NRAttribute::find_key_from().

00158                                                  {
00159 
00160     return find_key_from(key, attrs, attrs->begin(), place);
00161   };

Here is the call graph for this function:

NRAttribute * NRAttribute::find_key_from int  key,
NRAttrVec attrs,
NRAttrVec::iterator  start,
NRAttrVec::iterator *  place = NULL
[static, inherited]
 

Definition at line 115 of file nr.cc.

Referenced by NRSimpleAttributeFactory< T >::find(), NRSimpleAttributeFactory< T >::find_from(), NRAttribute::find_key(), NRAttribute::find_matching_key(), and NRAttribute::find_matching_key_from().

00117                                                {
00118    
00119    NRAttrVec::iterator i;
00120    
00121    for (i = start; i != attrs->end(); ++i) {
00122       if ((*i)->getKey() == key) {
00123      if (place)
00124         *place = i;
00125      return (*i);
00126       };
00127    };
00128    return NULL;
00129 }

NRAttribute* NRAttribute::find_matching_key NRAttrVec attrs,
NRAttrVec::iterator *  place = NULL
[inline, inherited]
 

Definition at line 173 of file nr.hh.

References NRAttribute::find_key_from(), and NRAttribute::key_.

00174                                                    {
00175     return find_key_from(key_, attrs, attrs->begin(), place);
00176   };

Here is the call graph for this function:

NRAttribute* NRAttribute::find_matching_key_from NRAttrVec attrs,
NRAttrVec::iterator  start,
NRAttrVec::iterator *  place = NULL
[inline, inherited]
 

Definition at line 167 of file nr.hh.

References NRAttribute::find_key_from(), and NRAttribute::key_.

00169                                                         {
00170     return find_key_from(key_, attrs, start, place);
00171   };

Here is the call graph for this function:

void* NRAttribute::getGenericVal  )  [inline, inherited]
 

Definition at line 183 of file nr.hh.

References NRAttribute::val_.

Referenced by NRAttribute::isEQ(), NRAttribute::isGE(), NRAttribute::isGT(), and PackAttrs().

00183 { return val_; };

int32_t NRAttribute::getKey  )  [inline, inherited]
 

Definition at line 178 of file nr.hh.

References NRAttribute::key_.

Referenced by CopyAttrs(), NRAttribute::isSameKey(), PackAttrs(), and PrintAttrs().

00178 { return key_; };

int NRSimpleAttribute< void * >::getLen  )  [inline]
 

Reimplemented from NRAttribute.

Definition at line 272 of file nr.hh.

References NRAttribute::len_.

00272 {return len_; };

int8_t NRAttribute::getOp  )  [inline, inherited]
 

Definition at line 180 of file nr.hh.

References NRAttribute::op_.

Referenced by DiffusionRouting::checkPublication(), DiffusionRouting::checkSubscription(), CopyAttrs(), GeoRoutingFilter::extractLocation(), PackAttrs(), PrintAttrs(), GradientFilter::processNewMessage(), and OnePhasePullFilter::processNewMessage().

00180 { return op_; };

int8_t NRAttribute::getType  )  [inline, inherited]
 

Definition at line 179 of file nr.hh.

References NRAttribute::type_.

Referenced by CopyAttrs(), NRAttribute::isSameKey(), PackAttrs(), and PrintAttrs().

00179 { return type_; };

void* NRSimpleAttribute< void * >::getVal  )  [inline]
 

Definition at line 271 of file nr.hh.

References NRAttribute::val_.

Referenced by PushSenderApp::run(), GearSenderApp::run(), TPPPingSenderApp::run(), and OPPPingSenderApp::run().

00271 { return (void *)val_; };

bool NRAttribute::isEQ NRAttribute attr  )  [inherited]
 

Definition at line 131 of file nr.cc.

References abort(), NRAttribute::BLOB_TYPE, NRAttribute::FLOAT32_TYPE, NRAttribute::FLOAT64_TYPE, NRAttribute::getGenericVal(), NRAttribute::getLen(), NRAttribute::INT32_TYPE, NRAttribute::isSameKey(), NRAttribute::len_, NRAttribute::STRING_TYPE, NRAttribute::type_, and NRAttribute::val_.

Referenced by NRAttribute::isNE().

00131                                         {
00132 
00133    // Keys need to be the same
00134    if (!isSameKey(attr))
00135       abort();
00136 
00137    switch (type_){
00138 
00139    case INT32_TYPE:
00140       return (*(int32_t *) val_ == *(int32_t *) attr->getGenericVal());
00141       break;
00142 
00143    case FLOAT32_TYPE:
00144       return (*(float *) val_ == *(float *) attr->getGenericVal());
00145       break;
00146 
00147    case FLOAT64_TYPE:
00148       return (*(double *) val_ == *(double *) attr->getGenericVal());
00149       break;
00150 
00151    case STRING_TYPE:
00152       if (len_ != attr->getLen())
00153         return false;
00154       return (!strncmp((char *) val_, (char *) attr->getGenericVal(), len_));
00155       break;
00156 
00157    case BLOB_TYPE:
00158       if (len_ != attr->getLen())
00159         return false;
00160       return (!memcmp((void *) val_, (void *) attr->getGenericVal(), len_));
00161       break;
00162 
00163    default:
00164       abort();
00165       break;
00166    }
00167 }

Here is the call graph for this function:

bool NRAttribute::isGE NRAttribute attr  )  [inherited]
 

Definition at line 215 of file nr.cc.

References abort(), NRAttribute::BLOB_TYPE, NRAttribute::FLOAT32_TYPE, NRAttribute::FLOAT64_TYPE, NRAttribute::getGenericVal(), NRAttribute::getLen(), NRAttribute::INT32_TYPE, NRAttribute::isSameKey(), NRAttribute::len_, min, NRAttribute::STRING_TYPE, NRAttribute::type_, and NRAttribute::val_.

Referenced by NRAttribute::isLT().

00215                                         {
00216 
00217    int cmplen, cmp;  // must be here for initialization reasons
00218 
00219    // Keys need to be the same
00220    if (!isSameKey(attr))
00221       abort();
00222 
00223    switch (type_) {
00224 
00225    case INT32_TYPE:
00226       return (*(int32_t *) val_ >= *(int32_t *) attr->getGenericVal());
00227       break;
00228 
00229    case FLOAT32_TYPE:
00230       return (*(float *) val_ >= *(float *) attr->getGenericVal());
00231       break;
00232 
00233    case FLOAT64_TYPE:
00234       return (*(double *) val_ >= *(double *) attr->getGenericVal());
00235       break;
00236 
00237    case STRING_TYPE:
00238       return (strcmp((char *) val_, (char *) attr->getGenericVal()) >= 0);
00239       break;
00240 
00241    case BLOB_TYPE:
00242       cmplen = min(len_, attr->getLen());
00243       cmp = memcmp((void *) val_, (void *) attr->getGenericVal(), cmplen);
00244       
00245       // We are greater or equal to attr
00246       if (cmp >= 0)
00247      return true;
00248       return false;
00249       break;
00250 
00251    default:
00252       abort();
00253       break;
00254    }
00255 }

Here is the call graph for this function:

bool NRAttribute::isGT NRAttribute attr  )  [inherited]
 

Definition at line 169 of file nr.cc.

References abort(), NRAttribute::BLOB_TYPE, NRAttribute::FLOAT32_TYPE, NRAttribute::FLOAT64_TYPE, NRAttribute::getGenericVal(), NRAttribute::getLen(), NRAttribute::INT32_TYPE, NRAttribute::isSameKey(), NRAttribute::len_, min, NRAttribute::STRING_TYPE, NRAttribute::type_, and NRAttribute::val_.

Referenced by NRAttribute::isLE().

00169                                         {
00170 
00171    int cmplen, cmp;  // must be here for initialization reasons
00172 
00173    // Keys need to be the same
00174    if (!isSameKey(attr))
00175       abort();
00176 
00177    switch (type_) {
00178 
00179    case INT32_TYPE:
00180       return (*(int32_t *) val_ > *(int32_t *) attr->getGenericVal());
00181       break;
00182 
00183    case FLOAT32_TYPE:
00184       return (*(float *) val_ > *(float *) attr->getGenericVal());
00185       break;
00186 
00187    case FLOAT64_TYPE:
00188       return (*(double *) val_ > *(double *) attr->getGenericVal());
00189       break;
00190 
00191    case STRING_TYPE:
00192       return strncmp((char *) val_, (char *) attr->getGenericVal(),
00193              min(len_, attr->getLen()));
00194       break;
00195 
00196    case BLOB_TYPE:
00197       cmplen = min(len_, attr->getLen());
00198       cmp = memcmp((void *) val_, (void *) attr->getGenericVal(), cmplen);
00199       
00200       // We are greater than attr
00201       if (cmp > 0)
00202      return true;
00203       // We are equal to attr up to len_, but we are longer
00204       if (cmp == 0 && (len_ > attr->getLen()))
00205      return true;
00206       return false;
00207       break;
00208 
00209    default:
00210       abort();
00211       break;
00212    }
00213 }

Here is the call graph for this function:

bool NRAttribute::isLE NRAttribute attr  )  [inline, inherited]
 

Definition at line 203 of file nr.hh.

References NRAttribute::isGT().

00203                                {
00204     return (!isGT(attr));
00205   };

Here is the call graph for this function:

bool NRAttribute::isLT NRAttribute attr  )  [inline, inherited]
 

Definition at line 199 of file nr.hh.

References NRAttribute::isGE().

00199                                {
00200     return (!isGE(attr));
00201   };

Here is the call graph for this function:

bool NRAttribute::isNE NRAttribute attr  )  [inline, inherited]
 

Definition at line 195 of file nr.hh.

References NRAttribute::isEQ().

00195                                {
00196     return (!isEQ(attr));
00197   };

Here is the call graph for this function:

bool NRAttribute::isSameKey NRAttribute attr  )  [inline, inherited]
 

Definition at line 185 of file nr.hh.

References NRAttribute::getKey(), NRAttribute::getType(), NRAttribute::key_, and NRAttribute::type_.

Referenced by NRAttribute::isEQ(), NRAttribute::isGE(), and NRAttribute::isGT().

00185                                     {
00186     return ((type_ == attr->getType()) && (key_ == attr->getKey()));
00187   };

Here is the call graph for this function:

void NRSimpleAttribute< void * >::setVal void *  value,
int  len
 

Definition at line 280 of file nr.cc.

References NRAttribute::len_, and NRAttribute::val_.

00280                                                            {
00281    delete [] (char *) val_;
00282    len_ = len;
00283    val_ = (void *) new char[len_];
00284    memcpy(val_, value, len_);
00285 }


Field Documentation

int32_t NRAttribute::key_ [protected, inherited]
 

Definition at line 205 of file nr.hh.

Referenced by NRAttribute::find_matching_key(), NRAttribute::find_matching_key_from(), NRAttribute::getKey(), NRAttribute::isSameKey(), and NRAttribute::NRAttribute().

int16_t NRAttribute::len_ [protected, inherited]
 

Definition at line 212 of file nr.hh.

Referenced by getLen(), NRSimpleAttribute< char * >::getLen(), NRSimpleAttribute< int >::getLen(), NRAttribute::getLen(), NRAttribute::isEQ(), NRAttribute::isGE(), NRAttribute::isGT(), NRAttribute::NRAttribute(), NRSimpleAttribute(), setVal(), and NRSimpleAttribute< char * >::setVal().

int8_t NRAttribute::op_ [protected, inherited]
 

Definition at line 211 of file nr.hh.

Referenced by NRAttribute::getOp(), and NRAttribute::NRAttribute().

int8_t NRAttribute::type_ [protected, inherited]
 

Definition at line 210 of file nr.hh.

Referenced by NRAttribute::getType(), NRAttribute::isEQ(), NRAttribute::isGE(), NRAttribute::isGT(), NRAttribute::isSameKey(), NRAttribute::NRAttribute(), ~NRSimpleAttribute(), NRSimpleAttribute< char * >::~NRSimpleAttribute(), and NRSimpleAttribute< int >::~NRSimpleAttribute().

void* NRAttribute::val_ [protected, inherited]
 

Definition at line 213 of file nr.hh.

Referenced by NRAttribute::getGenericVal(), getVal(), NRSimpleAttribute< char * >::getVal(), NRSimpleAttribute< int >::getVal(), NRAttribute::isEQ(), NRAttribute::isGE(), NRAttribute::isGT(), NRAttribute::NRAttribute(), NRSimpleAttribute< int >::NRSimpleAttribute(), NRSimpleAttribute(), NRSimpleAttribute< char * >::NRSimpleAttribute(), NRSimpleAttribute< int >::setVal(), setVal(), NRSimpleAttribute< char * >::setVal(), ~NRSimpleAttribute(), NRSimpleAttribute< char * >::~NRSimpleAttribute(), and NRSimpleAttribute< int >::~NRSimpleAttribute().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:23:04 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6