source: Sophya/trunk/SophyaLib/BaseTools/rawstream.h@ 2458

Last change on this file since 2458 was 2458, checked in by ansari, 22 years ago

Ajout fichiers rawstrea.h .cc (classes de Stream pour usage par PPersist (2) - Reza 21/11/2003

File size: 2.0 KB
RevLine 
[2458]1// This may look like C code, but it is really -*- C++ -*-
2
3#ifndef RAWSTREAM_H_SEEN
4#define RAWSTREAM_H_SEEN
5
6// Classe de flot brut - pour utilisation par les streams PPersist
7// R. Ansari LAL IN2P3/CNRS 11/2003
8
9#include "machdefs.h"
10#include <stdio.h>
11#include <iostream>
12#include <string>
13
14
15namespace SOPHYA {
16class RawInOutStream {
17public:
18 RawInOutStream();
19 virtual ~RawInOutStream();
20
21 virtual bool isSeekable() const ;
22 // Interface pour lecture
23 virtual int_8 tellg();
24 virtual RawInOutStream& seekg(int_8, int sd = ios::beg);
25 virtual RawInOutStream& read(char* s, uint_8 n);
26 // Interface pour ecriture
27 virtual int_8 tellp();
28 virtual RawInOutStream& seekp(int_8, int sd = ios::beg);
29 virtual RawInOutStream& write(const char* s, uint_8 n);
30};
31
32// Input flow on a disk file
33class RawInFileStream : public RawInOutStream {
34public:
35 RawInFileStream(const char * path);
36 RawInFileStream(string const & path);
37 virtual ~RawInFileStream();
38
39 virtual bool isSeekable() const ;
40 // Interface pour lecture
41 virtual int_8 tellg();
42 virtual RawInOutStream& seekg(int_8, int sd = ios::beg);
43 virtual RawInOutStream& read(char* s, uint_8 n);
44
45 inline std::string getFileName() const { return _filename; }
46protected:
47 FILE * fip;
48 std::string _filename;
49};
50
51// Output flow on a disk file
52class RawOutFileStream : public RawInOutStream {
53public:
54 RawOutFileStream(const char * path);
55 RawOutFileStream(string const & path);
56 virtual ~RawOutFileStream();
57
58 virtual bool isSeekable() const ;
59 // Interface pour ecriture
60 virtual int_8 tellp();
61 virtual RawInOutStream& seekp(int_8 pos, int sd = ios::beg);
62 virtual RawInOutStream& write(const char* s, uint_8 n);
63
64 inline std::string getFileName() const { return _filename; }
65protected:
66 FILE * fip;
67 std::string _filename;
68};
69
70
71} // namespace SOPHYA
72
73#endif
Note: See TracBrowser for help on using the repository browser.