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

📄 bandwidth_map.h

📁 这是一个著名的应用层组播中间件的源码
💻 H
字号:
#ifndef __bandwidth_map#define __bandwidth_map#include <map>#include <set>#ifdef GCC3#include <ext/hash_map>using namespace __gnu_cxx;#else#include <hash_map>#endif// represents a single data pointstruct bw {	bw(int in, int out) { this->in = in; this->out = out; }	void print();	int in;	int out;	std::set<int>  allowedin;	std::set<int> allowedout;};struct bw_time_compare {	bool operator()(const int& t1, const int& t2) {		return t2 < t1; // reverse order	}};typedef std::map<int,bw,bw_time_compare> time_bw_map_t;typedef hash_map<int,time_bw_map_t*> node_hashmap_t;class bandwidth_map {  public:	 	bandwidth_map(const char* rawfile, const char* precompfile, int compute); 	bandwidth_map(const char* rawfile); 	bool attempt_to_peer(int node, int peer, int time);	void calculate_peers();	void print();		void parse_rawfile(const char* rawfile);	void output_precompfile(const char* precompfile);	void parse_precompfile(const char* precompfile);	int in(int node, int time);	int out(int node, int time);	void get_in_peers(int node, int time, std::set<int>& inpeers);	void get_out_peers(int node, int time, std::set<int>& outpeers);	std::set<int>& get_in_peers(int node, int time);	std::set<int>& get_out_peers(int node, int time);		bool allow_in(int giver, int getter, int time);		// node -->[time --> bw]	hash_map<int,std::map<int,bw,bw_time_compare>*> nodes;	std::set<int> times; // stores unique times, just so we can iterate conveniently	};#endif

⌨️ 快捷键说明

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