From 633801c2ae3cae7583ee0a65efddd1f446833a41 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Tue, 13 Sep 2011 09:56:39 +0200 Subject: [PATCH] RTEMS support; using namespace removed from headers --- configure/CONFIG_SITE | 2 +- pvAccessApp/ca/caConstants.h | 6 ++++- pvAccessApp/remote/blockingTCP.h | 18 ++++++++------- pvAccessApp/remote/blockingTCPAcceptor.cpp | 3 ++- pvAccessApp/remote/blockingTCPConnector.cpp | 8 +++---- pvAccessApp/remote/blockingTCPTransport.cpp | 4 ++-- pvAccessApp/remote/blockingUDP.h | 8 +++---- pvAccessApp/remote/channelSearchManager.cpp | 1 + pvAccessApp/remote/channelSearchManager.h | 13 ++++++----- pvAccessApp/remote/remote.h | 2 +- .../remoteClient/clientContextImpl.cpp | 1 + pvAccessApp/remoteClient/clientContextImpl.h | 4 ++-- pvAccessApp/server/baseChannelRequester.cpp | 2 +- pvAccessApp/server/baseChannelRequester.h | 2 ++ pvAccessApp/server/beaconEmitter.cpp | 1 + pvAccessApp/server/beaconEmitter.h | 2 +- pvAccessApp/server/responseHandlers.cpp | 4 ++-- pvAccessApp/server/responseHandlers.h | 13 ++++++----- pvAccessApp/server/serverContext.cpp | 2 ++ pvAccessApp/server/serverContext.h | 6 ++--- pvAccessApp/utils/introspectionRegistry.cpp | 2 ++ pvAccessApp/utils/introspectionRegistry.h | 22 ++++++++++++------- pvAccessApp/utils/transportRegistry.cpp | 2 +- testApp/remote/testBlockingTCPSrv.cpp | 4 +--- testApp/remote/testBlockingUDPClnt.cpp | 5 +---- testApp/remote/testBlockingUDPSrv.cpp | 6 ++--- testApp/remote/testChannelConnect.cpp | 1 + testApp/remote/testChannelSearchManager.cpp | 2 +- testApp/utils/introspectionRegistryTest.cpp | 1 + testApp/utils/transportRegistryTest.cpp | 3 +-- 30 files changed, 86 insertions(+), 64 deletions(-) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 14f824a..6a94e0f 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -25,7 +25,7 @@ #IOCS_APPL_TOP = ifeq ($(DEBUG),1) - DEBUG_CFLAGS=-O0 -g -ggdb + DEBUG_CFLAGS=-g -ggdb endif ifeq ($(EPICS_HOST_ARCH),linux-x86) diff --git a/pvAccessApp/ca/caConstants.h b/pvAccessApp/ca/caConstants.h index 0714920..8b19cdb 100644 --- a/pvAccessApp/ca/caConstants.h +++ b/pvAccessApp/ca/caConstants.h @@ -10,7 +10,11 @@ #include -using namespace epics::pvData; +using epics::pvData::int8; +using epics::pvData::int16; +using epics::pvData::int32; +using epics::pvData::uint32; +using epics::pvData::String; namespace epics { namespace pvAccess { diff --git a/pvAccessApp/remote/blockingTCP.h b/pvAccessApp/remote/blockingTCP.h index f2d2e0a..8e23337 100644 --- a/pvAccessApp/remote/blockingTCP.h +++ b/pvAccessApp/remote/blockingTCP.h @@ -34,6 +34,8 @@ #include #include +using epics::pvData::int64; + namespace epics { namespace pvAccess { @@ -59,7 +61,7 @@ namespace epics { public: virtual bool isClosed() { - Lock guard(_mutex); + epics::pvData::Lock guard(_mutex); return _closed; } @@ -110,12 +112,12 @@ namespace epics { virtual int getSocketReceiveBufferSize() const; virtual bool isVerified() { - Lock lock(_verifiedMutex); + epics::pvData::Lock lock(_verifiedMutex); return _verified; } virtual void verified() { - Lock lock(_verifiedMutex); + epics::pvData::Lock lock(_verifiedMutex); _verified = true; _verifiedEvent.signal(); } @@ -378,9 +380,9 @@ namespace epics { - Event _sendQueueEvent; + epics::pvData::Event _sendQueueEvent; - Event _verifiedEvent; + epics::pvData::Event _verifiedEvent; @@ -551,7 +553,7 @@ namespace epics { /** * Timer task node. */ - TimerNode _timerNode; + epics::pvData::TimerNode _timerNode; /** * Timestamp of last "live" event on this transport. @@ -767,7 +769,7 @@ namespace epics { */ std::map _channels; - Mutex _channelsMutex; + epics::pvData::Mutex _channelsMutex; /** * Destroy all channels. @@ -854,7 +856,7 @@ namespace epics { */ bool _destroyed; - Mutex _mutex; + epics::pvData::Mutex _mutex; epicsThreadId _threadId; diff --git a/pvAccessApp/remote/blockingTCPAcceptor.cpp b/pvAccessApp/remote/blockingTCPAcceptor.cpp index 538b4b3..625f77f 100644 --- a/pvAccessApp/remote/blockingTCPAcceptor.cpp +++ b/pvAccessApp/remote/blockingTCPAcceptor.cpp @@ -18,6 +18,7 @@ #include using std::ostringstream; +using namespace epics::pvData; namespace epics { namespace pvAccess { @@ -186,7 +187,7 @@ namespace epics { * Create transport, it registers itself to the registry. * Each transport should have its own response handler since it is not "shareable" */ - auto_ptr responseHandler = _responseHandlerFactory->createResponseHandler(); + std::auto_ptr responseHandler = _responseHandlerFactory->createResponseHandler(); BlockingServerTCPTransport::shared_pointer transport = BlockingServerTCPTransport::create( _context, diff --git a/pvAccessApp/remote/blockingTCPConnector.cpp b/pvAccessApp/remote/blockingTCPConnector.cpp index 63ac2a7..b7d2e1e 100644 --- a/pvAccessApp/remote/blockingTCPConnector.cpp +++ b/pvAccessApp/remote/blockingTCPConnector.cpp @@ -67,7 +67,7 @@ namespace epics { } Transport::shared_pointer BlockingTCPConnector::connect(TransportClient::shared_pointer const & client, - auto_ptr& responseHandler, osiSockAddr& address, + std::auto_ptr& responseHandler, osiSockAddr& address, short transportRevision, int16 priority) { SOCKET socket = INVALID_SOCKET; @@ -110,7 +110,7 @@ namespace epics { if(socket==INVALID_SOCKET) { LOG(logLevelDebug, "Connection to CA server %s failed.", ipAddrStr); - ostringstream temp; + std::ostringstream temp; temp<<"Failed to verify TCP connection to '"<& responseHandler, + SOCKET channel, std::auto_ptr& responseHandler, int receiveBufferSize, int16 priority) : _channel(channel), _priority(priority), @@ -117,7 +117,7 @@ namespace epics { // TODO minor tweak: deque size is not preallocated... - _socketBuffer = new ByteBuffer(max(MAX_TCP_RECV+MAX_ENSURE_DATA_BUFFER_SIZE, receiveBufferSize), EPICS_ENDIAN_BIG); + _socketBuffer = new ByteBuffer(max((int)(MAX_TCP_RECV+MAX_ENSURE_DATA_BUFFER_SIZE), receiveBufferSize), EPICS_ENDIAN_BIG); _socketBuffer->setPosition(_socketBuffer->getLimit()); _startPosition = _socketBuffer->getPosition(); diff --git a/pvAccessApp/remote/blockingUDP.h b/pvAccessApp/remote/blockingUDP.h index 1aa68a0..50c38e5 100644 --- a/pvAccessApp/remote/blockingUDP.h +++ b/pvAccessApp/remote/blockingUDP.h @@ -54,7 +54,7 @@ namespace epics { virtual ~BlockingUDPTransport(); virtual bool isClosed() { - Lock guard(_mutex); + epics::pvData::Lock guard(_mutex); return _closed; } @@ -264,9 +264,9 @@ namespace epics { /** * Used for process sync. */ - Mutex _mutex; - Mutex _sendMutex; - Event _shutdownEvent; + epics::pvData::Mutex _mutex; + epics::pvData::Mutex _sendMutex; + epics::pvData::Event _shutdownEvent; /** * Thread ID diff --git a/pvAccessApp/remote/channelSearchManager.cpp b/pvAccessApp/remote/channelSearchManager.cpp index 73e175c..9953109 100644 --- a/pvAccessApp/remote/channelSearchManager.cpp +++ b/pvAccessApp/remote/channelSearchManager.cpp @@ -5,6 +5,7 @@ #include using namespace std; +using namespace epics::pvData; namespace epics { namespace pvAccess { diff --git a/pvAccessApp/remote/channelSearchManager.h b/pvAccessApp/remote/channelSearchManager.h index 52a8372..90854d0 100644 --- a/pvAccessApp/remote/channelSearchManager.h +++ b/pvAccessApp/remote/channelSearchManager.h @@ -21,7 +21,10 @@ #include -using namespace epics::pvData; +using epics::pvData::Mutex; +using epics::pvData::String; +using epics::pvData::int32; +using epics::pvData::int64; namespace epics { namespace pvAccess { @@ -123,7 +126,7 @@ class ChannelSearchManager; /** * SearchTimer. */ -class SearchTimer: public TimerCallback +class SearchTimer: public epics::pvData::TimerCallback { public: /** @@ -226,7 +229,7 @@ private: * Timer node. * (sync on requestPendingChannels) */ - TimerNode* _timerNode; + epics::pvData::TimerNode* _timerNode; /** * Cancel this instance. */ @@ -263,8 +266,8 @@ public: void endMessage() {} void flush(bool lastMessageCompleted) {} void setRecipient(const osiSockAddr& sendTo) {} - void startMessage(int8 command, int32 ensureCapacity) {} - void ensureBuffer(int32 size) {} + void startMessage(int8 command, int ensureCapacity) {} + void ensureBuffer(int size) {} void flushSerializeBuffer() {} }; diff --git a/pvAccessApp/remote/remote.h b/pvAccessApp/remote/remote.h index 0e69aa4..c7c6037 100644 --- a/pvAccessApp/remote/remote.h +++ b/pvAccessApp/remote/remote.h @@ -277,7 +277,7 @@ namespace epics { virtual Transport::shared_pointer getSearchTransport() = 0; - virtual Timer::shared_pointer getTimer() = 0; + virtual epics::pvData::Timer::shared_pointer getTimer() = 0; //virtual TransportRegistry::shared_pointer getTransportRegistry() = 0; virtual std::tr1::shared_ptr getTransportRegistry() = 0; diff --git a/pvAccessApp/remoteClient/clientContextImpl.cpp b/pvAccessApp/remoteClient/clientContextImpl.cpp index a6235c6..1bf23f8 100644 --- a/pvAccessApp/remoteClient/clientContextImpl.cpp +++ b/pvAccessApp/remoteClient/clientContextImpl.cpp @@ -31,6 +31,7 @@ using std::tr1::dynamic_pointer_cast; using std::tr1::static_pointer_cast; +using namespace std; using namespace epics::pvData; namespace epics { diff --git a/pvAccessApp/remoteClient/clientContextImpl.h b/pvAccessApp/remoteClient/clientContextImpl.h index 8b7644b..9cd99e8 100644 --- a/pvAccessApp/remoteClient/clientContextImpl.h +++ b/pvAccessApp/remoteClient/clientContextImpl.h @@ -45,8 +45,8 @@ namespace epics { virtual Transport::shared_pointer checkAndGetTransport() = 0; virtual Transport::shared_pointer getTransport() = 0; - static Status channelDestroyed; - static Status channelDisconnected; + static epics::pvData::Status channelDestroyed; + static epics::pvData::Status channelDisconnected; }; diff --git a/pvAccessApp/server/baseChannelRequester.cpp b/pvAccessApp/server/baseChannelRequester.cpp index bfad61c..36a511f 100644 --- a/pvAccessApp/server/baseChannelRequester.cpp +++ b/pvAccessApp/server/baseChannelRequester.cpp @@ -57,7 +57,7 @@ int32 BaseChannelRequester::getPendingRequest() String BaseChannelRequester::getRequesterName() { - stringstream name; + std::stringstream name; name << typeid(*_transport).name() << "/" << _ioid; return name.str(); } diff --git a/pvAccessApp/server/baseChannelRequester.h b/pvAccessApp/server/baseChannelRequester.h index f9d13d7..8b4558d 100644 --- a/pvAccessApp/server/baseChannelRequester.h +++ b/pvAccessApp/server/baseChannelRequester.h @@ -11,6 +11,8 @@ #include #include +using epics::pvData::Status; + namespace epics { namespace pvAccess { diff --git a/pvAccessApp/server/beaconEmitter.cpp b/pvAccessApp/server/beaconEmitter.cpp index 921cc00..4e36029 100644 --- a/pvAccessApp/server/beaconEmitter.cpp +++ b/pvAccessApp/server/beaconEmitter.cpp @@ -12,6 +12,7 @@ #include using namespace std; +using namespace epics::pvData; namespace epics { namespace pvAccess { diff --git a/pvAccessApp/server/beaconEmitter.h b/pvAccessApp/server/beaconEmitter.h index 10d7f58..c8d4f43 100644 --- a/pvAccessApp/server/beaconEmitter.h +++ b/pvAccessApp/server/beaconEmitter.h @@ -133,7 +133,7 @@ namespace epics { namespace pvAccess { /** * Timer. */ - Timer::shared_pointer _timer; + epics::pvData::Timer::shared_pointer _timer; /** * Timer task node. diff --git a/pvAccessApp/server/responseHandlers.cpp b/pvAccessApp/server/responseHandlers.cpp index 4c294c8..cdea000 100644 --- a/pvAccessApp/server/responseHandlers.cpp +++ b/pvAccessApp/server/responseHandlers.cpp @@ -80,7 +80,7 @@ void ServerResponseHandler::handleResponse(osiSockAddr* responseFrom, "Invalid (or unsupported) command: %x.", (0xFF&command)); // TODO remove debug output - ostringstream name; + std::ostringstream name; name<<"Invalid CA header "< #include +using epics::pvData::BitSet; +using epics::pvData::PVStructure; + namespace epics { namespace pvAccess { @@ -61,7 +64,7 @@ namespace epics { /** * Table of response handlers for each command ID. */ - vector m_handlerTable; + std::vector m_handlerTable; }; @@ -174,8 +177,8 @@ namespace epics { public: ServerChannelFindRequesterImpl(ServerContextImpl::shared_pointer const & context, int32 expectedResponseCount); void clear(); - ServerChannelFindRequesterImpl* set(String _name, int32 searchSequenceId, int32 cid, osiSockAddr* sendTo, boolean responseRequired); - void channelFindResult(const epics::pvData::Status& status, ChannelFind::shared_pointer const & channelFind, boolean wasFound); + ServerChannelFindRequesterImpl* set(String _name, int32 searchSequenceId, int32 cid, osiSockAddr* sendTo, bool responseRequired); + void channelFindResult(const epics::pvData::Status& status, ChannelFind::shared_pointer const & channelFind, bool wasFound); void lock(); void unlock(); void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control); @@ -463,7 +466,7 @@ namespace epics { class ServerMonitorRequesterImpl : public BaseChannelRequester, - public MonitorRequester, + public epics::pvData::MonitorRequester, public TransportSender, public std::tr1::enable_shared_from_this { @@ -476,7 +479,7 @@ namespace epics { Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: - static MonitorRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, + static epics::pvData::MonitorRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); diff --git a/pvAccessApp/server/serverContext.cpp b/pvAccessApp/server/serverContext.cpp index 5e47331..e65e6f3 100644 --- a/pvAccessApp/server/serverContext.cpp +++ b/pvAccessApp/server/serverContext.cpp @@ -8,6 +8,8 @@ #include +using namespace std; +using namespace epics::pvData; using std::tr1::dynamic_pointer_cast; using std::tr1::static_pointer_cast; diff --git a/pvAccessApp/server/serverContext.h b/pvAccessApp/server/serverContext.h index 4f5252f..b7c9c24 100644 --- a/pvAccessApp/server/serverContext.h +++ b/pvAccessApp/server/serverContext.h @@ -73,7 +73,7 @@ public: * Prints detailed information about the context to the specified output stream. * @param str stream to which to print the info */ - virtual void printInfo(ostream& str) = 0; + virtual void printInfo(std::ostream& str) = 0; /** * Dispose (destroy) server context. @@ -117,11 +117,11 @@ public: void shutdown(); void destroy(); void printInfo(); - void printInfo(ostream& str); + void printInfo(std::ostream& str); void dispose(); void setBeaconServerStatusProvider(BeaconServerStatusProvider::shared_pointer const & beaconServerStatusProvider); //**************** derived from Context ****************// - Timer::shared_pointer getTimer(); + epics::pvData::Timer::shared_pointer getTimer(); Channel::shared_pointer getChannel(pvAccessID id); Transport::shared_pointer getSearchTransport(); Configuration::shared_pointer getConfiguration(); diff --git a/pvAccessApp/utils/introspectionRegistry.cpp b/pvAccessApp/utils/introspectionRegistry.cpp index 63c9ab2..273dff7 100644 --- a/pvAccessApp/utils/introspectionRegistry.cpp +++ b/pvAccessApp/utils/introspectionRegistry.cpp @@ -5,6 +5,8 @@ #include #include +using namespace epics::pvData; +using namespace std; using std::tr1::static_pointer_cast; namespace epics { namespace pvAccess { diff --git a/pvAccessApp/utils/introspectionRegistry.h b/pvAccessApp/utils/introspectionRegistry.h index acef2cf..097fee2 100644 --- a/pvAccessApp/utils/introspectionRegistry.h +++ b/pvAccessApp/utils/introspectionRegistry.h @@ -21,8 +21,14 @@ // TODO check for memory leaks // TODO to be removed out of header -using namespace epics::pvData; -using namespace std; +using epics::pvData::ByteBuffer; +using epics::pvData::FieldConstPtr; +using epics::pvData::StructureConstPtr; +using epics::pvData::SerializableControl; +using epics::pvData::DeserializableControl; +using epics::pvData::PVStructurePtr; +using std::string; +using epics::pvData::int8; namespace epics { namespace pvAccess { @@ -34,7 +40,7 @@ typedef std::map registryMap_t; * Registry is used to cache introspection interfaces to minimize network traffic. * @author gjansa */ - class IntrospectionRegistry : public NoDefaultMethods { + class IntrospectionRegistry : public epics::pvData::NoDefaultMethods { public: IntrospectionRegistry(bool serverSide); virtual ~IntrospectionRegistry(); @@ -209,7 +215,7 @@ typedef std::map registryMap_t; * @param control serialization control. * @param status status to serialize. */ - void serializeStatus(ByteBuffer* buffer, SerializableControl* control, const Status &status); + void serializeStatus(ByteBuffer* buffer, SerializableControl* control, const epics::pvData::Status &status); /** * Deserialize status. @@ -217,7 +223,7 @@ typedef std::map registryMap_t; * @param buffer data buffer. * @param control serialization control. */ - void deserializeStatus(Status &status, ByteBuffer* buffer, DeserializableControl* control); + void deserializeStatus(epics::pvData::Status &status, ByteBuffer* buffer, DeserializableControl* control); private: registryMap_t _registry; @@ -225,17 +231,17 @@ typedef std::map registryMap_t; registryMap_t::reverse_iterator _registryRIter; short _outgoingIdPointer; short _direction; - Mutex _mutex; + epics::pvData::Mutex _mutex; /** * PVField factory. */ - static PVDataCreate* _pvDataCreate; + static epics::pvData::PVDataCreate* _pvDataCreate; /** * Field factory. */ - static FieldCreate* _fieldCreate; + static epics::pvData::FieldCreate* _fieldCreate; bool registryContainsValue(FieldConstPtr field, short& key); }; diff --git a/pvAccessApp/utils/transportRegistry.cpp b/pvAccessApp/utils/transportRegistry.cpp index b59579e..24f6523 100644 --- a/pvAccessApp/utils/transportRegistry.cpp +++ b/pvAccessApp/utils/transportRegistry.cpp @@ -113,7 +113,7 @@ void TransportRegistry::clear() _transportCount = 0; } -int TransportRegistry::numberOfActiveTransports() +int32 TransportRegistry::numberOfActiveTransports() { Lock guard(_mutex); return _transportCount; diff --git a/testApp/remote/testBlockingTCPSrv.cpp b/testApp/remote/testBlockingTCPSrv.cpp index 5c5a36b..80aa4fa 100644 --- a/testApp/remote/testBlockingTCPSrv.cpp +++ b/testApp/remote/testBlockingTCPSrv.cpp @@ -15,9 +15,7 @@ using namespace epics::pvData; using namespace epics::pvAccess; - -using std::cin; -using std::cout; +using namespace std; class ContextImpl : public ServerContextImpl { public: diff --git a/testApp/remote/testBlockingUDPClnt.cpp b/testApp/remote/testBlockingUDPClnt.cpp index 129cbea..7ae8d4f 100644 --- a/testApp/remote/testBlockingUDPClnt.cpp +++ b/testApp/remote/testBlockingUDPClnt.cpp @@ -22,10 +22,7 @@ using namespace epics::pvAccess; using namespace epics::pvData; using std::tr1::static_pointer_cast; - -using std::cout; -using std::endl; -using std::sscanf; +using namespace std; static osiSockAddr sendTo; diff --git a/testApp/remote/testBlockingUDPSrv.cpp b/testApp/remote/testBlockingUDPSrv.cpp index 907f205..0f8eb58 100644 --- a/testApp/remote/testBlockingUDPSrv.cpp +++ b/testApp/remote/testBlockingUDPSrv.cpp @@ -16,10 +16,8 @@ #include using namespace epics::pvAccess; -using std::cout; -using std::endl; -using std::hex; -using std::dec; +using namespace epics::pvData; +using namespace std; using std::tr1::static_pointer_cast; class ContextImpl : public Context { diff --git a/testApp/remote/testChannelConnect.cpp b/testApp/remote/testChannelConnect.cpp index 66c531f..6f9d092 100644 --- a/testApp/remote/testChannelConnect.cpp +++ b/testApp/remote/testChannelConnect.cpp @@ -12,6 +12,7 @@ using namespace epics::pvData; using namespace epics::pvAccess; +using namespace std; #define N_CHANNELS 10000 diff --git a/testApp/remote/testChannelSearchManager.cpp b/testApp/remote/testChannelSearchManager.cpp index 6c58cd3..692d255 100644 --- a/testApp/remote/testChannelSearchManager.cpp +++ b/testApp/remote/testChannelSearchManager.cpp @@ -153,7 +153,7 @@ int main(int argc,char *argv[]) pthread_t _worker1Id; pthread_t _worker2Id; - ostringstream obuffer; + std::ostringstream obuffer; for(int i = 0; i < max_channels; i++) { obuffer.clear(); diff --git a/testApp/utils/introspectionRegistryTest.cpp b/testApp/utils/introspectionRegistryTest.cpp index 9053e9e..9e9aec9 100644 --- a/testApp/utils/introspectionRegistryTest.cpp +++ b/testApp/utils/introspectionRegistryTest.cpp @@ -17,6 +17,7 @@ #include using std::tr1::static_pointer_cast; +using namespace epics::pvData; namespace epics { namespace pvAccess { diff --git a/testApp/utils/transportRegistryTest.cpp b/testApp/utils/transportRegistryTest.cpp index 847af32..8b2c14d 100644 --- a/testApp/utils/transportRegistryTest.cpp +++ b/testApp/utils/transportRegistryTest.cpp @@ -12,7 +12,6 @@ #include #include - namespace epics { namespace pvAccess { @@ -154,7 +153,7 @@ int main(int argc, char *argv[]) addrArray.clear(); if(registry) delete registry; epicsExitCallAtExits(); - CDRMonitor::get().show(stdout, true); + epics::pvData::CDRMonitor::get().show(stdout, true); return 0; }