Barracuda Application Server C/C++ Reference
NO
BaDiskIo.h
1 /*
2  * ____ _________ __ _
3  * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4  * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5  * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7  * /____/
8  *
9  * Barracuda Embedded Web-Server
10  *
11  ****************************************************************************
12  * HEADER
13  *
14  * $Id: BaDiskIo.h 4915 2021-12-01 18:26:55Z wini $
15  *
16  * COPYRIGHT: Real Time Logic, 2006
17  *
18  * This software is copyrighted by and is the sole property of Real
19  * Time Logic LLC. All rights, title, ownership, or other interests in
20  * the software remain the property of Real Time Logic LLC. This
21  * software may only be used in accordance with the terms and
22  * conditions stipulated in the corresponding license agreement under
23  * which the software has been supplied. Any unauthorized use,
24  * duplication, transmission, distribution, or disclosure of this
25  * software is expressly forbidden.
26  *
27  * This Copyright notice may not be removed or modified without prior
28  * written consent of Real Time Logic LLC.
29  *
30  * Real Time Logic LLC. reserves the right to modify this software
31  * without notice.
32  *
33  * http://www.realtimelogic.com
34  ****************************************************************************
35  *
36  * DiskIo implements the abstract class IoIntf. See the reference
37  * manual for more information on the IoIntf (IO interface)
38  * requirements.
39  *
40  * This is a generic header file for all file systems and
41  * platforms. See the sub-directories for platform specific
42  * implementations.
43  */
44 
45 #ifndef _DiskIo_h
46 #define _DiskIo_h
47 
48 #include "HttpServer.h"
49 #include "IoIntf.h"
50 
51 #ifndef ROOTPT
52 #define ROOTPT void*
53 #endif
54 
55 #ifndef DiskIo_DATA
56 #define DiskIo_DATA void* data
57 #endif
58 
59 
60 
94 typedef struct DiskIo
95 #ifdef __cplusplus
96 : public IoIntf
97 {
98  void *operator new(size_t s) { return ::baMalloc(s); }
99  void operator delete(void* d) { if(d) ::baFree(d); }
100  void *operator new(size_t, void *place) { return place; }
101  void operator delete(void*, void *) { }
102 
110  DiskIo();
111 
114  ~DiskIo();
115 
125  int setRootDir(const char* root);
126 
127  int getRootDir(char* buf, int len);
128 #if 0
129 }
130 #endif
131 #else
132 {
133  IoIntf super; /* Inherits from IoIntf */
134 #endif
135  ROOTPT rootPath;
136  int rootPathLen;
137  DiskIo_DATA; /* Used internally if needed by the implementation */
139 
140 
141 #ifdef __cplusplus
142 extern "C" {
143 #endif
144 BA_API void DiskIo_constructor(DiskIo* o);
145 BA_API void DiskIo_destructor(DiskIo* o);
146 BA_API int DiskIo_setRootDir(DiskIo* o, const char* root);
147 BA_API int DiskIo_getRootDir(DiskIo* o, char* buf, int len);
148 #ifdef __cplusplus
149 }
150 
151 inline DiskIo::DiskIo() {
152  DiskIo_constructor(this);
153 }
154 inline DiskIo::~DiskIo() {
155  DiskIo_destructor(this);
156 }
157 inline int DiskIo::setRootDir(const char* root) {
158  return DiskIo_setRootDir(this, root);
159 }
160 inline int DiskIo::getRootDir(char* buf, int len) {
161  return DiskIo_getRootDir(this, buf, len);
162 }
163 
164 #endif
165  /* end of IO */
167 
168 #endif
169 
DiskIo
DiskIo DiskIo
The DiskIo class makes it possible for the web-server to work with resources on a hard drive.
DiskIo
The DiskIo class makes it possible for the web-server to work with resources on a hard drive.
Definition: BaDiskIo.h:97
DiskIo::DiskIo
DiskIo()
Create a DiskIo instance and set the root directory to '/'.
Definition: BaDiskIo.h:151
baFree
void baFree(void *p)
Deallocates space to which it points.
baMalloc
void * baMalloc(size_t size)
Returns pointer to uninitialized newly-allocated space for an object of size "size",...
IoIntf
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
Definition: IoIntf.h:377
DiskIo::~DiskIo
~DiskIo()
Terminate the DiskIo instance.
Definition: BaDiskIo.h:154
DiskIo::setRootDir
int setRootDir(const char *root)
Set the root directory.
Definition: BaDiskIo.h:157