From c0c6213c7cf11ff5181a7642a6c4d4a746d096f2 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Thu, 19 Jun 2014 21:24:14 +0200 Subject: [PATCH] Win32: friend incosistent linkage --- src/misc/status.cpp | 17 +++++++++++------ src/misc/status.h | 3 ++- src/misc/timer.cpp | 16 ++++++++++------ src/misc/timer.h | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/misc/status.cpp b/src/misc/status.cpp index 4b9d7a7..c4a1436 100644 --- a/src/misc/status.cpp +++ b/src/misc/status.cpp @@ -113,14 +113,19 @@ void Status::deserialize(ByteBuffer *buffer, DeserializableControl *flusher) } } +void Status::dump(std::ostream& o) const +{ + o << "Status [type=" << Status::StatusTypeName[m_statusType]; + if (!m_message.empty()) + o << ", message=" << m_message; + if (!m_stackDump.empty()) + o << ", stackDump=" << std::endl << m_stackDump; + o << ']'; +} + std::ostream& operator<<(std::ostream& o, const Status& status) { - o << "Status [type=" << Status::StatusTypeName[status.m_statusType]; - if (!status.m_message.empty()) - o << ", message=" << status.m_message; - if (!status.m_stackDump.empty()) - o << ", stackDump=" << std::endl << status.m_stackDump; - o << ']'; + status.dump(o); return o; } diff --git a/src/misc/status.h b/src/misc/status.h index 45463ae..83dc0aa 100644 --- a/src/misc/status.h +++ b/src/misc/status.h @@ -98,6 +98,8 @@ namespace epics { namespace pvData { void serialize(ByteBuffer *buffer, SerializableControl *flusher) const; void deserialize(ByteBuffer *buffer, DeserializableControl *flusher); + void dump(std::ostream& o) const; + private: static std::string m_emptyStringtring; @@ -106,7 +108,6 @@ namespace epics { namespace pvData { std::string m_message; std::string m_stackDump; - friend std::ostream& operator<<(std::ostream& o, const Status& status); }; epicsShareExtern std::ostream& operator<<(std::ostream& o, const Status& status); diff --git a/src/misc/timer.cpp b/src/misc/timer.cpp index c187556..6915471 100644 --- a/src/misc/timer.cpp +++ b/src/misc/timer.cpp @@ -196,23 +196,27 @@ void Timer::schedulePeriodic( if(isFirst) waitForWork.signal(); } -std::ostream& operator<<(std::ostream& o, Timer& timer) +void Timer::dump(std::ostream& o) { - Lock xx(timer.mutex); - if(!timer.alive) return o; + Lock xx(mutex); + if(!alive) return; TimeStamp currentTime; - TimerCallbackPtr nodeToCall(timer.head); + TimerCallbackPtr nodeToCall(head); currentTime.getCurrent(); while(true) { - if(nodeToCall.get()==NULL) return o; + if(nodeToCall.get()==NULL) return; TimeStamp timeToRun = nodeToCall->timeToRun; double period = nodeToCall->period; double diff = TimeStamp::diff(timeToRun,currentTime); o << "timeToRun " << diff << " period " << period << std::endl; nodeToCall = nodeToCall->next; } - return o; } +std::ostream& operator<<(std::ostream& o, Timer& timer) +{ + timer.dump(o); + return o; +} }} diff --git a/src/misc/timer.h b/src/misc/timer.h index 0f8d2cf..e7267e3 100644 --- a/src/misc/timer.h +++ b/src/misc/timer.h @@ -64,7 +64,7 @@ public: void cancel(TimerCallbackPtr const &timerCallback); bool isScheduled(TimerCallbackPtr const &timerCallback); - friend std::ostream& operator<<(std::ostream& o, Timer& timer); + void dump(std::ostream& o); private: void addElement(TimerCallbackPtr const &timerCallback);