File: utils.h

package info (click to toggle)
imms 2.0.3-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 736 kB
  • ctags: 901
  • sloc: cpp: 5,532; ansic: 1,096; sh: 186; makefile: 113
file content (42 lines) | stat: -rw-r--r-- 821 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __UTILS_H
#define __UTILS_H

#include <sys/time.h>
#include <string>

#define     HOUR                    (60*60)
#define     DAY                     (24*HOUR)
#define     ROUND(x)                (int)((x) + 0.5)

using std::string;

int imms_random(int max);
time_t usec_diff(struct timeval &tv1, struct timeval &tv2);

class StackTimer
{
public:
    StackTimer();
    ~StackTimer();
private:
    struct timeval start;
};

class StackLockFile
{
public:
    StackLockFile(const string &_name);
    ~StackLockFile();
    bool isok() { return name != ""; }
private:
    string name;
};

string get_imms_root(const string &file = "");

string path_normalize(const string &path);

float rms_string_distance(const string &s1, const string &s2, int max = INT_MAX);
string rescale_bpmgraph(const string &graph);

#endif