File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 32
32
33
33
namespace bp = boost::python;
34
34
35
+ namespace {
36
+
37
+ void black_hole_info (const std::string& s) { }
38
+
39
+ } // namespace
40
+
41
+ // class MuteObjCrystUserInfo ------------------------------------------------
42
+
43
+ MuteObjCrystUserInfo::MuteObjCrystUserInfo () :
44
+ msave_info_func(ObjCryst::fpObjCrystInformUser)
45
+ {
46
+ ObjCryst::fpObjCrystInformUser = black_hole_info;
47
+ }
48
+
49
+
50
+ MuteObjCrystUserInfo::~MuteObjCrystUserInfo ()
51
+ {
52
+ this ->release ();
53
+ }
54
+
55
+
56
+ void MuteObjCrystUserInfo::release ()
57
+ {
58
+ using ObjCryst::fpObjCrystInformUser;
59
+ if (msave_info_func) fpObjCrystInformUser = msave_info_func;
60
+ msave_info_func = NULL ;
61
+ }
62
+
63
+ // free functions ------------------------------------------------------------
64
+
35
65
void swapstdout (std::ostream& buf)
36
66
{
37
67
// Switch the stream buffer with std::cout, which is used by Print.
Original file line number Diff line number Diff line change @@ -34,6 +34,21 @@ namespace bp = boost::python;
34
34
35
35
typedef std::numeric_limits<double > doublelim;
36
36
37
+ class MuteObjCrystUserInfo
38
+ {
39
+ public:
40
+
41
+ MuteObjCrystUserInfo ();
42
+ ~MuteObjCrystUserInfo ();
43
+ void release ();
44
+
45
+ private:
46
+
47
+ // pointer to the previous info function
48
+ void (*msave_info_func)(const std::string &);
49
+ };
50
+
51
+
37
52
// Switch stdout with another stream. To get things back the right way, just
38
53
// switch again with the same stream.
39
54
void swapstdout (std::ostream& buf);
You can’t perform that action at this time.
0 commit comments