MPSolve  3.2.1
memory-file-stream.h
Go to the documentation of this file.
1 /*
2  * This file is part of MPSolve 3.2.1
3  *
4  * Copyright (C) 2001-2020, Dipartimento di Matematica "L. Tonelli", Pisa.
5  * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
6  *
7  * Authors:
8  * Leonardo Robol <leonardo.robol@unipi.it>
9  */
10 
16 #ifndef MPS_MEMORY_FILE_STREAM_H_
17 #define MPS_MEMORY_FILE_STREAM_H_
18 
19 MPS_BEGIN_DECLS
20 
25 
30 
38 
45 
46 MPS_END_DECLS
47 
48 #ifdef __cplusplus
49 
50 #include <iostream>
51 #include <sstream>
52 
53 #include <mps/mps.h>
54 
55 namespace mps {
62 public:
63 
71  MemoryFileStream(const char * source);
72 
74 
86  size_t readline (char ** buffer, size_t * length);
87 
93  bool eof ();
94 
100  int getchar ();
101 
102 private:
103  std::istringstream mInputStream;
104  };
105 }
106 
107 #endif
108 
109 #endif /* MPS_MEMORY_FILE_STREAM_H_ */
110 
Abstract class that represent a generic input stream that can be used by MPSolve to read polynomial f...
Definition: abstract-input-stream.h:62
The MemoryFileStream class provides an implementation of the abstract class AbstractInputStream that ...
Definition: memory-file-stream.h:61
int getchar()
Obtain a single character.
Definition: memory-file-stream.cpp:73
MemoryFileStream(const char *source)
Allocate a new MemoryFileStream that wil provide that data stored by the given pointer.
Definition: memory-file-stream.cpp:33
bool eof()
Implementation of the eof() method of AbstractInputStream.
Definition: memory-file-stream.cpp:67
size_t readline(char **buffer, size_t *length)
Implementation of the readline() method of the AbstractInputStream parent.
Definition: memory-file-stream.cpp:43
mps_memory_file_stream * mps_memory_file_stream_new(const char *source)
Allocate a new MemoryFileStream that will output the data pointed by source.
Definition: memory-file-stream.cpp:19
void mps_memory_file_stream_free(mps_memory_file_stream *stream)
Release the resources holded by a MemoryFileStream.
Definition: memory-file-stream.cpp:25
struct mps_memory_file_stream mps_memory_file_stream
C wrapper around MemoryFileStream.
Definition: memory-file-stream.h:29
Header file for libmps.