#include <nr.hh>
Inheritance diagram for NRAttribute:


Public Types | |
| enum | keys { SCOPE_KEY = 1001, CLASS_KEY = 1002, 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 } |
| enum | classes { INTEREST_CLASS = 10010, DISINTEREST_CLASS, DATA_CLASS } |
| enum | scopes { NODE_LOCAL_SCOPE = 11010, GLOBAL_SCOPE } |
| enum | types { INT32_TYPE, FLOAT32_TYPE, FLOAT64_TYPE, STRING_TYPE, BLOB_TYPE } |
| enum | operators { IS, LE, GE, LT, GT, EQ, NE, EQ_ANY } |
Public Member Functions | |
| NRAttribute () | |
| NRAttribute (int key, int type, int op, int len, void *val=NULL) | |
| NRAttribute (const NRAttribute &rhs) | |
| virtual | ~NRAttribute () |
| NRAttribute * | find_matching_key_from (NRAttrVec *attrs, NRAttrVec::iterator start, NRAttrVec::iterator *place=NULL) |
| NRAttribute * | find_matching_key (NRAttrVec *attrs, NRAttrVec::iterator *place=NULL) |
| int32_t | getKey () |
| int8_t | getType () |
| int8_t | getOp () |
| int16_t | getLen () |
| void * | getGenericVal () |
| bool | isSameKey (NRAttribute *attr) |
| bool | isEQ (NRAttribute *attr) |
| bool | isGT (NRAttribute *attr) |
| bool | isGE (NRAttribute *attr) |
| bool | isNE (NRAttribute *attr) |
| bool | isLT (NRAttribute *attr) |
| bool | isLE (NRAttribute *attr) |
Static Public Member Functions | |
| NRAttribute * | find_key (int key, NRAttrVec *attrs, NRAttrVec::iterator *place=NULL) |
| NRAttribute * | find_key_from (int key, NRAttrVec *attrs, NRAttrVec::iterator start, NRAttrVec::iterator *place=NULL) |
Protected Attributes | |
| int32_t | key_ |
| int8_t | type_ |
| int8_t | op_ |
| int16_t | len_ |
| void * | val_ |
|
|
Definition at line 100 of file nr.hh.
00100 { INTEREST_CLASS = 10010, DISINTEREST_CLASS, DATA_CLASS };
|
|
|
Definition at line 72 of file nr.hh.
00072 {
00073 // reserved constant values used for key
00074 // range 1000-1499 is diffusion-specific
00075 SCOPE_KEY = 1001, // INT32_TYPE
00076 CLASS_KEY = 1002, // INT32_TYPE
00077
00078 // range 1500-1999 is reserved for system filters
00079 REINFORCEMENT_KEY = 1500, // BLOB_TYPE
00080 LATITUDE_KEY = 1501, // FLOAT_TYPE
00081 LONGITUDE_KEY = 1502, // FLOAT_TYPE
00082 ROUTE_KEY = 1503, // STRING_TYPE
00083 SOURCE_ROUTE_KEY = 1504, // STRING_TYPE
00084
00085 // range 2000-2999 is app specific
00086 DATABLOCK_KEY = 2001, // BLOB_TYPE
00087 TASK_FREQUENCY_KEY = 2002, // FLOAT_TYPE, in secs
00088 TASK_NAME_KEY = 2003, // STRING_TYPE
00089 TASK_QUERY_DETAIL_KEY = 2004, // BLOB_TYPE
00090 TARGET_KEY = 2005, // STRING_TYPE
00091 TARGET_RANGE_KEY = 2006, // FLOAT_TYPE
00092 CONFIDENCE_KEY = 2007 // FLOAT_TYPE
00093
00094 // range 3000-3999 is reserved for experimentation
00095 // and user-defined keys
00096 };
|
|
|
Definition at line 111 of file nr.hh.
|
|
|
Definition at line 101 of file nr.hh.
00101 { NODE_LOCAL_SCOPE = 11010, GLOBAL_SCOPE };
|
|
|
Definition at line 104 of file nr.hh.
00104 { INT32_TYPE, // 32-bit signed integer
00105 FLOAT32_TYPE, // 32-bit
00106 FLOAT64_TYPE, // 64-bit
00107 STRING_TYPE, // UTF-8 format, max length 1024 chars
00108 BLOB_TYPE }; // uninterpreted binary data
|
|
|
Definition at line 47 of file nr.cc.
|
|
||||||||||||||||||||||||
|
Definition at line 38 of file nr.cc. References len, len_, and val_.
|
|
|
Definition at line 52 of file nr.cc. References key_, len_, op_, type_, and val_.
|
|
|
Definition at line 62 of file nr.cc.
00063 {
00064 }
|
|
||||||||||||||||
|
Definition at line 119 of file nr.hh. References find_key_from().
00120 {
00121
00122 return find_key_from(key, attrs, attrs->begin(), place);
00123 };
|
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 66 of file nr.cc. Referenced by NRSimpleAttributeFactory< T >::find(), NRSimpleAttributeFactory< T >::find_from(), find_key(), find_matching_key(), and find_matching_key_from().
00068 {
00069
00070 NRAttrVec::iterator i;
00071
00072 for (i = start; i != attrs->end(); ++i) {
00073 if ((*i)->getKey() == key) {
00074 if (place)
00075 *place = i;
00076 return (*i);
00077 };
00078 };
00079 return NULL;
00080 }
|
|
||||||||||||
|
Definition at line 135 of file nr.hh. References find_key_from(), and key_.
00136 {
00137 return find_key_from(key_, attrs, attrs->begin(), place);
00138 };
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 129 of file nr.hh. References find_key_from(), and key_. Referenced by OneWayMatch(), and OneWayPerfectMatch().
00131 {
00132 return find_key_from(key_, attrs, start, place);
00133 };
|
Here is the call graph for this function:

|
|
Definition at line 145 of file nr.hh. References val_. Referenced by isEQ(), isGE(), isGT(), and PackAttrs().
00145 { return val_; };
|
|
|
Definition at line 140 of file nr.hh. Referenced by CopyAttrs(), isSameKey(), PackAttrs(), and PrintAttrs().
00140 { return key_; };
|
|
|
Reimplemented in NRSimpleAttribute< T >, NRSimpleAttribute< char * >, NRSimpleAttribute< void * >, and NRSimpleAttribute< int >. Definition at line 143 of file nr.hh. Referenced by CalculateSize(), CopyAttrs(), isEQ(), isGE(), isGT(), PackAttrs(), and PrintAttrs().
00143 { return len_; };
|
|
|
Definition at line 142 of file nr.hh. Referenced by DiffusionRouting::checkPublication(), DiffusionRouting::checkSubscription(), CopyAttrs(), GeoRoutingFilter::extractLocation(), OneWayMatch(), OneWayPerfectMatch(), PackAttrs(), PrintAttrs(), and GradientFilter::processNewMessage().
00142 { return op_; };
|
|
|
Definition at line 141 of file nr.hh. Referenced by CopyAttrs(), isSameKey(), PackAttrs(), and PrintAttrs().
00141 { return type_; };
|
|
|
Definition at line 82 of file nr.cc. References abort(), BLOB_TYPE, FLOAT32_TYPE, FLOAT64_TYPE, getGenericVal(), getLen(), int32_t, INT32_TYPE, isSameKey(), len_, STRING_TYPE, type_, and val_. Referenced by isNE(), OneWayMatch(), and OneWayPerfectMatch().
00082 {
00083
00084 // Keys need to be the same
00085 if (!isSameKey(attr))
00086 abort();
00087
00088 switch (type_){
00089
00090 case INT32_TYPE:
00091 return (*(int32_t *) val_ == *(int32_t *) attr->getGenericVal());
00092 break;
00093
00094 case FLOAT32_TYPE:
00095 return (*(float *) val_ == *(float *) attr->getGenericVal());
00096 break;
00097
00098 case FLOAT64_TYPE:
00099 return (*(double *) val_ == *(double *) attr->getGenericVal());
00100 break;
00101
00102 case STRING_TYPE:
00103 if (len_ != attr->getLen())
00104 return false;
00105 return (!strncmp((char *) val_, (char *) attr->getGenericVal(), len_));
00106 break;
00107
00108 case BLOB_TYPE:
00109 if (len_ != attr->getLen())
00110 return false;
00111 return (!memcmp((void *) val_, (void *) attr->getGenericVal(), len_));
00112 break;
00113
00114 default:
00115 abort();
00116 break;
00117 }
00118 }
|
Here is the call graph for this function:

|
|
Definition at line 166 of file nr.cc. References abort(), BLOB_TYPE, FLOAT32_TYPE, FLOAT64_TYPE, getGenericVal(), getLen(), int32_t, INT32_TYPE, isSameKey(), len_, min, STRING_TYPE, type_, and val_. Referenced by isLT(), and OneWayMatch().
00166 {
00167
00168 int cmplen, cmp; // must be here for initialization reasons
00169
00170 // Keys need to be the same
00171 if (!isSameKey(attr))
00172 abort();
00173
00174 switch (type_) {
00175
00176 case INT32_TYPE:
00177 return (*(int32_t *) val_ >= *(int32_t *) attr->getGenericVal());
00178 break;
00179
00180 case FLOAT32_TYPE:
00181 return (*(float *) val_ >= *(float *) attr->getGenericVal());
00182 break;
00183
00184 case FLOAT64_TYPE:
00185 return (*(double *) val_ >= *(double *) attr->getGenericVal());
00186 break;
00187
00188 case STRING_TYPE:
00189 return (strcmp((char *) val_, (char *) attr->getGenericVal()) >= 0);
00190 break;
00191
00192 case BLOB_TYPE:
00193 cmplen = min(len_, attr->getLen());
00194 cmp = memcmp((void *) val_, (void *) attr->getGenericVal(), cmplen);
00195
00196 // We are greater or equal to attr
00197 if (cmp >= 0)
00198 return true;
00199 return false;
00200 break;
00201
00202 default:
00203 abort();
00204 break;
00205 }
00206 }
|
Here is the call graph for this function:

|
|
Definition at line 120 of file nr.cc. References abort(), BLOB_TYPE, FLOAT32_TYPE, FLOAT64_TYPE, getGenericVal(), getLen(), int32_t, INT32_TYPE, isSameKey(), len_, min, STRING_TYPE, type_, and val_. Referenced by isLE(), and OneWayMatch().
00120 {
00121
00122 int cmplen, cmp; // must be here for initialization reasons
00123
00124 // Keys need to be the same
00125 if (!isSameKey(attr))
00126 abort();
00127
00128 switch (type_) {
00129
00130 case INT32_TYPE:
00131 return (*(int32_t *) val_ > *(int32_t *) attr->getGenericVal());
00132 break;
00133
00134 case FLOAT32_TYPE:
00135 return (*(float *) val_ > *(float *) attr->getGenericVal());
00136 break;
00137
00138 case FLOAT64_TYPE:
00139 return (*(double *) val_ > *(double *) attr->getGenericVal());
00140 break;
00141
00142 case STRING_TYPE:
00143 return strncmp((char *) val_, (char *) attr->getGenericVal(),
00144 min(len_, attr->getLen()));
00145 break;
00146
00147 case BLOB_TYPE:
00148 cmplen = min(len_, attr->getLen());
00149 cmp = memcmp((void *) val_, (void *) attr->getGenericVal(), cmplen);
00150
00151 // We are greater than attr
00152 if (cmp > 0)
00153 return true;
00154 // We are equal to attr up to len_, but we are longer
00155 if (cmp == 0 && (len_ > attr->getLen()))
00156 return true;
00157 return false;
00158 break;
00159
00160 default:
00161 abort();
00162 break;
00163 }
00164 }
|
Here is the call graph for this function:

|
|
Definition at line 165 of file nr.hh. References isGT(). Referenced by OneWayMatch().
00165 {
00166 return (!isGT(attr));
00167 };
|
Here is the call graph for this function:

|
|
Definition at line 161 of file nr.hh. References isGE(). Referenced by OneWayMatch().
00161 {
00162 return (!isGE(attr));
00163 };
|
Here is the call graph for this function:

|
|
Definition at line 157 of file nr.hh. References isEQ(). Referenced by OneWayMatch().
00157 {
00158 return (!isEQ(attr));
00159 };
|
Here is the call graph for this function:

|
|
Definition at line 147 of file nr.hh. References getKey(), getType(), key_, and type_. Referenced by isEQ(), isGE(), and isGT().
|
Here is the call graph for this function:

|
|
Definition at line 171 of file nr.hh. Referenced by find_matching_key(), find_matching_key_from(), getKey(), isSameKey(), and NRAttribute(). |
|
|
Definition at line 174 of file nr.hh. Referenced by NRSimpleAttribute< int >::getLen(), getLen(), isEQ(), isGE(), isGT(), NRAttribute(), NRSimpleAttribute< void * >::NRSimpleAttribute(), NRSimpleAttribute< void * >::setVal(), and NRSimpleAttribute< char * >::setVal(). |
|
|
Definition at line 173 of file nr.hh. Referenced by getOp(), and NRAttribute(). |
|
|
Definition at line 172 of file nr.hh. Referenced by getType(), isEQ(), isGE(), isGT(), isSameKey(), NRAttribute(), and NRSimpleAttribute< int >::~NRSimpleAttribute(). |
|
1.3.3