Program Listing for File shared_file_stream.hpp

Return to documentation for file (/tmp/ws/src/ecl_core/ecl_streams/include/ecl/streams/shared_file_stream.hpp)

/*****************************************************************************
** Ifdefs
*****************************************************************************/

#ifndef ECL_STREAMS_SHARED_FILE_STREAMS_HPP_
#define ECL_STREAMS_SHARED_FILE_STREAMS_HPP_

/*****************************************************************************
** Includes
*****************************************************************************/

#include <string>
#include <ecl/config/macros.hpp>
#include <ecl/exceptions/standard_exception.hpp>
#include <ecl/devices/shared_file.hpp>
#include "text_stream.hpp"
#include "macros.hpp"

/*****************************************************************************
** Namespaces
*****************************************************************************/

namespace ecl {

/*****************************************************************************
** Interfaces [SharedFileStream]
*****************************************************************************/
class ecl_streams_PUBLIC SharedFileStream : public TextStream<SharedFile> {
public:
    SharedFileStream() {};
    SharedFileStream(const std::string &file_name, const WriteMode &mode = New) {
        ecl_try {
            if ( !this->device().open(file_name, mode) ) {
                error = this->device().error();
            }
        } ecl_catch(StandardException &e) {
            ecl_throw(StandardException(LOC,e));
        }
    }
    virtual ~SharedFileStream() {};
};

} // namespace ecl


#endif /* ECL_STREAMS_SHARED_FILE_STREAMS_HPP_ */