📄 node.h
字号:
/* $Id: node.h,v 1.3 2006-08-12 20:50:06 jonathan Exp $ * Jonathan Ledlie, Harvard University. * Copyright 2005. All rights reserved. */#ifndef NODE_H#define NODE_H#include "sim.h"#include "point.h"#include "samples.h"class Node { friend ostream& operator << (ostream& os, Node& n); private: bool alive; long birthTime; long deathTime; set<int> neighbors; public: map<int,Samples*> node2samples; double weightedError; int lastUpdateTo; int lastUpdateFrom; int sampleCount; int id; double distanceDelta; vector<double> fixedSample; Node (); ~Node (); Point *vec; Point *appVector; Point *nearestNeighbor; deque<Point*> startCoords; deque<Point*> currentCoords; int fixedNearestNeighborId; double fixedNearestNeighborDistance; bool isInInitialState (); bool hasConfidence (); void clearCoords (); void processSample (int o_stamp, int myId, int o_yourId, float o_rawLatency); double getSample (int yourId); void addSample (int yourId, double sample, Point *yourCoord, double yourWeightedError, Point *yourAppCoord, int stamp); bool updateAppVector (double systemDistanceDelta, int stamp, double &appComparison); void printVector (); void addDistanceDelta (double dd); double findLocalRelativeDistance (Point *startCentroid, Point *currentCentroid); double findEnergyDistance (); void addToNearestNeighbor (Point *neighbor, int timestamp); void setFixedSample (int yourId, double sample); double getFixedSample (int yourId); double getFixedSamplePercentile (double p); void setFixedSampleArray (int nodeCount); void printCoord (FILE *fp); void printAppCoord (FILE *fp); void printStat (FILE *fp); static char appCoordUpdateMethod; static uint windowSize; static double appCoordUpdateThreshold; void birth (); void assignNeighbors (); void assignCoords (); void death (); bool isAlive (); int takeTurn (); void nnQuery (int dstNodeId, int &resultNodeId, deque<int> &hopNodeIds, double &delay); void findNNQueryHops (Point *target, set<int> &hopNodeIds);};extern float **rtts;extern int nodeCount;extern Node *node;extern int **neighbors;extern int neighborCount;extern int withinMeasurementError;extern int maxNeighborCount;extern double measurement_error;extern bool FULL_LATENCY_MATRIX;extern int SAMPLE_EXPIRATION;extern double ERROR_FRACTION;extern double DAMPENING_FRACTION;extern bool USE_CONFIDENCE;extern double INITIAL_WEIGHTED_ERROR;extern int APP_VECTOR_HISTORY_TIME;extern FILE *secFP;extern vector<double> sec_sysRawRE_list;extern double sec_sysDD_sum;extern vector<double> sec_appRawRE_list;extern double sec_appDD_sum;extern FILE *runLogFP;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -