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

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

Debug/correction des ppersist suite a la separation des PInOutPersist en PPFInOutStream - Reza 5 Dec 2003

File size: 1.9 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);
[2476]30 inline std::string getFileName() const { return _filename; }
31protected:
32 std::string _filename;
33
[2458]34};
35
36// Input flow on a disk file
37class RawInFileStream : public RawInOutStream {
38public:
39 RawInFileStream(const char * path);
40 RawInFileStream(string const & path);
41 virtual ~RawInFileStream();
42
43 virtual bool isSeekable() const ;
44 // Interface pour lecture
45 virtual int_8 tellg();
46 virtual RawInOutStream& seekg(int_8, int sd = ios::beg);
47 virtual RawInOutStream& read(char* s, uint_8 n);
48
49protected:
50 FILE * fip;
51};
52
53// Output flow on a disk file
54class RawOutFileStream : public RawInOutStream {
55public:
56 RawOutFileStream(const char * path);
57 RawOutFileStream(string const & path);
58 virtual ~RawOutFileStream();
59
60 virtual bool isSeekable() const ;
61 // Interface pour ecriture
62 virtual int_8 tellp();
63 virtual RawInOutStream& seekp(int_8 pos, int sd = ios::beg);
64 virtual RawInOutStream& write(const char* s, uint_8 n);
65
66protected:
67 FILE * fip;
68};
69
70
71} // namespace SOPHYA
72
73#endif
Note: See TracBrowser for help on using the repository browser.