9 #ifndef IMPKERNEL_FILE_H
10 #define IMPKERNEL_FILE_H
12 #include <IMP/kernel_config.h>
14 #include "internal/ifile.h"
22 #include <boost/shared_ptr.hpp>
26 IMPKERNEL_BEGIN_NAMESPACE
28 #if !defined(IMP_DOXYGEN)
29 template <
class Stream>
32 PointerMember<Object> ptr_;
33 TextProxy(Stream *str, Object *ptr) : str_(str), ptr_(ptr) {}
51 boost::shared_ptr<internal::IOStorage<std::ostream> > out_;
58 TextOutput(
const char *c,
bool append =
false);
62 TextOutput(std::string file_name,
bool append =
false);
64 TextOutput(std::ostream &out, std::string name =
"C++ stream");
67 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
68 operator std::ostream &() {
return get_stream(); }
70 std::ostream &get_stream() {
71 IMP_USAGE_CHECK(out_,
"Attempting to write to uninitialized text input");
72 return out_->get_stream();
76 std::string get_name()
const {
return out_->get_name(); }
90 boost::shared_ptr<internal::IOStorage<std::istream> > in_;
103 TextInput(std::istream &out, std::string name =
"C++ stream");
106 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
107 operator std::istream &() {
return get_stream(); }
108 std::istream &get_stream() {
110 IMP_THROW(
"Attempting to read from uninitialized text input",
113 return in_->get_stream();
118 std::string get_name()
const {
return in_->get_name(); }
160 std::string suffix =
"");
168 std::string suffix =
"");
179 std::string relative);
191 IMPKERNEL_END_NAMESPACE
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Temporarily change something; undo the change when this object is destroyed.
Temporarily set log target.
#define IMP_RAII(Name, args, Initialize, Set, Reset, Show)
Declares RAII-style methods in a class.
#define IMP_SAFE_BOOL(Name, expr)
Exception definitions and assertions.
A more IMP-like version of the std::vector.
TextOutput create_temporary_file(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file. The path can be extracted from the TextOutput.
An input/output exception.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
std::string get_relative_path(std::string base, std::string relative)
Return a path to a file relative to another file.
void set_log_target(TextOutput l)
Set the target for the log.
std::string get_absolute_path(std::string file)
Convert a possibly relative path to an absolute path.
#define IMP_THROW(message, exception_name)
Throw an exception with a message.
A nullptr-initialized pointer to an IMP Object.
Helper macros for throwing and handling exceptions.
A shared base class to help in debugging and things.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Macros to help in implementing Value objects.
Macros to aid in writing RAII-style classes.
std::string create_temporary_file_name(std::string prefix="imp_temp", std::string suffix="")
Create a temporary file.