passing string by const ref
This commit is contained in:
@@ -14,8 +14,8 @@ using epics::pvData::String;
|
||||
namespace epics {
|
||||
namespace pvAccess {
|
||||
|
||||
Version::Version(epics::pvData::String productName,
|
||||
epics::pvData::String implementationLangugage,
|
||||
Version::Version(epics::pvData::String const & productName,
|
||||
epics::pvData::String const & implementationLangugage,
|
||||
int majorVersion, int minorVersion,
|
||||
int maintenanceVersion, bool developmentFlag) :
|
||||
_productName(productName),
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace pvAccess {
|
||||
* @param maintenanceVersion maintenance version.
|
||||
* @param developmentFlag development indicator flag.
|
||||
*/
|
||||
Version(epics::pvData::String productName,
|
||||
epics::pvData::String implementationLangugage,
|
||||
Version(epics::pvData::String const & productName,
|
||||
epics::pvData::String const & implementationLangugage,
|
||||
int majorVersion, int minorVersion,
|
||||
int maintenanceVersion, bool developmentFlag);
|
||||
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace pvAccess {
|
||||
* @param subField The name of the subField.
|
||||
* If this is null or an empty epics::pvData::String the returned Field is for the entire record.
|
||||
*/
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String subField) = 0;
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String const & subField) = 0;
|
||||
|
||||
/**
|
||||
* Get the access rights for a field of a PVStructure created via a call to createPVStructure.
|
||||
@@ -719,7 +719,7 @@ namespace pvAccess {
|
||||
* @param channelFindRequester The epics::pvData::Requester.
|
||||
* @return An interface for the find.
|
||||
*/
|
||||
virtual ChannelFind::shared_pointer channelFind(epics::pvData::String channelName,
|
||||
virtual ChannelFind::shared_pointer channelFind(epics::pvData::String const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester) = 0;
|
||||
|
||||
/**
|
||||
@@ -729,7 +729,7 @@ namespace pvAccess {
|
||||
* @param priority channel priority, must be <code>PRIORITY_MIN</code> <= priority <= <code>PRIORITY_MAX</code>.
|
||||
* @return <code>Channel</code> instance. If channel does not exist <code>null</code> is returned and <code>channelRequester</code> notified.
|
||||
*/
|
||||
virtual Channel::shared_pointer createChannel(epics::pvData::String channelName,ChannelRequester::shared_pointer const & channelRequester,
|
||||
virtual Channel::shared_pointer createChannel(epics::pvData::String const & channelName,ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority = PRIORITY_DEFAULT) = 0;
|
||||
|
||||
/**
|
||||
@@ -740,8 +740,8 @@ namespace pvAccess {
|
||||
* @param address address (or list of addresses) where to look for a channel. Implementation independed epics::pvData::String.
|
||||
* @return <code>Channel</code> instance. If channel does not exist <code>null</code> is returned and <code>channelRequester</code> notified.
|
||||
*/
|
||||
virtual Channel::shared_pointer createChannel(epics::pvData::String channelName,ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority, epics::pvData::String address) = 0;
|
||||
virtual Channel::shared_pointer createChannel(epics::pvData::String const & channelName,ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority, epics::pvData::String const & address) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -762,7 +762,7 @@ namespace pvAccess {
|
||||
* @param providerName The name of the provider.
|
||||
* @return The interface for the provider or null if the provider is not known.
|
||||
*/
|
||||
virtual ChannelProvider::shared_pointer getProvider(epics::pvData::String providerName) = 0;
|
||||
virtual ChannelProvider::shared_pointer getProvider(epics::pvData::String const & providerName) = 0;
|
||||
|
||||
/**
|
||||
* Get a array of the names of all the known providers.
|
||||
@@ -794,7 +794,7 @@ namespace pvAccess {
|
||||
* @return The request structure if an invalid request was given.
|
||||
*/
|
||||
virtual epics::pvData::PVStructure::shared_pointer createRequest(
|
||||
epics::pvData::String request,
|
||||
epics::pvData::String const & request,
|
||||
epics::pvData::Requester::shared_pointer const & requester) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ static ChannelProviderMap channelProviders;
|
||||
class ChannelAccessImpl : public ChannelAccess {
|
||||
public:
|
||||
|
||||
ChannelProvider::shared_pointer getProvider(String providerName) {
|
||||
ChannelProvider::shared_pointer getProvider(String const & providerName) {
|
||||
Lock guard(channelProviderMutex);
|
||||
return channelProviders[providerName];
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
return findMatchingBrace(request,closeBrace,numOpen-1);
|
||||
}
|
||||
|
||||
static std::vector<String> split(String commaSeparatedList) {
|
||||
static std::vector<String> split(String const & commaSeparatedList) {
|
||||
String::size_type numValues = 1;
|
||||
String::size_type index=0;
|
||||
while(true) {
|
||||
@@ -202,9 +202,10 @@ private:
|
||||
public:
|
||||
|
||||
virtual PVStructure::shared_pointer createRequest(
|
||||
String request,
|
||||
String const & crequest,
|
||||
Requester::shared_pointer const & requester)
|
||||
{
|
||||
String request = crequest;
|
||||
PVFieldPtrArray pvFields;
|
||||
StringArray fieldNames;
|
||||
PVStructurePtr emptyPVStructure = pvDataCreate->createPVStructure(fieldNames,pvFields);
|
||||
|
||||
@@ -48,7 +48,7 @@ void TransportRegistry::put(Transport::shared_pointer const & transport)
|
||||
(*priorities)[priority] = transport;
|
||||
}
|
||||
|
||||
Transport::shared_pointer TransportRegistry::get(String type, const osiSockAddr* address, const int16 priority)
|
||||
Transport::shared_pointer TransportRegistry::get(String const & type, const osiSockAddr* address, const int16 priority)
|
||||
{
|
||||
Lock guard(_mutex);
|
||||
transportsMap_t::iterator transportsIter = _transports.find(address);
|
||||
@@ -64,7 +64,7 @@ Transport::shared_pointer TransportRegistry::get(String type, const osiSockAddr*
|
||||
return Transport::shared_pointer();
|
||||
}
|
||||
|
||||
auto_ptr<TransportRegistry::transportVector_t> TransportRegistry::get(String type, const osiSockAddr* address)
|
||||
auto_ptr<TransportRegistry::transportVector_t> TransportRegistry::get(String const & type, const osiSockAddr* address)
|
||||
{
|
||||
Lock guard(_mutex);
|
||||
transportsMap_t::iterator transportsIter = _transports.find(address);
|
||||
@@ -122,7 +122,7 @@ int32 TransportRegistry::numberOfActiveTransports()
|
||||
return _transportCount;
|
||||
}
|
||||
|
||||
auto_ptr<TransportRegistry::transportVector_t> TransportRegistry::toArray(String type)
|
||||
auto_ptr<TransportRegistry::transportVector_t> TransportRegistry::toArray(String const & type)
|
||||
{
|
||||
// TODO support type
|
||||
return toArray();
|
||||
|
||||
@@ -34,12 +34,12 @@ public:
|
||||
virtual ~TransportRegistry();
|
||||
|
||||
void put(Transport::shared_pointer const & transport);
|
||||
Transport::shared_pointer get(epics::pvData::String type, const osiSockAddr* address, const epics::pvData::int16 priority);
|
||||
std::auto_ptr<transportVector_t> get(epics::pvData::String type, const osiSockAddr* address);
|
||||
Transport::shared_pointer get(epics::pvData::String const & type, const osiSockAddr* address, const epics::pvData::int16 priority);
|
||||
std::auto_ptr<transportVector_t> get(epics::pvData::String const & type, const osiSockAddr* address);
|
||||
Transport::shared_pointer remove(Transport::shared_pointer const & transport);
|
||||
void clear();
|
||||
epics::pvData::int32 numberOfActiveTransports();
|
||||
std::auto_ptr<transportVector_t> toArray(epics::pvData::String type);
|
||||
std::auto_ptr<transportVector_t> toArray(epics::pvData::String const & type);
|
||||
std::auto_ptr<transportVector_t> toArray();
|
||||
|
||||
private:
|
||||
|
||||
@@ -1671,7 +1671,7 @@ namespace epics {
|
||||
|
||||
ResponseRequest::shared_pointer m_thisPointer;
|
||||
|
||||
ChannelGetFieldRequestImpl(ChannelImpl::shared_pointer const & channel, GetFieldRequester::shared_pointer const & callback, String subField) :
|
||||
ChannelGetFieldRequestImpl(ChannelImpl::shared_pointer const & channel, GetFieldRequester::shared_pointer const & callback, String const & subField) :
|
||||
m_channel(channel),
|
||||
m_callback(callback),
|
||||
m_subField(subField),
|
||||
@@ -1697,7 +1697,7 @@ namespace epics {
|
||||
}
|
||||
|
||||
public:
|
||||
static ChannelGetFieldRequestImpl::shared_pointer create(ChannelImpl::shared_pointer const & channel, GetFieldRequester::shared_pointer const & callback, String subField)
|
||||
static ChannelGetFieldRequestImpl::shared_pointer create(ChannelImpl::shared_pointer const & channel, GetFieldRequester::shared_pointer const & callback, String const & subField)
|
||||
{
|
||||
ChannelGetFieldRequestImpl::shared_pointer thisPointer(new ChannelGetFieldRequestImpl(channel, callback, subField), delayed_destroyable_deleter());
|
||||
thisPointer->activate();
|
||||
@@ -2068,6 +2068,233 @@ namespace epics {
|
||||
|
||||
|
||||
|
||||
class MonitorStrategyQueue :
|
||||
public MonitorStrategy,
|
||||
public std::tr1::enable_shared_from_this<MonitorStrategyQueue>
|
||||
{
|
||||
private:
|
||||
|
||||
int32 m_queueSize;
|
||||
|
||||
StructureConstPtr m_lastStructure;
|
||||
//MonitorQueue::shared_pointer m_monitorQueue;
|
||||
|
||||
|
||||
MonitorRequester::shared_pointer m_callback;
|
||||
|
||||
Mutex m_mutex;
|
||||
|
||||
BitSet::shared_pointer m_bitSet1;
|
||||
BitSet::shared_pointer m_bitSet2;
|
||||
bool m_overrunInProgress;
|
||||
|
||||
bool m_needToReleaseFirst;
|
||||
|
||||
MonitorElement::shared_pointer m_nullMonitorElement;
|
||||
MonitorElement::shared_pointer m_monitorElement;
|
||||
|
||||
public:
|
||||
|
||||
MonitorStrategyQueue(MonitorRequester::shared_pointer const & callback, int32 queueSize) :
|
||||
m_queueSize(queueSize), m_lastStructure(),// m_monitorQueue(),
|
||||
m_callback(callback), m_mutex(),
|
||||
m_bitSet1(), m_bitSet2(), m_overrunInProgress(false),
|
||||
m_needToReleaseFirst(false),
|
||||
m_nullMonitorElement(), m_monitorElement()
|
||||
{
|
||||
if (queueSize <= 1)
|
||||
throw std::invalid_argument("queueSize <= 1");
|
||||
}
|
||||
|
||||
virtual ~MonitorStrategyQueue()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void init(StructureConstPtr const & structure) {
|
||||
Lock guard(m_mutex);
|
||||
|
||||
// reuse on reconnect
|
||||
if (m_lastStructure.get() == 0 ||
|
||||
*(m_lastStructure.get()) == *(structure.get()))
|
||||
{
|
||||
/*
|
||||
MonitorElement[] monitorElements = new MonitorElement[queueSize];
|
||||
for(int i=0; i<queueSize; i++) {
|
||||
PVStructure pvNew = pvDataCreate.createPVStructure(structure);
|
||||
monitorElements[i] = MonitorQueueFactory.createMonitorElement(pvNew);
|
||||
}
|
||||
monitorQueue = MonitorQueueFactory.create(monitorElements);
|
||||
lastStructure = structure;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
virtual void response(Transport::shared_pointer const & transport, ByteBuffer* payloadBuffer) {
|
||||
|
||||
bool notify = false;
|
||||
|
||||
{
|
||||
Lock guard(m_mutex);
|
||||
|
||||
// if in overrun mode, check if some is free
|
||||
if (m_overrunInProgress)
|
||||
{
|
||||
MonitorElementPtr newElement;//TODO = monitorQueue.getFree();
|
||||
if (newElement.get() != 0)
|
||||
{
|
||||
// take new, put current in use
|
||||
PVStructurePtr pvStructure = m_monitorElement->pvStructurePtr;
|
||||
getConvert()->copy(pvStructure, newElement->pvStructurePtr);
|
||||
|
||||
BitSetUtil::compress(m_monitorElement->changedBitSet.get(), pvStructure.get());
|
||||
BitSetUtil::compress(m_monitorElement->overrunBitSet.get(), pvStructure.get());
|
||||
|
||||
//monitorQueue.setUsed(monitorElement);
|
||||
|
||||
m_monitorElement = newElement;
|
||||
notify = true;
|
||||
|
||||
m_overrunInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (notify)
|
||||
{
|
||||
EXCEPTION_GUARD(m_callback->monitorEvent(shared_from_this()));
|
||||
}
|
||||
|
||||
{
|
||||
Lock guard(m_mutex);
|
||||
|
||||
// setup current fields
|
||||
PVStructurePtr pvStructure = m_monitorElement->pvStructurePtr;
|
||||
BitSet::shared_pointer changedBitSet = m_monitorElement->changedBitSet;
|
||||
BitSet::shared_pointer overrunBitSet = m_monitorElement->overrunBitSet;
|
||||
|
||||
// special treatment if in overrun state
|
||||
if (m_overrunInProgress)
|
||||
{
|
||||
// lazy init
|
||||
if (m_bitSet1.get() == 0) m_bitSet1.reset(new BitSet(changedBitSet->size()));
|
||||
if (m_bitSet2.get() == 0) m_bitSet2.reset(new BitSet(overrunBitSet->size()));
|
||||
|
||||
m_bitSet1->deserialize(payloadBuffer, transport.get());
|
||||
pvStructure->deserialize(payloadBuffer, transport.get(), m_bitSet1.get());
|
||||
m_bitSet2->deserialize(payloadBuffer, transport.get());
|
||||
|
||||
// OR local overrun
|
||||
// TODO this does not work perfectly... uncompressed bitSets should be used!!!
|
||||
overrunBitSet->or_and(*(changedBitSet.get()), *(m_bitSet1.get()));
|
||||
|
||||
// OR remove change
|
||||
*(changedBitSet.get()) |= *(m_bitSet1.get());
|
||||
|
||||
// OR remote overrun
|
||||
*(overrunBitSet.get()) |= *(m_bitSet2.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
// deserialize changedBitSet and data, and overrun bit set
|
||||
changedBitSet->deserialize(payloadBuffer, transport.get());
|
||||
pvStructure->deserialize(payloadBuffer, transport.get(), changedBitSet.get());
|
||||
overrunBitSet->deserialize(payloadBuffer, transport.get());
|
||||
}
|
||||
|
||||
// prepare next free (if any)
|
||||
MonitorElementPtr newElement; // = monitorQueue.getFree();
|
||||
if (newElement.get() == 0) {
|
||||
m_overrunInProgress = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// if there was overrun in progress we manipulated bitSets... compress them
|
||||
if (m_overrunInProgress) {
|
||||
BitSetUtil::compress(changedBitSet.get(), pvStructure.get());
|
||||
BitSetUtil::compress(overrunBitSet.get(), pvStructure.get());
|
||||
|
||||
m_overrunInProgress = false;
|
||||
}
|
||||
|
||||
getConvert()->copy(pvStructure, newElement->pvStructurePtr);
|
||||
|
||||
//monitorQueue.setUsed(monitorElement);
|
||||
|
||||
m_monitorElement = newElement;
|
||||
}
|
||||
|
||||
EXCEPTION_GUARD(m_callback->monitorEvent(shared_from_this()));
|
||||
|
||||
}
|
||||
|
||||
virtual MonitorElement::shared_pointer poll() {
|
||||
Lock guard(m_mutex);
|
||||
|
||||
if (m_needToReleaseFirst)
|
||||
return m_nullMonitorElement;
|
||||
MonitorElementPtr retVal;// = monitorQueue.getUsed();
|
||||
if (retVal.get() != 0)
|
||||
{
|
||||
m_needToReleaseFirst = true;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// if in overrun mode and we have free, make it as last element
|
||||
if (m_overrunInProgress)
|
||||
{
|
||||
MonitorElementPtr newElement;// = monitorQueue.getFree();
|
||||
if (newElement.get() != 0)
|
||||
{
|
||||
// take new, put current in use
|
||||
PVStructurePtr pvStructure = m_monitorElement->pvStructurePtr;
|
||||
getConvert()->copy(pvStructure, newElement->pvStructurePtr);
|
||||
|
||||
BitSetUtil::compress(m_monitorElement->changedBitSet.get(), pvStructure.get());
|
||||
BitSetUtil::compress(m_monitorElement->overrunBitSet.get(), pvStructure.get());
|
||||
//monitorQueue.setUsed(monitorElement);
|
||||
|
||||
m_monitorElement = newElement;
|
||||
|
||||
m_overrunInProgress = false;
|
||||
|
||||
m_needToReleaseFirst = true;
|
||||
return m_nullMonitorElement; // TODO monitorQueue.getUsed();
|
||||
}
|
||||
else
|
||||
return m_nullMonitorElement; // should never happen since queueSize >= 2, but a client not calling release can do this
|
||||
}
|
||||
else
|
||||
return m_nullMonitorElement;
|
||||
}
|
||||
|
||||
virtual void release(MonitorElement::shared_pointer const & monitorElement) {
|
||||
Lock guard(m_mutex);
|
||||
//monitorQueue.releaseUsed(monitorElement);
|
||||
m_needToReleaseFirst = false;
|
||||
}
|
||||
|
||||
Status start() {
|
||||
Lock guard(m_mutex);
|
||||
m_overrunInProgress = false;
|
||||
//monitorQueue.clear();
|
||||
//m_monitorElement = monitorQueue.getFree();
|
||||
m_needToReleaseFirst = false;
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
Status stop() {
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
PVACCESS_REFCOUNT_MONITOR_DEFINE(channelMonitor);
|
||||
|
||||
class ChannelMonitorImpl :
|
||||
@@ -2346,7 +2573,7 @@ namespace epics {
|
||||
protected:
|
||||
ClientContextImpl::weak_pointer _context;
|
||||
public:
|
||||
AbstractClientResponseHandler(ClientContextImpl::shared_pointer const & context, String description) :
|
||||
AbstractClientResponseHandler(ClientContextImpl::shared_pointer const & context, String const & description) :
|
||||
AbstractResponseHandler(context.get(), description), _context(ClientContextImpl::weak_pointer(context)) {
|
||||
}
|
||||
|
||||
@@ -2356,7 +2583,7 @@ namespace epics {
|
||||
|
||||
class NoopResponse : public AbstractClientResponseHandler, private epics::pvData::NoDefaultMethods {
|
||||
public:
|
||||
NoopResponse(ClientContextImpl::shared_pointer const & context, String description) :
|
||||
NoopResponse(ClientContextImpl::shared_pointer const & context, String const & description) :
|
||||
AbstractClientResponseHandler(context, description)
|
||||
{
|
||||
}
|
||||
@@ -2818,7 +3045,7 @@ namespace epics {
|
||||
}
|
||||
|
||||
virtual ChannelFind::shared_pointer channelFind(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester)
|
||||
{
|
||||
// TODO not implemented
|
||||
@@ -2837,7 +3064,7 @@ namespace epics {
|
||||
}
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority)
|
||||
{
|
||||
@@ -2845,10 +3072,10 @@ namespace epics {
|
||||
}
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority,
|
||||
epics::pvData::String /*address*/)
|
||||
epics::pvData::String const & /*address*/)
|
||||
{
|
||||
std::tr1::shared_ptr<ClientContextImpl> context = m_context.lock();
|
||||
if (!context.get())
|
||||
@@ -2985,7 +3212,7 @@ namespace epics {
|
||||
InternalChannelImpl(
|
||||
ClientContextImpl::shared_pointer const & context,
|
||||
pvAccessID channelID,
|
||||
String& name,
|
||||
String const & name,
|
||||
ChannelRequester::shared_pointer const & requester,
|
||||
short priority,
|
||||
auto_ptr<InetAddrVector>& addresses) :
|
||||
@@ -3018,7 +3245,7 @@ namespace epics {
|
||||
|
||||
static ChannelImpl::shared_pointer create(ClientContextImpl::shared_pointer context,
|
||||
pvAccessID channelID,
|
||||
String name,
|
||||
String const & name,
|
||||
ChannelRequester::shared_pointer requester,
|
||||
short priority,
|
||||
auto_ptr<InetAddrVector>& addresses)
|
||||
@@ -3631,7 +3858,7 @@ namespace epics {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String subField)
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String const & subField)
|
||||
{
|
||||
ChannelGetFieldRequestImpl::create(shared_from_this(), requester, subField);
|
||||
}
|
||||
@@ -4001,7 +4228,7 @@ TODO
|
||||
/**
|
||||
* Check channel name.
|
||||
*/
|
||||
void checkChannelName(String& name) {
|
||||
void checkChannelName(String const & name) {
|
||||
if (name.empty())
|
||||
throw std::runtime_error("0 or empty channel name");
|
||||
else if (name.length() > MAX_CHANNEL_NAME_LENGTH)
|
||||
@@ -4196,7 +4423,7 @@ TODO
|
||||
*/
|
||||
// TODO no minor version with the addresses
|
||||
// TODO what if there is an channel with the same name, but on different host!
|
||||
ChannelImpl::shared_pointer createChannelInternal(String name, ChannelRequester::shared_pointer const & requester, short priority,
|
||||
ChannelImpl::shared_pointer createChannelInternal(String const & name, ChannelRequester::shared_pointer const & requester, short priority,
|
||||
auto_ptr<InetAddrVector>& addresses) { // TODO addresses
|
||||
|
||||
checkState();
|
||||
|
||||
@@ -88,13 +88,13 @@ namespace epics {
|
||||
|
||||
|
||||
virtual ChannelSearchManager::shared_pointer getChannelSearchManager() = 0;
|
||||
virtual void checkChannelName(epics::pvData::String& name) = 0;
|
||||
virtual void checkChannelName(epics::pvData::String const & name) = 0;
|
||||
|
||||
virtual void registerChannel(ChannelImpl::shared_pointer const & channel) = 0;
|
||||
virtual void unregisterChannel(ChannelImpl::shared_pointer const & channel) = 0;
|
||||
|
||||
virtual void destroyChannel(ChannelImpl::shared_pointer const & channel, bool force) = 0;
|
||||
virtual ChannelImpl::shared_pointer createChannelInternal(epics::pvData::String name, ChannelRequester::shared_pointer const & requester, short priority, std::auto_ptr<InetAddrVector>& addresses) = 0;
|
||||
virtual ChannelImpl::shared_pointer createChannelInternal(epics::pvData::String const &name, ChannelRequester::shared_pointer const & requester, short priority, std::auto_ptr<InetAddrVector>& addresses) = 0;
|
||||
|
||||
virtual ResponseRequest::shared_pointer getResponseRequest(pvAccessID ioid) = 0;
|
||||
virtual pvAccessID registerResponseRequest(ResponseRequest::shared_pointer const & request) = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@ Properties::Properties()
|
||||
_outfile->exceptions (ofstream::failbit | ofstream::badbit );
|
||||
}
|
||||
|
||||
Properties::Properties(const string fileName)
|
||||
Properties::Properties(const string &fileName)
|
||||
{
|
||||
_fileName = fileName;
|
||||
_infile.reset(new ifstream());
|
||||
@@ -35,7 +35,7 @@ Properties::~Properties()
|
||||
{
|
||||
}
|
||||
|
||||
void Properties::setProperty(const string key,const string value)
|
||||
void Properties::setProperty(const string &key, const string &value)
|
||||
{
|
||||
string oldValue;
|
||||
std::map<std::string,std::string>::iterator propertiesIterator = _properties.find(key);
|
||||
@@ -47,7 +47,7 @@ void Properties::setProperty(const string key,const string value)
|
||||
_properties[key] = value;
|
||||
}
|
||||
|
||||
string Properties::getProperty(const string key)
|
||||
string Properties::getProperty(const string &key)
|
||||
{
|
||||
std::map<std::string,std::string>::iterator propertiesIterator = _properties.find(key);
|
||||
if(propertiesIterator != _properties.end()) //found in map
|
||||
@@ -61,7 +61,7 @@ string Properties::getProperty(const string key)
|
||||
}
|
||||
}
|
||||
|
||||
string Properties::getProperty(const string key, const string defaultValue)
|
||||
string Properties::getProperty(const string &key, const string &defaultValue)
|
||||
{
|
||||
std::map<std::string,std::string>::iterator propertiesIterator = _properties.find(key);
|
||||
if(propertiesIterator != _properties.end()) //found in map
|
||||
@@ -138,7 +138,7 @@ void Properties::load()
|
||||
_infile->close();
|
||||
}
|
||||
|
||||
void Properties::load(const string fileName)
|
||||
void Properties::load(const string &fileName)
|
||||
{
|
||||
_fileName = fileName;
|
||||
load();
|
||||
@@ -174,7 +174,7 @@ void Properties::store()
|
||||
_outfile->close();
|
||||
}
|
||||
|
||||
void Properties::store(const string fileName)
|
||||
void Properties::store(const string &fileName)
|
||||
{
|
||||
_fileName = fileName;
|
||||
store();
|
||||
@@ -205,7 +205,7 @@ SystemConfigurationImpl::~SystemConfigurationImpl()
|
||||
if(_envParam.name) delete[] _envParam.name;
|
||||
}
|
||||
|
||||
bool SystemConfigurationImpl::getPropertyAsBoolean(const string name, const bool defaultValue)
|
||||
bool SystemConfigurationImpl::getPropertyAsBoolean(const string &name, const bool defaultValue)
|
||||
{
|
||||
bool retval;
|
||||
_ibuffer.clear();
|
||||
@@ -220,7 +220,7 @@ bool SystemConfigurationImpl::getPropertyAsBoolean(const string name, const bool
|
||||
return retval;
|
||||
}
|
||||
|
||||
int32 SystemConfigurationImpl::getPropertyAsInteger(const string name, const int32 defaultValue)
|
||||
int32 SystemConfigurationImpl::getPropertyAsInteger(const string &name, const int32 defaultValue)
|
||||
{
|
||||
int32 retval;
|
||||
_ibuffer.clear();
|
||||
@@ -235,7 +235,7 @@ int32 SystemConfigurationImpl::getPropertyAsInteger(const string name, const int
|
||||
return retval;
|
||||
}
|
||||
|
||||
float SystemConfigurationImpl::getPropertyAsFloat(const string name, const float defaultValue)
|
||||
float SystemConfigurationImpl::getPropertyAsFloat(const string &name, const float defaultValue)
|
||||
{
|
||||
float retval;
|
||||
_ibuffer.clear();
|
||||
@@ -250,7 +250,7 @@ float SystemConfigurationImpl::getPropertyAsFloat(const string name, const float
|
||||
return retval;
|
||||
}
|
||||
|
||||
float SystemConfigurationImpl::getPropertyAsDouble(const string name, const double defaultValue)
|
||||
float SystemConfigurationImpl::getPropertyAsDouble(const string &name, const double defaultValue)
|
||||
{
|
||||
float retval;
|
||||
_ibuffer.clear();
|
||||
@@ -265,7 +265,7 @@ float SystemConfigurationImpl::getPropertyAsDouble(const string name, const doub
|
||||
return retval;
|
||||
}
|
||||
|
||||
string SystemConfigurationImpl::getPropertyAsString(const string name, const string defaultValue)
|
||||
string SystemConfigurationImpl::getPropertyAsString(const string &name, const string &defaultValue)
|
||||
{
|
||||
strncpy(_envParam.name,name.c_str(),name.length() + 1);
|
||||
const char* val = envGetConfigParamPtr(&_envParam);
|
||||
@@ -285,7 +285,7 @@ ConfigurationProviderImpl::~ConfigurationProviderImpl()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigurationProviderImpl::registerConfiguration(const string name, Configuration::shared_pointer const & configuration)
|
||||
void ConfigurationProviderImpl::registerConfiguration(const string &name, Configuration::shared_pointer const & configuration)
|
||||
{
|
||||
Lock guard(_mutex);
|
||||
std::map<std::string,Configuration::shared_pointer>::iterator configsIter = _configs.find(name);
|
||||
@@ -297,7 +297,7 @@ void ConfigurationProviderImpl::registerConfiguration(const string name, Configu
|
||||
_configs[name] = configuration;
|
||||
}
|
||||
|
||||
Configuration::shared_pointer ConfigurationProviderImpl::getConfiguration(const string name)
|
||||
Configuration::shared_pointer ConfigurationProviderImpl::getConfiguration(const string &name)
|
||||
{
|
||||
std::map<std::string,Configuration::shared_pointer>::iterator configsIter = _configs.find(name);
|
||||
if(configsIter != _configs.end())
|
||||
|
||||
@@ -28,17 +28,17 @@ class Properties
|
||||
{
|
||||
public:
|
||||
Properties();
|
||||
Properties(const std::string fileName);
|
||||
Properties(const std::string &fileName);
|
||||
virtual ~Properties();
|
||||
|
||||
void setProperty(const std::string key,const std::string value);
|
||||
std::string getProperty(const std::string key);
|
||||
std::string getProperty(const std::string key, const std::string defaultValue);
|
||||
void setProperty(const std::string &key,const std::string &value);
|
||||
std::string getProperty(const std::string &key);
|
||||
std::string getProperty(const std::string &key, const std::string &defaultValue);
|
||||
|
||||
void store();
|
||||
void store(const std::string fileName);
|
||||
void store(const std::string &fileName);
|
||||
void load();
|
||||
void load(const std::string fileName);
|
||||
void load(const std::string &fileName);
|
||||
void list();
|
||||
|
||||
private:
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
*
|
||||
* @return environment variable value as bool or default value if it does not exist.
|
||||
*/
|
||||
virtual bool getPropertyAsBoolean(const std::string name, const bool defaultValue) = 0;
|
||||
virtual bool getPropertyAsBoolean(const std::string &name, const bool defaultValue) = 0;
|
||||
/**
|
||||
* Get the environment variable specified by name or return default value
|
||||
* if it does not exist.
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
*
|
||||
* @return environment variable value as int32 or default value if it does not exist.
|
||||
*/
|
||||
virtual epics::pvData::int32 getPropertyAsInteger(const std::string name, const epics::pvData::int32 defaultValue) = 0;
|
||||
virtual epics::pvData::int32 getPropertyAsInteger(const std::string &name, const epics::pvData::int32 defaultValue) = 0;
|
||||
/**
|
||||
* Get the environment variable specified by name or return default value
|
||||
* if it does not exist.
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
*
|
||||
* @return environment variable value as float or default value if it does not exist.
|
||||
*/
|
||||
virtual float getPropertyAsFloat(const std::string name, const float defaultValue) = 0;
|
||||
virtual float getPropertyAsFloat(const std::string &name, const float defaultValue) = 0;
|
||||
/**
|
||||
* Get the environment variable specified by name or return default value
|
||||
* if it does not exist.
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
*
|
||||
* @return environment variable value as double or default value if it does not exist.
|
||||
*/
|
||||
virtual float getPropertyAsDouble(const std::string name, const double defaultValue) = 0;
|
||||
virtual float getPropertyAsDouble(const std::string &name, const double defaultValue) = 0;
|
||||
/**
|
||||
* Get the environment variable specified by name or return default value
|
||||
* if it does not exist.
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
*
|
||||
* @return environment variable value as std::string or default value if it does not exist.
|
||||
*/
|
||||
virtual std::string getPropertyAsString(const std::string name, const std::string defaultValue) = 0;
|
||||
virtual std::string getPropertyAsString(const std::string &name, const std::string &defaultValue) = 0;
|
||||
};
|
||||
|
||||
class SystemConfigurationImpl: public Configuration
|
||||
@@ -131,11 +131,11 @@ class SystemConfigurationImpl: public Configuration
|
||||
public:
|
||||
SystemConfigurationImpl();
|
||||
~SystemConfigurationImpl();
|
||||
bool getPropertyAsBoolean(const std::string name, const bool defaultValue);
|
||||
epics::pvData::int32 getPropertyAsInteger(const std::string name, const epics::pvData::int32 defaultValue);
|
||||
float getPropertyAsFloat(const std::string name, const float defaultValue);
|
||||
float getPropertyAsDouble(const std::string name, const double defaultValue);
|
||||
std::string getPropertyAsString(const std::string name, std::string defaultValue);
|
||||
bool getPropertyAsBoolean(const std::string &name, const bool defaultValue);
|
||||
epics::pvData::int32 getPropertyAsInteger(const std::string &name, const epics::pvData::int32 defaultValue);
|
||||
float getPropertyAsFloat(const std::string &name, const float defaultValue);
|
||||
float getPropertyAsDouble(const std::string &name, const double defaultValue);
|
||||
std::string getPropertyAsString(const std::string &name, const std::string &defaultValue);
|
||||
std::auto_ptr<Properties> _properties;
|
||||
private:
|
||||
ENV_PARAM _envParam;
|
||||
@@ -162,14 +162,14 @@ public:
|
||||
*
|
||||
* @return configuration specified by name or NULL if it does not exists.
|
||||
*/
|
||||
virtual Configuration::shared_pointer getConfiguration(const std::string name) = 0;
|
||||
virtual Configuration::shared_pointer getConfiguration(const std::string &name) = 0;
|
||||
/**
|
||||
* Register configuration.
|
||||
*
|
||||
* @param name name of the configuration to register.
|
||||
* @param configuration configuration to register.
|
||||
*/
|
||||
virtual void registerConfiguration(const std::string name, Configuration::shared_pointer const & configuration) = 0;
|
||||
virtual void registerConfiguration(const std::string &name, Configuration::shared_pointer const & configuration) = 0;
|
||||
};
|
||||
|
||||
class ConfigurationProviderImpl: public ConfigurationProvider
|
||||
@@ -180,8 +180,8 @@ public:
|
||||
* Destructor. Note: Registered configurations will be deleted!!
|
||||
*/
|
||||
~ConfigurationProviderImpl();
|
||||
Configuration::shared_pointer getConfiguration(const std::string name);
|
||||
void registerConfiguration(const std::string name, Configuration::shared_pointer const & configuration);
|
||||
Configuration::shared_pointer getConfiguration(const std::string &name);
|
||||
void registerConfiguration(const std::string &name, Configuration::shared_pointer const & configuration);
|
||||
private:
|
||||
epics::pvData::Mutex _mutex;
|
||||
std::map<std::string,Configuration::shared_pointer> _configs;
|
||||
|
||||
@@ -45,15 +45,15 @@ char toAscii(int8 b) {
|
||||
return '.';
|
||||
}
|
||||
|
||||
void hexDump(const String name, const int8 *bs, int len) {
|
||||
void hexDump(String const & name, const int8 *bs, int len) {
|
||||
hexDump(name, bs, 0, len);
|
||||
}
|
||||
|
||||
void hexDump(const String name, const int8 *bs, int start, int len) {
|
||||
void hexDump(String const & name, const int8 *bs, int start, int len) {
|
||||
hexDump("", name, bs, start, len);
|
||||
}
|
||||
|
||||
void hexDump(const String prologue, const String name, const int8 *bs,
|
||||
void hexDump(String const & prologue, String const & name, const int8 *bs,
|
||||
int start, int len) {
|
||||
|
||||
stringstream header;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace pvAccess {
|
||||
* @param bs buffer to dump
|
||||
* @param len first bytes (length) to dump.
|
||||
*/
|
||||
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int len);
|
||||
void hexDump(epics::pvData::String const & name, const epics::pvData::int8 *bs, int len);
|
||||
|
||||
/**
|
||||
* Output a buffer in hex format.
|
||||
@@ -27,7 +27,7 @@ namespace pvAccess {
|
||||
* @param[in] start dump message using given offset.
|
||||
* @param[in] len first bytes (length) to dump.
|
||||
*/
|
||||
void hexDump(const epics::pvData::String name, const epics::pvData::int8 *bs, int start, int len);
|
||||
void hexDump(epics::pvData::String const & name, const epics::pvData::int8 *bs, int start, int len);
|
||||
|
||||
/**
|
||||
* Output a buffer in hex format.
|
||||
@@ -37,7 +37,7 @@ namespace pvAccess {
|
||||
* @param[in] start dump message using given offset.
|
||||
* @param[in] len first bytes (length) to dump.
|
||||
*/
|
||||
void hexDump(const epics::pvData::String prologue, const epics::pvData::String name,
|
||||
void hexDump(epics::pvData::String const & prologue, epics::pvData::String const & name,
|
||||
const epics::pvData::int8 *bs, int start, int len);
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace epics {
|
||||
|
||||
class FileLogger : public NoDefaultMethods {
|
||||
public:
|
||||
FileLogger(String name) {
|
||||
FileLogger(String const & name) {
|
||||
logFile.open(name.data(), ios::app);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace epics {
|
||||
delete fileLogger;
|
||||
}
|
||||
|
||||
void createFileLogger(String fname) {
|
||||
void createFileLogger(String const & fname) {
|
||||
static Mutex mutex;
|
||||
Lock xx(mutex);
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace pvAccess {
|
||||
* @param[in] fname The file to write to. If the file exists, it
|
||||
* is opened for append.
|
||||
*/
|
||||
void createFileLogger( epics::pvData::String fname );
|
||||
void createFileLogger( epics::pvData::String const & fname );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ private:
|
||||
void initializeUDPTransport() { }
|
||||
void internalDestroy() { }
|
||||
void destroyAllChannels() { }
|
||||
void checkChannelName(String& name) {}
|
||||
void checkChannelName(String const & name) {}
|
||||
void checkState() { }
|
||||
pvAccessID generateCID()
|
||||
{
|
||||
|
||||
@@ -877,7 +877,7 @@ class MockChannel : public Channel {
|
||||
return readWrite;
|
||||
}
|
||||
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String subField)
|
||||
virtual void getField(GetFieldRequester::shared_pointer const & requester,epics::pvData::String const & subField)
|
||||
{
|
||||
PVFieldPtr pvField;
|
||||
if(subField == "")
|
||||
@@ -1032,7 +1032,7 @@ class MockServerChannelProvider : public ChannelProvider,
|
||||
}
|
||||
|
||||
virtual ChannelFind::shared_pointer channelFind(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester)
|
||||
{
|
||||
// channel always exists
|
||||
@@ -1041,7 +1041,7 @@ class MockServerChannelProvider : public ChannelProvider,
|
||||
}
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority)
|
||||
{
|
||||
@@ -1049,10 +1049,10 @@ class MockServerChannelProvider : public ChannelProvider,
|
||||
}
|
||||
|
||||
virtual Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority,
|
||||
epics::pvData::String address)
|
||||
epics::pvData::String const & address)
|
||||
{
|
||||
if (address == "local")
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
epics::pvData::String getProviderName() { return "local"; };
|
||||
|
||||
|
||||
ChannelFind::shared_pointer channelFind(epics::pvData::String channelName,
|
||||
ChannelFind::shared_pointer channelFind(epics::pvData::String const & channelName,
|
||||
ChannelFindRequester::shared_pointer const & channelFindRequester)
|
||||
{
|
||||
ChannelFind::shared_pointer nullCF;
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
|
||||
Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority = PRIORITY_DEFAULT)
|
||||
{
|
||||
@@ -33,9 +33,9 @@ public:
|
||||
}
|
||||
|
||||
Channel::shared_pointer createChannel(
|
||||
epics::pvData::String channelName,
|
||||
epics::pvData::String const & channelName,
|
||||
ChannelRequester::shared_pointer const & channelRequester,
|
||||
short priority, epics::pvData::String address)
|
||||
short priority, epics::pvData::String const & address)
|
||||
{
|
||||
Channel::shared_pointer nullC;
|
||||
channelRequester->channelCreated(Status::OK, nullC);
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
virtual ~TestChannelAccess() {};
|
||||
|
||||
ChannelProvider::shared_pointer getProvider(epics::pvData::String providerName)
|
||||
ChannelProvider::shared_pointer getProvider(epics::pvData::String const & providerName)
|
||||
{
|
||||
if (providerName == "local")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user