IBR-DTNSuite
0.8
|
00001 #ifndef UTILS_H_ 00002 #define UTILS_H_ 00003 00004 00005 #include "ibrdtn/data/Bundle.h" 00006 #include "ibrdtn/data/CustodySignalBlock.h" 00007 #include "ibrdtn/data/StatusReportBlock.h" 00008 #include "ibrdtn/data/PayloadBlock.h" 00009 00010 namespace dtn 00011 { 00012 namespace utils 00013 { 00014 class Utils 00015 { 00016 public: 00017 static void rtrim(std::string &str); 00018 static void ltrim(std::string &str); 00019 static void trim(std::string &str); 00020 00021 static vector<string> tokenize(std::string token, std::string data, size_t max = std::string::npos); 00022 static double distance(double lat1, double lon1, double lat2, double lon2); 00023 00024 static void encapsule(dtn::data::Bundle &capsule, const std::list<dtn::data::Bundle> &bundles); 00025 static void decapsule(const dtn::data::Bundle &capsule, std::list<dtn::data::Bundle> &bundles); 00026 00027 private: 00028 static void encapsule(ibrcommon::BLOB::Reference &ref, const std::list<dtn::data::Bundle> &bundles); 00029 static double toRad(double value); 00030 static const double pi; 00031 }; 00032 } 00033 } 00034 00035 #endif /*UTILS_H_*/