Mercurial Hosting > traffic-intelligence
comparison include/utils.hpp @ 20:ef0d7caf8e91
draft code for feature saving (UBC format)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sat, 28 Nov 2009 01:56:46 -0500 |
parents | ff5403319cec |
children | a52653dca25d |
comparison
equal
deleted
inserted
replaced
19:5a21d2cfee44 | 20:ef0d7caf8e91 |
---|---|
1 #ifndef UTILS_HPP | 1 #ifndef UTILS_HPP |
2 #define UTILS_HPP | 2 #define UTILS_HPP |
3 | 3 |
4 #include <iofwd> | |
5 | |
4 static const double pi = 3.14159265358979323846; | 6 static const double pi = 3.14159265358979323846; |
7 | |
8 /** Opens file for writing with fixed scientific precision. */ | |
9 void openWriteScientific(ofstream& out, const string& filename, const int& precision); | |
10 | |
11 void openWritePrecision(ofstream& out, const string& filename, const int& precision); | |
12 | |
13 /** Opens files and checks how it went. */ | |
14 bool openCheck(ifstream& f, const string& filename, const string& callingFunctionName); | |
15 bool openCheck(ofstream& f, const string& filename, const string& callingFunctionName); | |
16 | |
17 | |
18 // inline | |
5 | 19 |
6 inline double square(const int& a) { return a*a;} | 20 inline double square(const int& a) { return a*a;} |
7 | 21 |
8 /** Implements key bindings, for example for cvWaitKey(). */ | 22 /** Implements key bindings, for example for cvWaitKey(). */ |
9 inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');} | 23 inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');} |