attribute.h

来自「基于Oment++的无线传感器网络仿真」· C头文件 代码 · 共 74 行

H
74
字号
#ifndef _NR_HH_#define _NR_HH_#include <stdio.h>#include <stdlib.h>#include <vector>// #include "CommonIncludes.h"class Attribute;typedef std::vector<Attribute> AttrVec;class Attribute{public:  enum keys {    // reserved constant values used for key    // range 1000-1499 is diffusion-specific    LONGITUDE_L = 1001,    LATITUDE_L = 1002,    LONGITUDE_R = 1003,    LATITUDE_R = 1004,	LONGITUDE = 1005,	LATITUDE = 1006,	RADIUS = 1007  };  // Match Operator values  enum operators { IS, LE, GE, LT, GT, EQ, NE, EQ_ANY };  // with EQ_ANY, the val is ignored  Attribute();  Attribute(int key, int op, float val = 0.0);  virtual ~Attribute();  bool compareAttribute(float value);  static Attribute find_key_from(int key, AttrVec *attrs);  int32_t getKey() { return key_; };  int8_t getOp() { return op_; };  float getVal() { return val_; };  /*bool isSameKey(NRAttribute *attr) {    return ((type_ == attr->getType()) && (key_ == attr->getKey()));  };*/  bool isEQ(float value);  bool isGT(float value);  bool isGE(float value);  bool isNE(float value) {    return (!isEQ(value));  };  bool isLE(float value) {  	//printf( " IN LE \n");    return (!isGT(value));  };  bool isLT(float value) {    return (!isGE(value));  };  protected:  int32_t key_;  int8_t  op_;  float val_;};#endif 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?