PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 2ms RepoModel.GetById 38ms app.codeStats 0ms

/mordor/streams/temp.h

http://github.com/mozy/mordor
C Header | 46 lines | 24 code | 10 blank | 12 comment | 0 complexity | be8526b1cb740b9b123d127ef1bca687 MD5 | raw file
 1#ifndef __MORDOR_TEMP_STREAM_H__
 2#define __MORDOR_TEMP_STREAM_H__
 3// Copyright (c) 2009 - Mozy, Inc.
 4
 5#include "file.h"
 6
 7namespace Mordor {
 8
 9#ifdef WINDOWS
10typedef FileStream TempStreamBase;
11#else
12typedef FDStream TempStreamBase;
13#endif
14
15class TempStream : public TempStreamBase
16{
17public:
18    typedef boost::shared_ptr<TempStream> ptr;
19
20public:
21    /// Create a stream representing a temporary file
22
23    /// @param prefix The prefix for the temporary file.  If it is an absolute
24    /// path, the file will be created in that location.  If it is relative, it
25    /// will be relative to the system temporary directory.  In either case,
26    /// a suffix will be added to make it unique.
27    /// @param deleteOnClose If the file will be created with
28    /// FileStream::DELETE_ON_CLOSE flag, to guarantee the file will be cleaned
29    /// up when the TempStream destructs (or the process dies).
30    /// @param ioManager The IOManager to use for any asynchronous I/O, if
31    /// possible
32    /// @param scheduler The Scheduler to switchTo for any blocking I/O
33    TempStream(const std::string &prefix = "", bool deleteOnClose = true,
34        IOManager *ioManager = NULL, Scheduler *scheduler = NULL);
35
36#ifndef WINDOWS
37    std::string path() const { return m_path; }
38
39private:
40    std::string m_path;
41#endif
42};
43
44}
45
46#endif