IMP  2.1.1
The Integrative Modeling Platform
base/Object.h
Go to the documentation of this file.
1 /**
2  * \file IMP/base/Object.h
3  * \brief A shared base class to help in debugging and things.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPBASE_OBJECT_H
10 #define IMPBASE_OBJECT_H
11 
12 #include <IMP/base/base_config.h>
13 #include "declare_Object.h"
14 #include "object_cast.h"
15 #include <sstream>
16 
17 IMPBASE_BEGIN_NAMESPACE
18 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
19 /** Send the whole show output to a stream*/
20 class ShowFull {
21  std::string showed_;
22 
23  public:
24  ShowFull(Object *o) {
25  std::ostringstream oss;
26  o->show(oss);
27  showed_ = oss.str();
28  }
29  const std::string &get_string() const { return showed_; }
30 };
31 inline std::ostream &operator<<(std::ostream &o, const ShowFull &sf) {
32  o << sf.get_string();
33  return o;
34 }
35 #endif
36 IMPBASE_END_NAMESPACE
37 
38 #endif /* IMPBASE_OBJECT_H */
A shared base class to help in debugging and things.
A shared base class to help in debugging and things.