⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attribute.cc

📁 基于Oment++的无线传感器网络仿真
💻 CC
字号:
#include <stdio.h>   // for null#include <string.h>  // for strdup#include <algorithm>  // for stl min#include "Attribute.h"Attribute::Attribute(int key, int op, float val){   key_ = key;   op_ = op ;   val_ = val;}Attribute::Attribute() :       key_(0), op_(0), val_(0.0) {}Attribute::~Attribute(){//	printf(" In attribute destructor \n");}Attribute Attribute::find_key_from(int key, AttrVec *attrs) {   AttrVec::iterator i;   for (i = attrs->begin(); i != attrs->end(); ++i) {  //printf(" key is in for %d\n",(*i).getKey());      if ( (*i).getKey() == key) {	//  printf(" key is %f\n",(*i).getVal());	 return (*i);      }   }   //printf("returning NULL\n");   return (*i);}bool Attribute::compareAttribute(float value){	//printf("Attribute::compareAttribute op====%d", op_);	switch (op_)	{		case LE:			return isLE(value);		break;		case GE:			return isGE(value);		break;		case LT:			return isLT(value);		break;		case GT:			return isGT(value);		break;		case EQ:			return isEQ(value);		break;		case NE:			return isNE(value);		break;		case EQ_ANY:			return true;		break;	}}	bool Attribute::isEQ(float value) {     return ( val_ ==  value);}bool Attribute::isGT(float value) {     return ( value >  val_);}bool Attribute::isGE(float value) {     return ( value >=  val_);}/*AttributeFactory::AttributeFactory(){}Attribute* AttributeFactory::LatitudeAttr(int op,float val){	Attribute* LatAtr=new Attribute(Attribute::LONGITUDE,op,val);	return LatAtr;}*/

⌨️ 快捷键说明

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