libcamgm
ExternalDataSource.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
15 #ifndef CA_MGM_EXTERNALDATASOURCE_H
16 #define CA_MGM_EXTERNALDATASOURCE_H
17 
18 #include <stdio.h>
19 
20 #include <string>
21 
22 namespace ca_mgm {
23 
28  {
29  protected:
30  FILE *inputfile;
31  FILE *outputfile;
32 
33  private:
34  char *linebuffer;
36 
37  public:
44  ExternalDataSource(FILE *inputfile = 0, FILE *outputfile = 0);
45 
49  virtual ~ExternalDataSource();
50 
56  bool send (const char *buffer, size_t length);
57 
62  bool send (std::string s);
63 
70  size_t receive(char *buffer, size_t length);
71 
76  std::string receiveLine();
77 
82  std::string receiveUpto(char c);
88  void setBlocking(bool mode);
89 
93  virtual int close();
94 
98  FILE *inputFile() const { return inputfile; }
99 
103  FILE *outputFile() const { return outputfile; }
104  };
105 
106 } // namespace ca_mgm
107 
108 #endif // CA_MGM_EXTERNALDATASOURCE_H
109 
FILE * outputFile() const
Definition: ExternalDataSource.hpp:103
bool send(const char *buffer, size_t length)
ExternalDataSource(FILE *inputfile=0, FILE *outputfile=0)
std::string receiveUpto(char c)
FILE * outputfile
Definition: ExternalDataSource.hpp:31
FILE * inputFile() const
Definition: ExternalDataSource.hpp:98
FILE * inputfile
Definition: ExternalDataSource.hpp:30
char * linebuffer
Definition: ExternalDataSource.hpp:34
size_t receive(char *buffer, size_t length)
void setBlocking(bool mode)
size_t linebuffer_size
Definition: ExternalDataSource.hpp:35
Bidirectional stream to external data.
Definition: ExternalDataSource.hpp:27
Definition: ByteBuffer.hpp:37