~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cslib/CSStream.h

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
 
1
/* Copyright (c) 2008 PrimeBase Technologies GmbH, Germany
2
2
 *
3
3
 * PrimeBase Media Stream for MySQL
4
4
 *
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
18
 *
19
19
 * Original Author: Paul McCullagh
20
20
 * Continued development: Barry Leslie
74
74
         */
75
75
        virtual void reset() = 0; 
76
76
 
77
 
        /* Return the name of the file, or whatever: */
78
 
        virtual const char *identify() = 0;
79
 
 
80
77
        /*
81
78
         * Read a line from the input stream. This function
82
79
         * handles all types of line endings. The function
112
109
        virtual void flush() = 0;
113
110
 
114
111
        /*
115
 
         * Writes the specified byte to this output stream.
 
112
         *  Writes the specified byte to this output stream.
116
113
         */
117
114
        virtual void write(char b) = 0; 
118
115
 
119
116
        /*
120
 
         * Reset this output stream to the start inorder to restart the write.
 
117
         *  Reset this output stream to the start inorder to restart the write.
121
118
         */
122
119
        virtual void reset() = 0; 
123
120
 
124
 
        virtual const char *identify() = 0;
125
 
 
126
121
        /*
127
122
         * Write a line. Terminator is specific to the
128
123
         * type of output stream and may depend on the
164
159
         */
165
160
        virtual void reset(); 
166
161
 
167
 
        virtual const char *identify();
168
 
 
169
162
        static CSFileInputStream *newStream(CSFile* f);
170
163
        static CSFileInputStream *newStream(CSFile* f, off64_t offset);
171
164
 
191
184
 
192
185
        virtual void reset(); 
193
186
 
194
 
        virtual const char *identify();
195
 
 
196
187
        static CSFileOutputStream *newStream(CSFile* f);
197
188
        static CSFileOutputStream *newStream(CSFile* f, off64_t offset);
198
189
 
218
209
 
219
210
        virtual void reset(); 
220
211
 
221
 
        virtual const char *identify();
222
 
 
223
212
        static CSSocketInputStream *newStream(CSSocket *s);
224
213
 
225
214
private:
243
232
 
244
233
        virtual void reset(); 
245
234
 
246
 
        virtual const char *identify();
247
 
 
248
235
        static CSSocketOutputStream *newStream(CSSocket *s);
249
236
 
250
237
private:
252
239
};
253
240
 
254
241
/* Buffered Stream: */
255
 
#ifdef DEBUG_disabled
256
 
#define CS_STREAM_BUFFER_SIZE                   80
 
242
#ifdef DEBUG
 
243
#define CS_STREAM_BUFFER_SIZE                   11
 
244
//#define CS_STREAM_BUFFER_SIZE                 (64 * 1024)
257
245
#else
258
 
#define CS_STREAM_BUFFER_SIZE                   (32 * 1024)
 
246
#define CS_STREAM_BUFFER_SIZE                   (64 * 1024)
259
247
#endif
260
248
 
261
249
class CSBufferedInputStream : public CSInputStream {
273
261
 
274
262
        virtual void reset(); 
275
263
 
276
 
        virtual const char *identify();
277
 
 
278
264
        static CSBufferedInputStream *newStream(CSInputStream* i);
279
265
 
280
266
private:
301
287
 
302
288
        virtual void reset(); 
303
289
 
304
 
        virtual const char *identify();
305
 
 
306
290
        static CSBufferedOutputStream *newStream(CSOutputStream* i);
307
291
 
308
292
private:
347
331
 
348
332
        virtual void reset() {iMemPos = 0;}
349
333
        
350
 
        virtual const char *identify() 
351
 
        {
352
 
                return "memory stream";
353
 
        }
354
 
 
355
334
        static CSMemoryInputStream *newStream(const u_char* buffer, uint32_t length);
356
335
 
357
336
private:
383
362
        
384
363
        virtual void reset();
385
364
        
386
 
        virtual const char *identify();
387
 
        
388
365
        static CSMemoryOutputStream *newStream(size_t init_length, size_t min_alloc);
389
366
 
390
367
private:
415
392
                iMemSpace = iMemSize;
416
393
        }
417
394
        
418
 
        virtual const char *identify() 
419
 
        {
420
 
                return "memory stream";
421
 
        }
422
 
        
423
395
        off64_t getSize() { return iMemPos - iMemory; }
424
396
 
425
397
private:
494
466
                doReset = false;
495
467
        }
496
468
 
497
 
        virtual const char *identify() 
498
 
        {
499
 
                return "callback stream";
500
 
        }
501
 
 
502
469
        static CSCallbackInputStream *newStream(CSStreamReadCallbackFunc callback, void *user_data);
503
470
 
504
471
private:
508
475
        bool havePeek;
509
476
        bool doReset;
510
477
};
511
 
 
512
478
#endif
513
479
 
514
480