File: Utilities.h

package info (click to toggle)
proda 1.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 584 kB
  • sloc: cpp: 8,549; xml: 163; makefile: 109; sh: 12
file content (37 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download | duplicates (4)
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
//////////////////////////////////////////////////////////////////////
// Utilities.h
//
// Miscellaneous utility routines for ProDA.
//////////////////////////////////////////////////////////////////////

#ifndef UTILITIES_H
#define UTILITIES_H

#include <stdio.h>

// reading character buffer of arbitrary size from a file

int GetData (FILE *file, char *&buffer, 
	     const char *terminatingChars,
	     const char *skipChars);

// duplicate string

char *StrDup (const char *s);

char *SubString (const char *s, int i, int j);

// math utility functions

inline int    min (int    a, int    b){ if (a < b) return a; return b; }
inline float  min (float  a, float  b){ if (a < b) return a; return b; }
inline double min (double a, double b){ if (a < b) return a; return b; }
inline int    max (int    a, int    b){ if (a > b) return a; return b; }
inline float  max (float  a, float  b){ if (a > b) return a; return b; }
inline double max (double a, double b){ if (a > b) return a; return b; }
inline void swap(int &a, int &b){int tmp = a;a = b; b= tmp;}

//
int Overlap(int b1, int e1, int b2, int e2);

#endif