libdap
Updated for version 3.21.0
libdap4 is an implementation of OPeNDAP's DAP protocol.
HTTPCacheMacros.h
1
/*
2
* HTTPCacheMacros.h
3
*
4
* Created on: Dec 28, 2011
5
* Author: jimg
6
*/
7
8
#ifndef HTTPCACHEMACROS_H_
9
#define HTTPCACHEMACROS_H_
10
11
#ifdef WIN32
12
#include <direct.h>
13
#include <fcntl.h>
14
#include <time.h>
15
#define MKDIR(a, b) _mkdir((a))
16
#define UMASK(a) _umask((a))
17
18
#if 0
19
#define REMOVE(a) \
20
do { \
21
int s = remove((a)); \
22
if (s != 0) \
23
throw InternalErr(__FILE__, __LINE__, "Cache error; could not remove file: " + long_to_string(s)); \
24
} while (0)
25
#endif
26
27
#define REMOVE_BOOL(a) remove((a))
28
#define REMOVE(a) ((void)remove((a)))
29
#define MKSTEMP(a) _open(_mktemp((a)), _O_CREAT, _S_IREAD | _S_IWRITE)
30
#define DIR_SEPARATOR_CHAR '\\'
31
#define DIR_SEPARATOR_STR "\\"
32
33
#else
34
#include <cerrno>
35
#define MKDIR(a, b) mkdir((a), (b))
36
#define UMASK(a) umask((a))
37
38
#if 0
39
// Replaced this with something that signals errors. jhrg 12/28/2011
40
// A great idea, but it breaks things in ways that complicate
41
// testing. Push this change forward to H 1.9. jhrg 12/28/2011
42
#define REMOVE(a) \
43
do { \
44
errno = 0; \
45
int s = remove((a)); \
46
if (s != 0) \
47
throw InternalErr(__FILE__, __LINE__, "Cache error; could not remove file: " + long_to_string(errno)); \
48
} while (0)
49
#endif
50
51
#define REMOVE_BOOL(a) remove((a))
52
#define REMOVE(a) ((void)remove((a)))
53
54
#define MKSTEMP(a) mkstemp((a))
55
#define DIR_SEPARATOR_CHAR '/'
56
#define DIR_SEPARATOR_STR "/"
57
#endif
58
59
#ifdef WIN32
60
#define CACHE_LOCATION "\\tmp\\"
61
#define CACHE_ROOT "dods-cache\\"
62
#else
63
#define CACHE_LOCATION "/tmp/"
64
#define CACHE_ROOT "dods-cache/"
65
#endif
66
67
#define CACHE_INDEX ".index"
68
#define CACHE_LOCK ".lock"
69
#define CACHE_META ".meta"
70
#define CACHE_EMPTY_ETAG "@cache@"
71
72
#endif
/* HTTPCACHEMACROS_H_ */
HTTPCacheMacros.h
Generated by
1.13.2