10 #define IMPBASE_FILE_H
12 #include <IMP/base/base_config.h>
15 #include "internal/ifile.h"
18 #include <boost/shared_ptr.hpp>
22 IMPBASE_BEGIN_NAMESPACE
24 #if !defined(IMP_DOXYGEN)
25 template <
class Stream>
28 OwnerPointer<Object> ptr_;
29 TextProxy(Stream *str, Object *ptr): str_(str), ptr_(ptr){}
49 boost::shared_ptr<internal::IOStorage<std::ostream> > out_;
59 TextOutput(std::string file_name,
bool append=
false);
61 TextOutput(std::ostream &out, std::string name=
"C++ stream");
64 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
65 operator std::ostream &() {
69 std::ostream &get_stream() {
70 IMP_USAGE_CHECK(out_,
"Attempting to write to uninitialized text input");
71 return out_->get_stream();
75 std::string get_name()
const {
76 return out_->get_name();
93 boost::shared_ptr<internal::IOStorage<std::istream> > in_;
105 TextInput(std::istream &out, std::string name=
"C++ stream");
108 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
109 operator std::istream &() {
112 std::istream &get_stream() {
114 IMP_THROW(
"Attempting to read from uninitialized text input",
117 return in_->get_stream();
122 std::string get_name()
const {
123 return in_->get_name();
152 old_=get_log_target();,
167 std::string suffix=
"");
175 IMPBASEEXPORT std::string
177 std::string suffix=
"");
188 std::string relative);
190 IMPBASE_END_NAMESPACE