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

📄 path.h

📁 大名鼎鼎的传感器网络仿真实验室平台SENSE
💻 H
字号:
#ifndef	_path_h_#define	_path_h_#include <string>using std::string;template <int size>class path_t{ public:  path_t(): length(0), index( 0), overFlow( false) {}  void AddNode(ether_addr_t& n)    {      if( length < size)	nodes[ length] = n;      else	overFlow = true;      length++;      return;    }  void Clear() { length=0; }  const char* ToString()      {	static string str;	str = "";	char buff[10];	int	L2=length > 15 ? 15 : length;		sprintf( buff, " {%2d}", length);	str += buff;	for(int i=0;i<L2;i++)	{	  sprintf(buff," %3d", (int) nodes[i] );	  str += buff;	}	return str.c_str();      }  bool	firstNode( int &node)    {      index = 0;      return nextNode( node);    }  bool	nextNode( int &node)    {      if( index < length)      {	node = (int) nodes[ index++];	return true;      }      else	return false;    }  bool	getOverFlow() const	{ return overFlow; }  int	getLength() const	{ return length; } private:  ether_addr_t	nodes[size];  int		length;  int		index;  bool		overFlow;};#ifndef	VR_SIZE#define VR_SIZE 20#endif	//VR_SIZEtypedef path_t<VR_SIZE>	Path;#endif	// _path_h_

⌨️ 快捷键说明

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