RTEMS support; using namespace removed from headers

This commit is contained in:
Matej Sekoranja
2011-09-13 09:56:39 +02:00
parent 54d435972b
commit 633801c2ae
30 changed files with 86 additions and 64 deletions

View File

@@ -25,7 +25,7 @@
#IOCS_APPL_TOP = </IOC/path/to/application/top>
ifeq ($(DEBUG),1)
DEBUG_CFLAGS=-O0 -g -ggdb
DEBUG_CFLAGS=-g -ggdb
endif
ifeq ($(EPICS_HOST_ARCH),linux-x86)

View File

@@ -10,7 +10,11 @@
#include <pv/pvType.h>
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 {

View File

@@ -34,6 +34,8 @@
#include <map>
#include <deque>
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<pvAccessID, ServerChannel::shared_pointer> _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;

View File

@@ -18,6 +18,7 @@
#include <sstream>
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> responseHandler = _responseHandlerFactory->createResponseHandler();
std::auto_ptr<ResponseHandler> responseHandler = _responseHandlerFactory->createResponseHandler();
BlockingServerTCPTransport::shared_pointer transport =
BlockingServerTCPTransport::create(
_context,

View File

@@ -67,7 +67,7 @@ namespace epics {
}
Transport::shared_pointer BlockingTCPConnector::connect(TransportClient::shared_pointer const & client,
auto_ptr<ResponseHandler>& responseHandler, osiSockAddr& address,
std::auto_ptr<ResponseHandler>& 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 '"<<ipAddrStr<<"'.";
THROW_BASE_EXCEPTION(temp.str().c_str());
}
@@ -150,7 +150,7 @@ namespace epics {
logLevelDebug,
"Connection to CA server %s failed to be validated, closing it.",
ipAddrStr);
ostringstream temp;
std::ostringstream temp;
temp<<"Failed to verify TCP connection to '"<<ipAddrStr<<"'.";
THROW_BASE_EXCEPTION(temp.str().c_str());
}
@@ -176,7 +176,7 @@ namespace epics {
}
}
else {
ostringstream temp;
std::ostringstream temp;
temp<<"Failed to obtain synchronization lock for '"<<ipAddrStr;
temp<<"', possible deadlock.";
THROW_BASE_EXCEPTION(temp.str().c_str());

View File

@@ -73,7 +73,7 @@ namespace epics {
PVDATA_REFCOUNT_MONITOR_DEFINE(blockingTCPTransport);
BlockingTCPTransport::BlockingTCPTransport(Context::shared_pointer const & context,
SOCKET channel, auto_ptr<ResponseHandler>& responseHandler,
SOCKET channel, std::auto_ptr<ResponseHandler>& 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();

View File

@@ -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

View File

@@ -5,6 +5,7 @@
#include <pv/channelSearchManager.h>
using namespace std;
using namespace epics::pvData;
namespace epics { namespace pvAccess {

View File

@@ -21,7 +21,10 @@
#include <deque>
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() {}
};

View File

@@ -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<TransportRegistry> getTransportRegistry() = 0;

View File

@@ -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 {

View File

@@ -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;
};

View File

@@ -57,7 +57,7 @@ int32 BaseChannelRequester::getPendingRequest()
String BaseChannelRequester::getRequesterName()
{
stringstream name;
std::stringstream name;
name << typeid(*_transport).name() << "/" << _ioid;
return name.str();
}

View File

@@ -11,6 +11,8 @@
#include <pv/requester.h>
#include <pv/destroyable.h>
using epics::pvData::Status;
namespace epics {
namespace pvAccess {

View File

@@ -12,6 +12,7 @@
#include <pv/serverContext.h>
using namespace std;
using namespace epics::pvData;
namespace epics { namespace pvAccess {

View File

@@ -133,7 +133,7 @@ namespace epics { namespace pvAccess {
/**
* Timer.
*/
Timer::shared_pointer _timer;
epics::pvData::Timer::shared_pointer _timer;
/**
* Timer task node.

View File

@@ -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 "<<hex<<(int)(0xFF&command);
name<<", its payload buffer";
@@ -415,7 +415,7 @@ void ServerChannelRequesterImpl::channelStateChange(Channel::shared_pointer cons
String ServerChannelRequesterImpl::getRequesterName()
{
stringstream name;
std::stringstream name;
name << "ServerChannelRequesterImpl/" << _channelName << "[" << _cid << "]";
return name.str();
}

View File

@@ -10,6 +10,9 @@
#include <pv/serverChannelImpl.h>
#include <pv/baseChannelRequester.h>
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<ResponseHandler::shared_pointer> m_handlerTable;
std::vector<ResponseHandler::shared_pointer> 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<ServerMonitorRequesterImpl>
{
@@ -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);

View File

@@ -8,6 +8,8 @@
#include <logger.h>
using namespace std;
using namespace epics::pvData;
using std::tr1::dynamic_pointer_cast;
using std::tr1::static_pointer_cast;

View File

@@ -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();

View File

@@ -5,6 +5,8 @@
#include <pv/introspectionRegistry.h>
#include <pv/convert.h>
using namespace epics::pvData;
using namespace std;
using std::tr1::static_pointer_cast;
namespace epics { namespace pvAccess {

View File

@@ -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<const short,FieldConstPtr> 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<const short,FieldConstPtr> 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<const short,FieldConstPtr> 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<const short,FieldConstPtr> 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);
};

View File

@@ -113,7 +113,7 @@ void TransportRegistry::clear()
_transportCount = 0;
}
int TransportRegistry::numberOfActiveTransports()
int32 TransportRegistry::numberOfActiveTransports()
{
Lock guard(_mutex);
return _transportCount;

View File

@@ -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:

View File

@@ -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;

View File

@@ -16,10 +16,8 @@
#include <sstream>
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 {

View File

@@ -12,6 +12,7 @@
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace std;
#define N_CHANNELS 10000

View File

@@ -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();

View File

@@ -17,6 +17,7 @@
#include <pv/convert.h>
using std::tr1::static_pointer_cast;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {

View File

@@ -12,7 +12,6 @@
#include <iostream>
#include <string>
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;
}