FileIOClient.h

Go to the documentation of this file.
00001 /*
00002  *    Copyright 2004-2006 Intel Corporation
00003  * 
00004  *    Licensed under the Apache License, Version 2.0 (the "License");
00005  *    you may not use this file except in compliance with the License.
00006  *    You may obtain a copy of the License at
00007  * 
00008  *        http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  *    Unless required by applicable law or agreed to in writing, software
00011  *    distributed under the License is distributed on an "AS IS" BASIS,
00012  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *    See the License for the specific language governing permissions and
00014  *    limitations under the License.
00015  */
00016 
00017 
00018 #ifndef _OASYS_FILE_IOCLIENT_H_
00019 #define _OASYS_FILE_IOCLIENT_H_
00020 
00021 #include "FdIOClient.h"
00022 #include <fcntl.h>
00023 #include <string.h>
00024 
00025 namespace oasys {
00026 
00033 class FileIOClient : public FdIOClient {
00034 public:
00036     FileIOClient();
00037     virtual ~FileIOClient();
00038 
00041     int open(const char* path, int flags, int* errnop = 0);
00042     int open(const char* path, int flags, mode_t mode, int* errnop = 0);
00043     int close();
00044     int unlink();
00045     int lseek(off_t offset, int whence);
00046     int truncate(off_t length);
00047     int mkstemp(char* temp);
00048     int stat(struct stat* buf);
00049     int lstat(struct stat* buf);
00051 
00055     int copy_contents(FileIOClient* dest, size_t len = 0);
00056 
00058     void set_path(const std::string& path) {
00059         path_ = path;
00060     }
00061 
00063     int reopen(int flags);
00064 
00066     bool is_open() { return fd_ != -1; }
00067 
00069     const char* path() { return path_.c_str(); }
00070 
00072     size_t path_len() { return path_.length(); }
00073 
00074 protected:
00076     std::string path_;
00077 };
00078 
00079 } // namespace oasys
00080 
00081 #endif /* _OASYS_FILE_IOCLIENT_H_ */

Generated on Sat Sep 8 08:36:16 2007 for DTN Reference Implementation by  doxygen 1.5.3