diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-11-07 18:12:27 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-11-07 18:12:27 +0000 |
commit | b9cecc62dffd115b261df916e529ca63ae13735d (patch) | |
tree | 8dab016dc20f13a0c3786d09c4d2531c079820fa /cpp/demo/IceStorm/counter/CounterObserverI.cpp | |
parent | use a string instead of a list (diff) | |
download | ice-b9cecc62dffd115b261df916e529ca63ae13735d.tar.bz2 ice-b9cecc62dffd115b261df916e529ca63ae13735d.tar.xz ice-b9cecc62dffd115b261df916e529ca63ae13735d.zip |
Modified print statements to not overlap
Diffstat (limited to 'cpp/demo/IceStorm/counter/CounterObserverI.cpp')
-rw-r--r-- | cpp/demo/IceStorm/counter/CounterObserverI.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cpp/demo/IceStorm/counter/CounterObserverI.cpp b/cpp/demo/IceStorm/counter/CounterObserverI.cpp index d2cda96d46e..318f04272c6 100644 --- a/cpp/demo/IceStorm/counter/CounterObserverI.cpp +++ b/cpp/demo/IceStorm/counter/CounterObserverI.cpp @@ -13,8 +13,9 @@ using namespace std; -CounterObserverI::CounterObserverI() : - _value(0) +CounterObserverI::CounterObserverI(const MTPrinterPtr& printer) : + _value(0), + _printer(printer) { } @@ -23,7 +24,9 @@ CounterObserverI::init(int value, const Ice::Current&) { Lock sync(*this); _value = value; - cout << "init: " << value << endl; + ostringstream ostr; + ostr << "init: " << value << endl; + _printer->print(ostr.str()); } void @@ -31,6 +34,8 @@ CounterObserverI::inc(int value, const Ice::Current&) { Lock sync(*this); _value += value; - cout << "int: " << value << " total: " << _value << endl; + ostringstream ostr; + ostr << "int: " << value << " total: " << _value << endl; + _printer->print(ostr.str()); } |