BAM
Abstract Machine for Bottom-Up Evaluation with the Push Method
in.h
Go to the documentation of this file.
1 // ============================================================================
2 // Project: Deductive Database
3 // Filename: in.h
4 // Purpose: Abstract Input Source (e.g. File, CGI, Keyboard)
5 // Last Change: 01.08.2017
6 // Language: C++
7 // EMail: brass@informatik.uni-halle.de
8 // WWW: http://www.informatik.uni-halle.de/~brass/
9 // Address: Feldschloesschen 15, D-06120 Halle (Saale), GERMANY
10 // Copyright: (c) 1998-2017 by Stefan Brass
11 // License: See file "LICENSE" for copying conditions.
12 // Note: There is no warranty at all - this code may contain bugs.
13 // ============================================================================
14 
15 
27 //=============================================================================
28 // Include File Frame:
29 //=============================================================================
30 
31 #ifndef IN_INCLUDED
32 #define IN_INCLUDED
33 
34 //=============================================================================
35 // Used Types and Macros:
36 //=============================================================================
37 
38 #ifndef STR_INCLUDED
39 #include "../base/str.h"
40 #endif
41 
42 #ifndef CHECK_INCLUDED
43 #include "../base/check.h"
44 #endif
45 
46 //=============================================================================
47 // Class for Input Source:
48 //=============================================================================
49 
50 class in_c {
51  public:
52 
53 //-----------------------------------------------------------------------------
54 // Destructor:
55 //-----------------------------------------------------------------------------
56 
57  virtual inline ~in_c()
58  {};
59 
60 //-----------------------------------------------------------------------------
61 // read: Read characters from input file into buffer.
62 //-----------------------------------------------------------------------------
63 
64  virtual int read(char *buf, int size) = 0;
65 
66 //-----------------------------------------------------------------------------
67 // is_open: This is really an open input stream (i.e. opening was successful).
68 //-----------------------------------------------------------------------------
69 
70  virtual bool is_open() = 0;
71 
72 //-----------------------------------------------------------------------------
73 // close: Close input file explicitly.
74 //-----------------------------------------------------------------------------
75 
76  virtual bool close() = 0;
77 
78 //-----------------------------------------------------------------------------
79 // filename: Name of this file (if it is a file).
80 //-----------------------------------------------------------------------------
81 
82  virtual str_t filename() = 0;
83 
84 //=============================================================================
85 // End of Class:
86 //=============================================================================
87 
88 };
89 
90 //-----------------------------------------------------------------------------
91 // Define pointer type:
92 //-----------------------------------------------------------------------------
93 
94 typedef in_c *in_t;
95 
96 //-----------------------------------------------------------------------------
97 // Define null pointer:
98 //-----------------------------------------------------------------------------
99 
100 #define IN_NULL (static_cast<in_t>(0))
101 
102 //=============================================================================
103 // End of File:
104 //=============================================================================
105 
106 #endif
107 
Definition: in.h:50
const char * str_t
Definition: str.h:41