diff --git a/pvAccessApp/remote/blockingClientTCPTransport.cpp b/pvAccessApp/remote/blockingClientTCPTransport.cpp index 064270d..7dce899 100644 --- a/pvAccessApp/remote/blockingClientTCPTransport.cpp +++ b/pvAccessApp/remote/blockingClientTCPTransport.cpp @@ -33,7 +33,6 @@ namespace epics { _introspectionRegistry(false), _connectionTimeout(beaconInterval*1000), _unresponsiveTransport(false), - _timerNode(*this), _verifyOrEcho(true) { // _autoDelete = false; @@ -46,13 +45,15 @@ namespace epics { // setup connection timeout timer (watchdog) epicsTimeGetCurrent(&_aliveTimestamp); - - context->getTimer()->schedulePeriodic(_timerNode, beaconInterval, beaconInterval); - - //start(); - } + void BlockingClientTCPTransport::start() + { + TimerCallbackPtr tcb = std::tr1::dynamic_pointer_cast(shared_from_this()); + _context->getTimer()->schedulePeriodic(tcb, _connectionTimeout, _connectionTimeout); + BlockingTCPTransport::start(); + } + BlockingClientTCPTransport::~BlockingClientTCPTransport() { } @@ -110,7 +111,8 @@ namespace epics { void BlockingClientTCPTransport::internalClose(bool forced) { BlockingTCPTransport::internalClose(forced); - _timerNode.cancel(); + TimerCallbackPtr tcb = std::tr1::dynamic_pointer_cast(shared_from_this()); + _context->getTimer()->cancel(tcb); } void BlockingClientTCPTransport::internalPostClose(bool forced) { diff --git a/pvAccessApp/remote/blockingTCP.h b/pvAccessApp/remote/blockingTCP.h index f1be511..a8fe712 100644 --- a/pvAccessApp/remote/blockingTCP.h +++ b/pvAccessApp/remote/blockingTCP.h @@ -159,7 +159,7 @@ namespace epics { /** * Starts the receive and send threads */ - void start(); + virtual void start(); virtual void enqueueSendRequest(TransportSender::shared_pointer const & sender); @@ -467,6 +467,8 @@ namespace epics { thisPointer->start(); return thisPointer; } + + virtual void start(); virtual ~BlockingClientTCPTransport(); @@ -566,11 +568,6 @@ namespace epics { */ bool _unresponsiveTransport; - /** - * Timer task node. - */ - epics::pvData::TimerNode _timerNode; - /** * Timestamp of last "live" event on this transport. */ diff --git a/pvAccessApp/remote/blockingTCPTransport.cpp b/pvAccessApp/remote/blockingTCPTransport.cpp index 34799f2..05cca19 100644 --- a/pvAccessApp/remote/blockingTCPTransport.cpp +++ b/pvAccessApp/remote/blockingTCPTransport.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -74,7 +73,7 @@ namespace pvAccess { }; */ - PVDATA_REFCOUNT_MONITOR_DEFINE(blockingTCPTransport); + PVACCESS_REFCOUNT_MONITOR_DEFINE(blockingTCPTransport); //const double BlockingTCPTransport::_delay = 0.000; @@ -121,7 +120,7 @@ namespace pvAccess { _totalBytesSent(0), _remoteBufferFreeSpace(INT64_MAX) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(blockingTCPTransport); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(blockingTCPTransport); // TODO minor tweak: deque size is not preallocated... @@ -181,7 +180,7 @@ namespace pvAccess { } BlockingTCPTransport::~BlockingTCPTransport() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(blockingTCPTransport); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(blockingTCPTransport); close(true); diff --git a/pvAccessApp/remote/blockingUDPTransport.cpp b/pvAccessApp/remote/blockingUDPTransport.cpp index b5934b2..87d68bd 100644 --- a/pvAccessApp/remote/blockingUDPTransport.cpp +++ b/pvAccessApp/remote/blockingUDPTransport.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include @@ -27,7 +26,7 @@ using namespace std; namespace epics { namespace pvAccess { - PVDATA_REFCOUNT_MONITOR_DEFINE(blockingUDPTransport); + PVACCESS_REFCOUNT_MONITOR_DEFINE(blockingUDPTransport); BlockingUDPTransport::BlockingUDPTransport( auto_ptr& responseHandler, SOCKET channel, @@ -45,7 +44,7 @@ namespace epics { _lastMessageStartPosition(0), _threadId(0) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(blockingUDPTransport); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(blockingUDPTransport); // set receive timeout so that we do not have problems at shutdown (recvfrom would block) struct timeval timeout; @@ -66,7 +65,7 @@ namespace epics { } BlockingUDPTransport::~BlockingUDPTransport() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(blockingUDPTransport); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(blockingUDPTransport); close(true); // close the socket and stop the thread. diff --git a/pvAccessApp/remote/remote.h b/pvAccessApp/remote/remote.h index 59b6535..105d887 100644 --- a/pvAccessApp/remote/remote.h +++ b/pvAccessApp/remote/remote.h @@ -28,6 +28,10 @@ namespace epics { namespace pvAccess { +#define PVACCESS_REFCOUNT_MONITOR_DEFINE(name) +#define PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(name) +#define PVACCESS_REFCOUNT_MONITOR_DESTRUCT(name) + class TransportRegistry; enum QoS { diff --git a/pvAccessApp/remote/simpleChannelSearchManagerImpl.cpp b/pvAccessApp/remote/simpleChannelSearchManagerImpl.cpp index 574a4b4..9586de0 100644 --- a/pvAccessApp/remote/simpleChannelSearchManagerImpl.cpp +++ b/pvAccessApp/remote/simpleChannelSearchManagerImpl.cpp @@ -35,13 +35,20 @@ const int SimpleChannelSearchManagerImpl::MAX_FRAMES_AT_ONCE = 10; const int SimpleChannelSearchManagerImpl::DELAY_BETWEEN_FRAMES_MS = 50; +SimpleChannelSearchManagerImpl::shared_pointer +SimpleChannelSearchManagerImpl::create(Context::shared_pointer const & context) +{ + SimpleChannelSearchManagerImpl::shared_pointer thisPtr(new SimpleChannelSearchManagerImpl(context)); + thisPtr->activate(); + return thisPtr; +} + SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_pointer const & context) : m_context(context), m_canceled(), m_sequenceNumber(0), m_sendBuffer(MAX_UDP_SEND), m_channels(), - m_timerNode(*this), m_lastTimeSent(), m_mockTransportSendControl(), m_channelMutex(), @@ -54,10 +61,16 @@ SimpleChannelSearchManagerImpl::SimpleChannelSearchManagerImpl(Context::shared_p // initialize random seed with some random value srand ( time(NULL) ); +} +void SimpleChannelSearchManagerImpl::activate() +{ // add some jitter so that all the clients do not send at the same time double period = ATOMIC_PERIOD + (rand() % (2*PERIOD_JITTER_MS+1) - PERIOD_JITTER_MS)/(double)1000; - context->getTimer()->schedulePeriodic(m_timerNode, period, period); + + Context::shared_pointer context = m_context.lock(); + if (context.get()) + context->getTimer()->schedulePeriodic(shared_from_this(), period, period); //new Thread(this, "pvAccess immediate-search").start(); } @@ -75,7 +88,9 @@ void SimpleChannelSearchManagerImpl::cancel() return; m_canceled.set(); - m_timerNode.cancel(); + Context::shared_pointer context = m_context.lock(); + if (context.get()) + context->getTimer()->cancel(shared_from_this()); } int32_t SimpleChannelSearchManagerImpl::registeredCount() diff --git a/pvAccessApp/remote/simpleChannelSearchManagerImpl.h b/pvAccessApp/remote/simpleChannelSearchManagerImpl.h index 267bfee..35776c1 100644 --- a/pvAccessApp/remote/simpleChannelSearchManagerImpl.h +++ b/pvAccessApp/remote/simpleChannelSearchManagerImpl.h @@ -36,7 +36,10 @@ public: }; -class SimpleChannelSearchManagerImpl : public ChannelSearchManager, public epics::pvData::TimerCallback +class SimpleChannelSearchManagerImpl : + public ChannelSearchManager, + public epics::pvData::TimerCallback, + public std::tr1::enable_shared_from_this { public: POINTER_DEFINITIONS(SimpleChannelSearchManagerImpl); @@ -45,7 +48,7 @@ class SimpleChannelSearchManagerImpl : public ChannelSearchManager, public epics * Constructor. * @param context */ - SimpleChannelSearchManagerImpl(Context::shared_pointer const & context); + static SimpleChannelSearchManagerImpl::shared_pointer create(Context::shared_pointer const & context); /** * Constructor. * @param context @@ -92,6 +95,13 @@ class SimpleChannelSearchManagerImpl : public ChannelSearchManager, public epics private: + /** + * Private constructor. + * @param context + */ + SimpleChannelSearchManagerImpl(Context::shared_pointer const & context); + void activate(); + bool generateSearchRequestMessage(SearchInstance::shared_pointer const & channel, bool allowNewFrame, bool flush); static bool generateSearchRequestMessage(SearchInstance::shared_pointer const & channel, @@ -129,12 +139,6 @@ class SimpleChannelSearchManagerImpl : public ChannelSearchManager, public epics */ std::map m_channels; - /** - * Timer node. - * (sync on requestPendingChannels) - */ - epics::pvData::TimerNode m_timerNode; - /** * Time of last frame send. */ diff --git a/pvAccessApp/remoteClient/clientContextImpl.cpp b/pvAccessApp/remoteClient/clientContextImpl.cpp index f1ab61a..60ed5ba 100644 --- a/pvAccessApp/remoteClient/clientContextImpl.cpp +++ b/pvAccessApp/remoteClient/clientContextImpl.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -306,7 +305,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelProcess); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelProcess); class ChannelProcessRequestImpl : public BaseRequestImpl, @@ -321,7 +320,7 @@ namespace epics { m_callback(callback), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelProcess); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelProcess); } void activate() @@ -354,7 +353,7 @@ namespace epics { ~ChannelProcessRequestImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelProcess); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelProcess); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -449,7 +448,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelGet); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelGet); class ChannelGetImpl : public BaseRequestImpl, @@ -469,7 +468,7 @@ namespace epics { BaseRequestImpl(channel, static_pointer_cast(channelGetRequester)), m_channelGetRequester(channelGetRequester), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelGet); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelGet); } void activate() @@ -509,7 +508,7 @@ namespace epics { ~ChannelGetImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelGet); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelGet); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -655,7 +654,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelPut); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelPut); class ChannelPutImpl : public BaseRequestImpl, public ChannelPut { @@ -673,7 +672,7 @@ namespace epics { BaseRequestImpl(channel, static_pointer_cast(channelPutRequester)), m_channelPutRequester(channelPutRequester), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelPut); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelPut); } void activate() @@ -713,7 +712,7 @@ namespace epics { ~ChannelPutImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelPut); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelPut); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -887,7 +886,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelPutGet); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelPutGet); class ChannelPutGetImpl : public BaseRequestImpl, public ChannelPutGet { @@ -905,7 +904,7 @@ namespace epics { BaseRequestImpl(channel, static_pointer_cast(channelPutGetRequester)), m_channelPutGetRequester(channelPutGetRequester), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelPutGet); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelPutGet); } void activate() @@ -940,7 +939,7 @@ namespace epics { ~ChannelPutGetImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelPutGet); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelPutGet); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -1177,7 +1176,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelRPC); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelRPC); class ChannelRPCImpl : public BaseRequestImpl, public ChannelRPC { @@ -1194,7 +1193,7 @@ namespace epics { BaseRequestImpl(channel, static_pointer_cast(channelRPCRequester)), m_channelRPCRequester(channelRPCRequester), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelRPC); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelRPC); } void activate() @@ -1228,7 +1227,7 @@ namespace epics { ~ChannelRPCImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelRPC); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelRPC); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -1366,7 +1365,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelArray); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelArray); class ChannelArrayImpl : public BaseRequestImpl, public ChannelArray { @@ -1390,7 +1389,7 @@ namespace epics { m_channelArrayRequester(channelArrayRequester), m_pvRequest(pvRequest), m_offset(0), m_count(0), m_length(-1), m_capacity(-1) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelArray); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelArray); } void activate() @@ -1426,7 +1425,7 @@ namespace epics { ~ChannelArrayImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelArray); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelArray); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -1651,7 +1650,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelGetField); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelGetField); // NOTE: this instance is not returned as Request, so it must self-destruct class ChannelGetFieldRequestImpl : @@ -1683,7 +1682,7 @@ namespace epics { m_ioid(INVALID_IOID), m_destroyed(false) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelGetField); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelGetField); } void activate() @@ -1713,7 +1712,7 @@ namespace epics { ~ChannelGetFieldRequestImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelGetField); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelGetField); } Requester::shared_pointer getRequester() { @@ -2065,7 +2064,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channelMonitor); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channelMonitor); class ChannelMonitorImpl : public BaseRequestImpl, @@ -2085,7 +2084,7 @@ namespace epics { m_started(false), m_pvRequest(pvRequest) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channelMonitor); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channelMonitor); } void activate() @@ -2153,7 +2152,7 @@ namespace epics { ~ChannelMonitorImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channelMonitor); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channelMonitor); } virtual void send(ByteBuffer* buffer, TransportSendControl* control) { @@ -2740,7 +2739,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(channel); + PVACCESS_REFCOUNT_MONITOR_DEFINE(channel); /** @@ -2766,7 +2765,7 @@ namespace epics { - PVDATA_REFCOUNT_MONITOR_DEFINE(remoteClientContext); + PVACCESS_REFCOUNT_MONITOR_DEFINE(remoteClientContext); class InternalClientContextImpl : public ClientContextImpl, @@ -2996,7 +2995,7 @@ namespace epics { m_serverChannelID(0xFFFFFFFF), m_issueCreateMessage(true) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(channel); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(channel); } void activate() @@ -3025,7 +3024,7 @@ namespace epics { ~InternalChannelImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(channel); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(channel); } virtual void destroy() @@ -3743,7 +3742,7 @@ namespace epics { m_contextState(CONTEXT_NOT_INITIALIZED), m_configuration(new SystemConfigurationImpl()) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(remoteClientContext); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(remoteClientContext); m_provider.reset(new ChannelProviderImpl(this)); loadConfiguration(); } @@ -3866,7 +3865,7 @@ TODO ~InternalClientContextImpl() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(remoteClientContext); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(remoteClientContext); }; private: @@ -3889,7 +3888,7 @@ TODO m_transportRegistry.reset(new TransportRegistry()); // setup search manager - m_channelSearchManager.reset(new SimpleChannelSearchManagerImpl(thisPointer)); + m_channelSearchManager = SimpleChannelSearchManagerImpl::create(thisPointer); // TODO put memory barrier here... diff --git a/pvAccessApp/server/beaconEmitter.cpp b/pvAccessApp/server/beaconEmitter.cpp index 87075c2..c567870 100644 --- a/pvAccessApp/server/beaconEmitter.cpp +++ b/pvAccessApp/server/beaconEmitter.cpp @@ -36,8 +36,7 @@ BeaconEmitter::BeaconEmitter(Transport::shared_pointer const & transport, std::t _serverAddress(*(context->getServerInetAddress())), _serverPort(context->getServerPort()), _serverStatusProvider(context->getBeaconServerStatusProvider()), - _timer(context->getTimer()), - _timerNode(*this) + _timer(context->getTimer()) { _startupTime.getCurrent(); } @@ -52,8 +51,7 @@ BeaconEmitter::BeaconEmitter(Transport::shared_pointer const & transport, const _serverAddress(serverAddress), _serverPort(serverAddress.ia.sin_port), _serverStatusProvider(), - _timer(new Timer("pvAccess-server timer", lowPriority)), - _timerNode(*this) + _timer(new Timer("pvAccess-server timer", lowPriority)) { _startupTime.getCurrent(); } @@ -125,12 +123,12 @@ void BeaconEmitter::timerStopped() void BeaconEmitter::destroy() { - _timerNode.cancel(); + _timer->cancel(shared_from_this()); } void BeaconEmitter::start() { - _timer->scheduleAfterDelay(_timerNode, 0.0); + _timer->scheduleAfterDelay(shared_from_this(), 0.0); } void BeaconEmitter::reschedule() @@ -138,7 +136,7 @@ void BeaconEmitter::reschedule() const double period = (_beaconSequenceID >= _beaconCountLimit) ? _slowBeaconPeriod : _fastBeaconPeriod; if (period > 0) { - _timer->scheduleAfterDelay(_timerNode, period); + _timer->scheduleAfterDelay(shared_from_this(), period); } } diff --git a/pvAccessApp/server/beaconEmitter.h b/pvAccessApp/server/beaconEmitter.h index b0a0c0f..5a7d40b 100644 --- a/pvAccessApp/server/beaconEmitter.h +++ b/pvAccessApp/server/beaconEmitter.h @@ -135,12 +135,7 @@ namespace epics { namespace pvAccess { /** * Timer. */ - epics::pvData::Timer::shared_pointer _timer; - - /** - * Timer task node. - */ - epics::pvData::TimerNode _timerNode; + epics::pvData::Timer::shared_pointer _timer; }; }} diff --git a/testApp/client/MockClientImpl.cpp b/testApp/client/MockClientImpl.cpp index 5b0079f..aeeb170 100644 --- a/testApp/client/MockClientImpl.cpp +++ b/testApp/client/MockClientImpl.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -14,7 +13,7 @@ using namespace epics::pvAccess; -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelProcess); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelProcess); class MockChannelProcess : public ChannelProcess { @@ -26,14 +25,14 @@ class MockChannelProcess : public ChannelProcess private: ~MockChannelProcess() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelProcess); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelProcess); } public: MockChannelProcess(ChannelProcessRequester* channelProcessRequester, PVStructure *pvStructure, PVStructure *pvRequest) : m_channelProcessRequester(channelProcessRequester), m_pvStructure(pvStructure) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelProcess); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelProcess); PVField* field = pvStructure->getSubField(String("value")); if (field == 0) @@ -153,7 +152,7 @@ class MockChannelProcess : public ChannelProcess -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelGet); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelGet); class MockChannelGet : public ChannelGet { @@ -166,7 +165,7 @@ class MockChannelGet : public ChannelGet private: ~MockChannelGet() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelGet); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelGet); } public: @@ -174,7 +173,7 @@ class MockChannelGet : public ChannelGet m_channelGetRequester(channelGetRequester), m_pvStructure(pvStructure), m_bitSet(new BitSet(pvStructure->getNumberFields())), m_first(true) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelGet); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelGet); // TODO pvRequest m_channelGetRequester->channelGetConnect(Status::Ok, this, m_pvStructure, m_bitSet); @@ -208,7 +207,7 @@ class MockChannelGet : public ChannelGet -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelPut); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelPut); class MockChannelPut : public ChannelPut { @@ -221,7 +220,7 @@ class MockChannelPut : public ChannelPut private: ~MockChannelPut() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelPut); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelPut); } public: @@ -229,7 +228,7 @@ class MockChannelPut : public ChannelPut m_channelPutRequester(channelPutRequester), m_pvStructure(pvStructure), m_bitSet(new BitSet(pvStructure->getNumberFields())), m_first(true) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPut); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPut); // TODO pvRequest m_channelPutRequester->channelPutConnect(Status::Ok, this, m_pvStructure, m_bitSet); @@ -261,7 +260,7 @@ class MockChannelPut : public ChannelPut -PVDATA_REFCOUNT_MONITOR_DEFINE(mockMonitor); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockMonitor); class MockMonitor : public Monitor, public MonitorElement { @@ -277,7 +276,7 @@ class MockMonitor : public Monitor, public MonitorElement private: ~MockMonitor() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockMonitor); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockMonitor); } public: @@ -289,7 +288,7 @@ class MockMonitor : public Monitor, public MonitorElement m_lock(), m_count(0) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockMonitor); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockMonitor); m_changedBitSet->set(0); @@ -365,7 +364,7 @@ class MockMonitor : public Monitor, public MonitorElement -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannel); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannel); class MockChannel : public Channel { private: @@ -379,7 +378,7 @@ class MockChannel : public Channel { private: ~MockChannel() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannel); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannel); } public: @@ -394,7 +393,7 @@ class MockChannel : public Channel { m_name(name), m_remoteAddress(remoteAddress) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannel); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannel); ScalarType stype = pvDouble; @@ -960,8 +959,7 @@ int main(int argc,char *argv[]) context->destroy(); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); return(0); } diff --git a/testApp/client/testCreateRequest.cpp b/testApp/client/testCreateRequest.cpp index 6b9f0fb..0768de4 100644 --- a/testApp/client/testCreateRequest.cpp +++ b/testApp/client/testCreateRequest.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -131,9 +130,8 @@ int main(int argc,char *argv[]) { testCreateRequest(); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); return 0; } diff --git a/testApp/remote/eget.cpp b/testApp/remote/eget.cpp index 8a1f472..089e8c3 100644 --- a/testApp/remote/eget.cpp +++ b/testApp/remote/eget.cpp @@ -11,7 +11,6 @@ #include -#include #include #include @@ -1005,9 +1004,8 @@ int main (int argc, char *argv[]) { // TODO implement wait on context epicsThreadSleep ( 3.0 ); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); } return allOK ? 0 : 1; diff --git a/testApp/remote/pvget.cpp b/testApp/remote/pvget.cpp index 56df8d9..2db9682 100644 --- a/testApp/remote/pvget.cpp +++ b/testApp/remote/pvget.cpp @@ -10,7 +10,6 @@ #include -#include #include #include @@ -654,9 +653,8 @@ int main (int argc, char *argv[]) { // TODO implement wait on context epicsThreadSleep ( 3.0 ); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); } return allOK ? 0 : 1; diff --git a/testApp/remote/testChannelConnect.cpp b/testApp/remote/testChannelConnect.cpp index 2f6fb44..1c8f2c7 100644 --- a/testApp/remote/testChannelConnect.cpp +++ b/testApp/remote/testChannelConnect.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -92,8 +91,7 @@ int main(int argc,char *argv[]) } epicsThreadSleep ( 2.0 ); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); return(0); } diff --git a/testApp/remote/testChannelSearchManager.cpp b/testApp/remote/testChannelSearchManager.cpp index 75b1f60..4ca162d 100644 --- a/testApp/remote/testChannelSearchManager.cpp +++ b/testApp/remote/testChannelSearchManager.cpp @@ -5,7 +5,6 @@ #include #include #include -#include epicsMessageQueueId join1; epicsMessageQueueId join2; @@ -191,8 +190,7 @@ int main(int argc,char *argv[]) context->destroy(); - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout); + //epicsExitCallAtExits(); for(int i = 0; i < max_channels; i++) { diff --git a/testApp/remote/testRemoteClientImpl.cpp b/testApp/remote/testRemoteClientImpl.cpp index 94b6c25..cb5d425 100644 --- a/testApp/remote/testRemoteClientImpl.cpp +++ b/testApp/remote/testRemoteClientImpl.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include @@ -578,8 +577,7 @@ int main(int argc,char *argv[]) */ epicsThreadSleep ( 1.0 ); } - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); return(0); } diff --git a/testApp/remote/testServer.cpp b/testApp/remote/testServer.cpp index 2debcb8..62d686b 100644 --- a/testApp/remote/testServer.cpp +++ b/testApp/remote/testServer.cpp @@ -4,7 +4,6 @@ #include #include -#include #include #include @@ -19,7 +18,7 @@ using namespace std; using std::tr1::static_pointer_cast; -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelProcess); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelProcess); class MockChannelProcess : public ChannelProcess, @@ -34,7 +33,7 @@ class MockChannelProcess : MockChannelProcess(ChannelProcessRequester::shared_pointer const & channelProcessRequester, PVStructure::shared_pointer const & pvStructure, PVStructure::shared_pointer const & pvRequest) : m_channelProcessRequester(channelProcessRequester), m_pvStructure(pvStructure) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelProcess); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelProcess); ChannelProcess::shared_pointer thisPtr; // we return null = static_pointer_cast(shared_from_this()); PVFieldPtr field = pvStructure->getSubField(String("value")); @@ -72,7 +71,7 @@ class MockChannelProcess : virtual ~MockChannelProcess() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelProcess); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelProcess); } @@ -175,7 +174,7 @@ class MockChannelProcess : -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelGet); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelGet); class MockChannelGet : public ChannelGet { @@ -190,7 +189,7 @@ class MockChannelGet : public ChannelGet m_channelGetRequester(channelGetRequester), m_pvStructure(pvStructure), m_bitSet(new BitSet(pvStructure->getNumberFields())), m_first(true) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelGet); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelGet); } public: @@ -205,7 +204,7 @@ class MockChannelGet : public ChannelGet virtual ~MockChannelGet() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelGet); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelGet); } virtual void get(bool lastRequest) @@ -239,7 +238,7 @@ class MockChannelGet : public ChannelGet -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelPut); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelPut); class MockChannelPut : public ChannelPut { @@ -253,7 +252,7 @@ class MockChannelPut : public ChannelPut m_channelPutRequester(channelPutRequester), m_pvStructure(pvStructure), m_bitSet(new BitSet(pvStructure->getNumberFields())) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPut); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPut); } public: @@ -268,7 +267,7 @@ class MockChannelPut : public ChannelPut virtual ~MockChannelPut() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelPut); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelPut); } @@ -302,7 +301,7 @@ class MockChannelPut : public ChannelPut -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelPutGet); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelPutGet); class MockChannelPutGet : public ChannelPutGet { @@ -314,7 +313,7 @@ class MockChannelPutGet : public ChannelPutGet MockChannelPutGet(ChannelPutGetRequester::shared_pointer const & channelPutGetRequester, PVStructure::shared_pointer const & pvStructure, PVStructure::shared_pointer const & pvRequest) : m_channelPutGetRequester(channelPutGetRequester), m_pvStructure(pvStructure) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPutGet); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelPutGet); } public: @@ -329,7 +328,7 @@ class MockChannelPutGet : public ChannelPutGet virtual ~MockChannelPutGet() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelPutGet); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelPutGet); } virtual void putGet(bool lastRequest) @@ -369,7 +368,7 @@ class MockChannelPutGet : public ChannelPutGet -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelRPC); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelRPC); class MockChannelRPC : public ChannelRPC { @@ -382,7 +381,7 @@ class MockChannelRPC : public ChannelRPC MockChannelRPC(ChannelRPCRequester::shared_pointer const & channelRPCRequester, String const & channelName, PVStructure::shared_pointer const & pvStructure, PVStructure::shared_pointer const & pvRequest) : m_channelRPCRequester(channelRPCRequester), m_channelName(channelName), m_pvStructure(pvStructure) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelRPC); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelRPC); } public: @@ -396,7 +395,7 @@ class MockChannelRPC : public ChannelRPC virtual ~MockChannelRPC() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelRPC); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelRPC); } virtual void request(epics::pvData::PVStructure::shared_pointer const & pvArgument, bool lastRequest) @@ -492,7 +491,7 @@ class MockChannelRPC : public ChannelRPC -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannelArray); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannelArray); class MockChannelArray : public ChannelArray { @@ -505,7 +504,7 @@ class MockChannelArray : public ChannelArray m_channelArrayRequester(channelArrayRequester), m_pvArray(getPVDataCreate()->createPVScalarArray(pvDouble)) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannelArray); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannelArray); } public: @@ -521,7 +520,7 @@ class MockChannelArray : public ChannelArray virtual ~MockChannelArray() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannelArray); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannelArray); } virtual void putArray(bool lastRequest, int offset, int count) @@ -568,7 +567,7 @@ class MockChannelArray : public ChannelArray -PVDATA_REFCOUNT_MONITOR_DEFINE(mockMonitor); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockMonitor); class MockMonitor : public Monitor, public MonitorElement, public std::tr1::enable_shared_from_this { @@ -593,7 +592,7 @@ class MockMonitor : public Monitor, public MonitorElement, public std::tr1::enab m_lock(), m_count(0) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockMonitor); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockMonitor); m_changedBitSet->set(0); } @@ -612,7 +611,7 @@ class MockMonitor : public Monitor, public MonitorElement, public std::tr1::enab virtual ~MockMonitor() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockMonitor); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockMonitor); } virtual Status start() @@ -691,7 +690,7 @@ class MockMonitor : public Monitor, public MonitorElement, public std::tr1::enab }; -PVDATA_REFCOUNT_MONITOR_DEFINE(mockChannel); +PVACCESS_REFCOUNT_MONITOR_DEFINE(mockChannel); class MockChannel : public Channel { private: @@ -714,7 +713,7 @@ class MockChannel : public Channel { m_remoteAddress(remoteAddress), m_pvStructure() { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(mockChannel); + PVACCESS_REFCOUNT_MONITOR_CONSTRUCT(mockChannel); @@ -826,7 +825,7 @@ class MockChannel : public Channel { virtual ~MockChannel() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(mockChannel); + PVACCESS_REFCOUNT_MONITOR_DESTRUCT(mockChannel); } virtual void destroy() @@ -1383,9 +1382,8 @@ int main(int argc, char *argv[]) { // TODO implement wait on context epicsThreadSleep ( 3.0 ); - std::cout << "-----------------------------------------------------------------------" << std::endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //std::cout << "-----------------------------------------------------------------------" << std::endl; + //epicsExitCallAtExits(); } return (0); diff --git a/testApp/remote/testServerContext.cpp b/testApp/remote/testServerContext.cpp index 4d10844..4f45f1d 100644 --- a/testApp/remote/testServerContext.cpp +++ b/testApp/remote/testServerContext.cpp @@ -3,7 +3,6 @@ */ #include -#include #include using namespace epics::pvAccess; @@ -93,7 +92,6 @@ int main(int argc, char *argv[]) cout << "Done" << endl; - epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + //epicsExitCallAtExits(); return (0); }