diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-12-03 17:05:26 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-12-03 17:05:26 +0000 |
commit | 0bd8b8cf19687229b53e37468dfe36c4217fbbf1 (patch) | |
tree | 9597c83c6770473b7dc43b6917a8787f0d4c87c6 /src/trace.h | |
parent | 6f3b85c5af1855e1695885fb28220c34f6a0673f (diff) | |
download | libbu++-0bd8b8cf19687229b53e37468dfe36c4217fbbf1.tar.gz libbu++-0bd8b8cf19687229b53e37468dfe36c4217fbbf1.tar.bz2 libbu++-0bd8b8cf19687229b53e37468dfe36c4217fbbf1.tar.xz libbu++-0bd8b8cf19687229b53e37468dfe36c4217fbbf1.zip |
Alright, the caching system now passes the basic CRUD tests with arbitrary
keytypes. It doesn't yet use the stackable CacheStore concept, but the code
is all in place to make it easy to switch to. There also needs to be some more
accounting code in place, so that we can actually use the Schedulers, whatever
they happen to be called in the future.
A whacky side note, it turns out that we totally need to ensure an object is
loaded from the cache in order to delete it, we can't ensure that any
references to other objects that are in the cache will be loaded otherwise.
Diffstat (limited to '')
-rw-r--r-- | src/trace.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/trace.h b/src/trace.h index 82399c2..049d138 100644 --- a/src/trace.h +++ b/src/trace.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
12 | #include <stdint.h> | 12 | #include <stdint.h> |
13 | #include <stddef.h> | 13 | #include <stddef.h> |
14 | #include <string.h> | ||
14 | 15 | ||
15 | namespace Bu | 16 | namespace Bu |
16 | { | 17 | { |
@@ -26,7 +27,12 @@ namespace Bu | |||
26 | #define looper( vv ) \ | 27 | #define looper( vv ) \ |
27 | for( ; *n; n++ ) \ | 28 | for( ; *n; n++ ) \ |
28 | { \ | 29 | { \ |
29 | if( *n == ',' || *n == ')' ) \ | 30 | if( bInBracket == true ) \ |
31 | { \ | ||
32 | if( *n == '>' ) \ | ||
33 | bInBracket = false; \ | ||
34 | } \ | ||
35 | else if( *n == ',' || *n == ')' ) \ | ||
30 | { \ | 36 | { \ |
31 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); \ | 37 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); \ |
32 | fwrite("=", 1, 1, stdout); \ | 38 | fwrite("=", 1, 1, stdout); \ |
@@ -35,6 +41,10 @@ namespace Bu | |||
35 | n++; \ | 41 | n++; \ |
36 | break; \ | 42 | break; \ |
37 | } \ | 43 | } \ |
44 | else if( *n == '<' ) \ | ||
45 | { \ | ||
46 | bInBracket = true; \ | ||
47 | } \ | ||
38 | } (void)0 | 48 | } (void)0 |
39 | 49 | ||
40 | template<typename t1> void __tracer( const char *pf, t1 &v1 ) | 50 | template<typename t1> void __tracer( const char *pf, t1 &v1 ) |
@@ -42,8 +52,9 @@ namespace Bu | |||
42 | printf("trace: "); | 52 | printf("trace: "); |
43 | const char *s = pf; | 53 | const char *s = pf; |
44 | const char *n = pf; | 54 | const char *n = pf; |
55 | bool bInBracket = false; | ||
45 | looper( v1 ); | 56 | looper( v1 ); |
46 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 57 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
47 | fwrite( "\n", 1, 1, stdout ); | 58 | fwrite( "\n", 1, 1, stdout ); |
48 | fflush( stdout ); | 59 | fflush( stdout ); |
49 | } | 60 | } |
@@ -54,9 +65,10 @@ namespace Bu | |||
54 | printf("trace: "); | 65 | printf("trace: "); |
55 | const char *s = pf; | 66 | const char *s = pf; |
56 | const char *n = pf; | 67 | const char *n = pf; |
68 | bool bInBracket = false; | ||
57 | looper( v1 ); | 69 | looper( v1 ); |
58 | looper( v2 ); | 70 | looper( v2 ); |
59 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 71 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
60 | fwrite( "\n", 1, 1, stdout ); | 72 | fwrite( "\n", 1, 1, stdout ); |
61 | fflush( stdout ); | 73 | fflush( stdout ); |
62 | } | 74 | } |
@@ -67,10 +79,11 @@ namespace Bu | |||
67 | printf("trace: "); | 79 | printf("trace: "); |
68 | const char *s = pf; | 80 | const char *s = pf; |
69 | const char *n = pf; | 81 | const char *n = pf; |
82 | bool bInBracket = false; | ||
70 | looper( v1 ); | 83 | looper( v1 ); |
71 | looper( v2 ); | 84 | looper( v2 ); |
72 | looper( v3 ); | 85 | looper( v3 ); |
73 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 86 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
74 | fwrite( "\n", 1, 1, stdout ); | 87 | fwrite( "\n", 1, 1, stdout ); |
75 | fflush( stdout ); | 88 | fflush( stdout ); |
76 | } | 89 | } |
@@ -81,11 +94,12 @@ namespace Bu | |||
81 | printf("trace: "); | 94 | printf("trace: "); |
82 | const char *s = pf; | 95 | const char *s = pf; |
83 | const char *n = pf; | 96 | const char *n = pf; |
97 | bool bInBracket = false; | ||
84 | looper( v1 ); | 98 | looper( v1 ); |
85 | looper( v2 ); | 99 | looper( v2 ); |
86 | looper( v3 ); | 100 | looper( v3 ); |
87 | looper( v4 ); | 101 | looper( v4 ); |
88 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 102 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
89 | fwrite( "\n", 1, 1, stdout ); | 103 | fwrite( "\n", 1, 1, stdout ); |
90 | fflush( stdout ); | 104 | fflush( stdout ); |
91 | } | 105 | } |
@@ -96,12 +110,13 @@ namespace Bu | |||
96 | printf("trace: "); | 110 | printf("trace: "); |
97 | const char *s = pf; | 111 | const char *s = pf; |
98 | const char *n = pf; | 112 | const char *n = pf; |
113 | bool bInBracket = false; | ||
99 | looper( v1 ); | 114 | looper( v1 ); |
100 | looper( v2 ); | 115 | looper( v2 ); |
101 | looper( v3 ); | 116 | looper( v3 ); |
102 | looper( v4 ); | 117 | looper( v4 ); |
103 | looper( v5 ); | 118 | looper( v5 ); |
104 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 119 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
105 | fwrite( "\n", 1, 1, stdout ); | 120 | fwrite( "\n", 1, 1, stdout ); |
106 | fflush( stdout ); | 121 | fflush( stdout ); |
107 | } | 122 | } |
@@ -114,13 +129,14 @@ namespace Bu | |||
114 | printf("trace: "); | 129 | printf("trace: "); |
115 | const char *s = pf; | 130 | const char *s = pf; |
116 | const char *n = pf; | 131 | const char *n = pf; |
132 | bool bInBracket = false; | ||
117 | looper( v1 ); | 133 | looper( v1 ); |
118 | looper( v2 ); | 134 | looper( v2 ); |
119 | looper( v3 ); | 135 | looper( v3 ); |
120 | looper( v4 ); | 136 | looper( v4 ); |
121 | looper( v5 ); | 137 | looper( v5 ); |
122 | looper( v6 ); | 138 | looper( v6 ); |
123 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 139 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
124 | fwrite( "\n", 1, 1, stdout ); | 140 | fwrite( "\n", 1, 1, stdout ); |
125 | fflush( stdout ); | 141 | fflush( stdout ); |
126 | } | 142 | } |
@@ -133,6 +149,7 @@ namespace Bu | |||
133 | printf("trace: "); | 149 | printf("trace: "); |
134 | const char *s = pf; | 150 | const char *s = pf; |
135 | const char *n = pf; | 151 | const char *n = pf; |
152 | bool bInBracket = false; | ||
136 | looper( v1 ); | 153 | looper( v1 ); |
137 | looper( v2 ); | 154 | looper( v2 ); |
138 | looper( v3 ); | 155 | looper( v3 ); |
@@ -140,7 +157,7 @@ namespace Bu | |||
140 | looper( v5 ); | 157 | looper( v5 ); |
141 | looper( v6 ); | 158 | looper( v6 ); |
142 | looper( v7 ); | 159 | looper( v7 ); |
143 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, 1, stdout ); | 160 | fwrite( s, (ptrdiff_t)n-(ptrdiff_t)s, strlen(s), stdout ); |
144 | fwrite( "\n", 1, 1, stdout ); | 161 | fwrite( "\n", 1, 1, stdout ); |
145 | fflush( stdout ); | 162 | fflush( stdout ); |
146 | } | 163 | } |
@@ -156,8 +173,8 @@ namespace Bu | |||
156 | template<> void __tracer_format<uint64_t>( const uint64_t &v ); | 173 | template<> void __tracer_format<uint64_t>( const uint64_t &v ); |
157 | template<> void __tracer_format<bool>( const bool &v ); | 174 | template<> void __tracer_format<bool>( const bool &v ); |
158 | template<> void __tracer_format<char>( const char &v ); | 175 | template<> void __tracer_format<char>( const char &v ); |
159 | //template<> void __tracer_format<long>( const long &v ); | 176 | template<> void __tracer_format<long>( const long &v ); |
160 | //template<> void __tracer_format<unsigned long>( const unsigned long &v ); | 177 | template<> void __tracer_format<unsigned long>( const unsigned long &v ); |
161 | template<> void __tracer_format<float>( const float &v ); | 178 | template<> void __tracer_format<float>( const float &v ); |
162 | template<> void __tracer_format<double>( const double &v ); | 179 | template<> void __tracer_format<double>( const double &v ); |
163 | template<> void __tracer_format<void *>( void * const &v ); | 180 | template<> void __tracer_format<void *>( void * const &v ); |