9 #ifndef IMPKERNEL_SHOWABLE_H
10 #define IMPKERNEL_SHOWABLE_H
12 #include <IMP/kernel_config.h>
19 IMPKERNEL_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();
71 IMPKERNEL_END_NAMESPACE
Helper class to aid in output of IMP classes to streams.