37 std::string::size_type endpos = str.find_last_not_of(
" \t");
38 if( string::npos != endpos )
40 str = str.substr( 0, endpos+1 );
47 std::string::size_type startpos = str.find_first_not_of(
" \t");
48 if( string::npos != startpos )
50 str = str.substr( startpos );
60 std::vector<std::string>
Utils::tokenize(
const std::string &token,
const std::string &data,
const std::string::size_type max)
62 std::vector<std::string> l;
66 std::string::size_type pos = data.find_first_not_of(token, 0);
68 std::string::size_type tokenPos = 0;
70 while (pos != string::npos)
75 tokenPos = std::string::npos;
80 tokenPos = data.find_first_of(token, pos);
83 if (tokenPos == std::string::npos) {
85 value = data.substr(pos);
92 value = data.substr(pos, tokenPos - pos);
96 pos = data.find_first_not_of(token, tokenPos);
107 const double r = 6371;
109 double dLat = toRad( (lat2-lat1) );
110 double dLon = toRad( (lon2-lon1) );
112 double a = sin(dLat/2) * sin(dLat/2) +
113 cos(toRad(lat1)) * cos(toRad(lat2)) *
114 sin(dLon/2) * sin(dLon/2);
115 double c = 2 * atan2(sqrt(a), sqrt(1-a));
119 const double Utils::pi = 3.14159;
121 double Utils::toRad(
double value)
123 return value * pi / 180;
128 bool custody =
false;
153 for (std::list<dtn::data::Bundle>::const_iterator iter = bundles.begin(); iter != bundles.end(); ++iter)
161 if (expt > exp_time) exp_time = expt;
180 (*stream) << elements;
186 std::list<dtn::data::Bundle>::const_iterator iter = bundles.begin();
188 for (
size_t i = 0; i < (bundles.size() - 1); i++, iter++)
195 for (std::list<dtn::data::Bundle>::const_iterator iter = bundles.begin(); iter != bundles.end(); ++iter)
197 serializer << (*iter);
211 for (
size_t i = 0; (nob - 1) > i; ++i)
222 for (
size_t i = 0; nob > i; ++i)
237 std::stringstream ss;