8 #ifndef IMPBASE_SHOWABLE_H
9 #define IMPBASE_SHOWABLE_H
11 #include <IMP/base/base_config.h>
18 IMPBASE_BEGIN_NAMESPACE
28 void show_ptr(
const T *o) {
29 std::ostringstream oss;
31 oss <<
'"' << o->get_name() <<
'"';
41 std::ostringstream oss;
53 IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(
Showable);
54 Showable(
const std::string &str) : str_(str) {}
55 Showable(
const char *str) : str_(str) {}
56 template <
class T,
class TT>
57 Showable(
const std::pair<T, TT> &p) {
58 std::ostringstream oss;
59 oss <<
"(" << p.first <<
", " << p.second <<
")";
62 std::string get_string()
const {
return str_; }
66 inline std::ostream &operator<<(std::ostream &out,
const Showable &s) {
67 out << s.get_string();