9#ifndef IMPKERNEL_SHOWABLE_H
10#define IMPKERNEL_SHOWABLE_H
12#include <IMP/kernel_config.h>
19IMPKERNEL_BEGIN_NAMESPACE
25class IMPKERNELEXPORT Showable {
28 void show_ptr(
const T *o) {
29 std::ostringstream oss;
31 oss <<
'"' << o->get_name() <<
'"';
40 explicit Showable(
const T &t) {
41 std::ostringstream oss;
46 explicit Showable(
const T *o) {
50 explicit Showable(T *o) {
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_; }
66inline std::ostream &operator<<(std::ostream &out,
const Showable &s) {
67 out << s.get_string();
71IMPKERNEL_END_NAMESPACE
Helper class to aid in output of IMP classes to streams.