String -> std::string, toString methods removed

This commit is contained in:
Matej Sekoranja
2014-06-19 14:30:40 +02:00
parent 61edf17cdf
commit c39b966121
37 changed files with 284 additions and 308 deletions

View File

@ -26,7 +26,7 @@ using std::endl;
using std::ostringstream; using std::ostringstream;
ArrayPerformancePtr ArrayPerformance::create( ArrayPerformancePtr ArrayPerformance::create(
epics::pvData::String const & recordName, std::string const & recordName,
size_t size, size_t size,
double delay) double delay)
{ {
@ -39,7 +39,7 @@ ArrayPerformancePtr ArrayPerformance::create(
} }
ArrayPerformance::ArrayPerformance( ArrayPerformance::ArrayPerformance(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure, epics::pvData::PVStructurePtr const & pvStructure,
size_t size, size_t size,
double delay) double delay)

View File

@ -44,7 +44,7 @@ class epicsShareClass ArrayPerformance :
public: public:
POINTER_DEFINITIONS(ArrayPerformance); POINTER_DEFINITIONS(ArrayPerformance);
static ArrayPerformancePtr create( static ArrayPerformancePtr create(
epics::pvData::String const & recordName, std::string const & recordName,
size_t size, size_t size,
double delay); double delay);
virtual ~ArrayPerformance(); virtual ~ArrayPerformance();
@ -53,7 +53,7 @@ public:
virtual void process(); virtual void process();
virtual void destroy(); virtual void destroy();
private: private:
ArrayPerformance(epics::pvData::String const & recordName, ArrayPerformance(std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure, epics::pvData::PVStructurePtr const & pvStructure,
size_t size, size_t size,
double delay); double delay);
@ -81,7 +81,7 @@ private:
ArrayPerformancePtr arrayPerformance; ArrayPerformancePtr arrayPerformance;
bool isDestroyed; bool isDestroyed;
bool runReturned; bool runReturned;
epics::pvData::String threadName; std::string threadName;
epics::pvData::Mutex mutex; epics::pvData::Mutex mutex;
epics::pvData::int64 value; epics::pvData::int64 value;
std::auto_ptr<epicsThread> thread; std::auto_ptr<epicsThread> thread;

View File

@ -39,15 +39,15 @@ using namespace epics::pvDatabase;
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
bool result(false); bool result(false);
String recordName; string recordName;
recordName = "arrayPerformance"; recordName = "arrayPerformance";
size_t size = 10000000; size_t size = 10000000;
double delay = .0001; double delay = .0001;
String providerName("local"); string providerName("local");
size_t nMonitor = 1; size_t nMonitor = 1;
int queueSize = 2; int queueSize = 2;
double waitTime = 0.0; double waitTime = 0.0;
if(argc==2 && String(argv[1])==String("-help")) { if(argc==2 && string(argv[1])==string("-help")) {
cout << "arrayPerformanceMain recordName size"; cout << "arrayPerformanceMain recordName size";
cout << " delay providerName nMonitor queueSize waitTime" << endl; cout << " delay providerName nMonitor queueSize waitTime" << endl;
cout << "default" << endl; cout << "default" << endl;

View File

@ -24,9 +24,10 @@ using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::ostringstream; using std::ostringstream;
using std::string;
static String requesterName("longArrayGet"); static string requesterName("longArrayGet");
static String request("value,timeStamp,alarm"); static string request("value,timeStamp,alarm");
static epics::pvData::Mutex printMutex; static epics::pvData::Mutex printMutex;
class LongArrayChannelRequester; class LongArrayChannelRequester;
@ -52,8 +53,8 @@ public:
isDestroyed = true; isDestroyed = true;
longArrayChannelGet.reset(); longArrayChannelGet.reset();
} }
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message, MessageType messageType) virtual void message(string const & message, MessageType messageType)
{ {
Lock guard(printMutex); Lock guard(printMutex);
cout << requesterName << " message " << message << endl; cout << requesterName << " message " << message << endl;
@ -93,8 +94,8 @@ public:
isDestroyed = true; isDestroyed = true;
longArrayChannelGet.reset(); longArrayChannelGet.reset();
} }
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message, MessageType messageType) virtual void message(string const & message, MessageType messageType)
{ {
Lock guard(printMutex); Lock guard(printMutex);
cout << requesterName << " message " << message << endl; cout << requesterName << " message " << message << endl;
@ -126,8 +127,8 @@ class LongArrayChannelGet :
{ {
public: public:
LongArrayChannelGet( LongArrayChannelGet(
String providerName, string providerName,
String channelName, string channelName,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelGet, int iterBetweenCreateChannelGet,
double delayTime) double delayTime)
@ -144,7 +145,7 @@ public:
bool init(); bool init();
virtual void destroy(); virtual void destroy();
virtual void run(); virtual void run();
void message(String const & message, MessageType messageType) void message(string const & message, MessageType messageType)
{ {
Lock guard(printMutex); Lock guard(printMutex);
cout << requesterName << " message " << message << endl; cout << requesterName << " message " << message << endl;
@ -170,14 +171,14 @@ private:
return shared_from_this(); return shared_from_this();
} }
size_t checkResult(); size_t checkResult();
String providerName; string providerName;
String channelName; string channelName;
int iterBetweenCreateChannel; int iterBetweenCreateChannel;
int iterBetweenCreateChannelGet; int iterBetweenCreateChannelGet;
double delayTime; double delayTime;
bool isDestroyed; bool isDestroyed;
bool runReturned; bool runReturned;
epics::pvData::String threadName; std::string threadName;
Status status; Status status;
Event event; Event event;
Mutex mutex; Mutex mutex;
@ -203,7 +204,7 @@ void LongArrayChannelRequester::channelStateChange(
Channel::shared_pointer const & channel, Channel::shared_pointer const & channel,
Channel::ConnectionState connectionState) Channel::ConnectionState connectionState)
{ {
String mess(Channel::ConnectionStateNames[connectionState]); string mess(Channel::ConnectionStateNames[connectionState]);
message(mess,infoMessage); message(mess,infoMessage);
Lock guard(mutex); Lock guard(mutex);
if(isDestroyed) return; if(isDestroyed) return;
@ -279,7 +280,7 @@ void LongArrayChannelGet::channelGetConnect(
} }
} }
if(!structureOK) { if(!structureOK) {
String mess("channelGetConnect: illegal structure"); string mess("channelGetConnect: illegal structure");
message(mess,errorMessage); message(mess,errorMessage);
this->status = Status(Status::STATUSTYPE_ERROR,mess); this->status = Status(Status::STATUSTYPE_ERROR,mess);
} }
@ -487,8 +488,8 @@ size_t LongArrayChannelGet::checkResult()
LongArrayGetPtr LongArrayGet::create( LongArrayGetPtr LongArrayGet::create(
String const &providerName, string const &providerName,
String const & channelName, string const & channelName,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelGet, int iterBetweenCreateChannelGet,
double delayTime) double delayTime)
@ -505,8 +506,8 @@ LongArrayGetPtr LongArrayGet::create(
} }
LongArrayGet::LongArrayGet( LongArrayGet::LongArrayGet(
String const &providerName, string const &providerName,
String const & channelName, string const & channelName,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelGet, int iterBetweenCreateChannelGet,
double delayTime) double delayTime)

View File

@ -49,8 +49,8 @@ class epicsShareClass LongArrayGet :
public: public:
POINTER_DEFINITIONS(LongArrayGet); POINTER_DEFINITIONS(LongArrayGet);
static LongArrayGetPtr create( static LongArrayGetPtr create(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
int iterBetweenCreateChannel = 0, int iterBetweenCreateChannel = 0,
int iterBetweenCreateChannelGet = 0, int iterBetweenCreateChannelGet = 0,
double delayTime = 0.0); double delayTime = 0.0);
@ -62,15 +62,15 @@ private:
return shared_from_this(); return shared_from_this();
} }
LongArrayGet( LongArrayGet(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
int iterBetweenCreateChannel = 0, int iterBetweenCreateChannel = 0,
int iterBetweenCreateChannelGet = 0, int iterBetweenCreateChannelGet = 0,
double delayTime = 0.0); double delayTime = 0.0);
bool init(); bool init();
epics::pvData::String providerName; std::string providerName;
epics::pvData::String channelName; std::string channelName;
int iterBetweenCreateChannel; int iterBetweenCreateChannel;
int iterBetweenCreateChannelGet; int iterBetweenCreateChannelGet;
double delayTime; double delayTime;

View File

@ -38,11 +38,11 @@ using namespace epics::pvDatabase;
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
String channelName("arrayPerformance"); string channelName("arrayPerformance");
int iterBetweenCreateChannel = 0; int iterBetweenCreateChannel = 0;
int iterBetweenCreateChannelGet = 0; int iterBetweenCreateChannelGet = 0;
double delayTime = 1.0; double delayTime = 1.0;
if(argc==2 && String(argv[1])==String("-help")) { if(argc==2 && string(argv[1])==string("-help")) {
cout << "longArrayGetMain channelName "; cout << "longArrayGetMain channelName ";
cout << "iterBetweenCreateChannel iterBetweenCreateChannelGet delayTime" << endl; cout << "iterBetweenCreateChannel iterBetweenCreateChannelGet delayTime" << endl;
cout << "default" << endl; cout << "default" << endl;

View File

@ -25,11 +25,12 @@ using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
using std::ostringstream; using std::ostringstream;
static String requesterName("longArrayMonitor"); static string requesterName("longArrayMonitor");
static void messagePvt(String const & message, MessageType messageType) static void messagePvt(string const & message, MessageType messageType)
{ {
cout << requesterName << " message " << message << endl; cout << requesterName << " message " << message << endl;
} }
@ -43,8 +44,8 @@ public:
{} {}
virtual ~LAMChannelRequester(){} virtual ~LAMChannelRequester(){}
virtual void destroy(){longArrayMonitor.reset();} virtual void destroy(){longArrayMonitor.reset();}
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message, MessageType messageType) virtual void message(string const & message, MessageType messageType)
{ messagePvt(message,messageType);} { messagePvt(message,messageType);}
virtual void channelCreated(const Status& status, Channel::shared_pointer const & channel); virtual void channelCreated(const Status& status, Channel::shared_pointer const & channel);
virtual void channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState); virtual void channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState);
@ -83,8 +84,8 @@ public:
void init(); void init();
virtual void destroy(); virtual void destroy();
virtual void run(); virtual void run();
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message, MessageType messageType) virtual void message(string const & message, MessageType messageType)
{ messagePvt(message,messageType);} { messagePvt(message,messageType);}
virtual void monitorConnect(Status const & status, virtual void monitorConnect(Status const & status,
MonitorPtr const & monitor, StructureConstPtr const & structure); MonitorPtr const & monitor, StructureConstPtr const & structure);
@ -95,7 +96,7 @@ private:
double waitTime; double waitTime;
bool isDestroyed; bool isDestroyed;
bool runReturned; bool runReturned;
epics::pvData::String threadName; std::string threadName;
Event event; Event event;
Mutex mutex; Mutex mutex;
std::auto_ptr<epicsThread> thread; std::auto_ptr<epicsThread> thread;
@ -150,7 +151,7 @@ void LAMMonitorRequester::monitorConnect(Status const & status,
} }
} }
if(!structureOK) { if(!structureOK) {
String message("monitorConnect: illegal structure"); string message("monitorConnect: illegal structure");
messagePvt(message,errorMessage); messagePvt(message,errorMessage);
longArrayMonitor->status = Status(Status::STATUSTYPE_ERROR,message); longArrayMonitor->status = Status(Status::STATUSTYPE_ERROR,message);
} }
@ -200,12 +201,8 @@ void LAMMonitorRequester::run()
out << "first " << first << " last " << last ; out << "first " << first << " last " << last ;
BitSetPtr changed = monitorElement->changedBitSet; BitSetPtr changed = monitorElement->changedBitSet;
BitSetPtr overrun = monitorElement->overrunBitSet; BitSetPtr overrun = monitorElement->overrunBitSet;
String buffer; out << " changed " << *changed;
changed->toString(&buffer); out << " overrun " << *overrun;
out << " changed " << buffer;
buffer.clear();
overrun->toString(&buffer);
out << " overrun " << buffer;
double elementsPerSec = nElements; double elementsPerSec = nElements;
elementsPerSec /= diff; elementsPerSec /= diff;
if(elementsPerSec>10.0e9) { if(elementsPerSec>10.0e9) {
@ -246,8 +243,8 @@ void LAMMonitorRequester::unlisten(MonitorPtr const & monitor)
LongArrayMonitorPtr LongArrayMonitor::create( LongArrayMonitorPtr LongArrayMonitor::create(
String const &providerName, string const &providerName,
String const & channelName, string const & channelName,
int queueSize, int queueSize,
double waitTime) double waitTime)
{ {
@ -261,8 +258,8 @@ LongArrayMonitor::LongArrayMonitor() {}
LongArrayMonitor::~LongArrayMonitor() {} LongArrayMonitor::~LongArrayMonitor() {}
bool LongArrayMonitor::init( bool LongArrayMonitor::init(
String const &providerName, string const &providerName,
String const &channelName, string const &channelName,
int queueSize, int queueSize,
double waitTime) double waitTime)
{ {
@ -278,7 +275,7 @@ bool LongArrayMonitor::init(
channel = channelProvider->createChannel(channelName,channelRequester,0); channel = channelProvider->createChannel(channelName,channelRequester,0);
event.wait(); event.wait();
if(!status.isOK()) return false; if(!status.isOK()) return false;
String request("record[queueSize="); string request("record[queueSize=");
char buff[20]; char buff[20];
sprintf(buff,"%d",queueSize); sprintf(buff,"%d",queueSize);
request += buff; request += buff;

View File

@ -49,8 +49,8 @@ class epicsShareClass LongArrayMonitor :
public: public:
POINTER_DEFINITIONS(LongArrayMonitor); POINTER_DEFINITIONS(LongArrayMonitor);
static LongArrayMonitorPtr create( static LongArrayMonitorPtr create(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
int queueSize = 1, int queueSize = 1,
double waitTime = 0.0); double waitTime = 0.0);
~LongArrayMonitor(); ~LongArrayMonitor();
@ -60,8 +60,8 @@ public:
private: private:
static epics::pvData::Mutex printMutex; static epics::pvData::Mutex printMutex;
bool init( bool init(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
int queueSize, int queueSize,
double waitTime); double waitTime);
LongArrayMonitorPtr getPtrSelf() LongArrayMonitorPtr getPtrSelf()

View File

@ -38,10 +38,10 @@ using namespace epics::pvDatabase;
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
String channelName("arrayPerformance"); string channelName("arrayPerformance");
int queueSize = 2; int queueSize = 2;
double waitTime = 0.0; double waitTime = 0.0;
if(argc==2 && String(argv[1])==String("-help")) { if(argc==2 && string(argv[1])==string("-help")) {
cout << "longArrayMonitorMain channelName queueSize waitTime" << endl; cout << "longArrayMonitorMain channelName queueSize waitTime" << endl;
cout << "default" << endl; cout << "default" << endl;
cout << "longArrayMonitorMain " << channelName << " "; cout << "longArrayMonitorMain " << channelName << " ";

View File

@ -24,9 +24,10 @@ using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::ostringstream; using std::ostringstream;
using std::string;
static String requesterName("longArrayPut"); static string requesterName("longArrayPut");
static String request("value"); static string request("value");
static epics::pvData::Mutex printMutex; static epics::pvData::Mutex printMutex;
class LongArrayChannelPut : class LongArrayChannelPut :
@ -37,8 +38,8 @@ class LongArrayChannelPut :
{ {
public: public:
LongArrayChannelPut( LongArrayChannelPut(
String providerName, string providerName,
String channelName, string channelName,
size_t arraySize, size_t arraySize,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelPut, int iterBetweenCreateChannelPut,
@ -57,8 +58,8 @@ public:
bool init(); bool init();
virtual void destroy(); virtual void destroy();
virtual void run(); virtual void run();
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message, MessageType messageType) virtual void message(string const & message, MessageType messageType)
{ {
Lock guard(printMutex); Lock guard(printMutex);
cout << requesterName << " message " << message << endl; cout << requesterName << " message " << message << endl;
@ -86,15 +87,15 @@ private:
{ {
return shared_from_this(); return shared_from_this();
} }
String providerName; string providerName;
String channelName; string channelName;
size_t arraySize; size_t arraySize;
int iterBetweenCreateChannel; int iterBetweenCreateChannel;
int iterBetweenCreateChannelPut; int iterBetweenCreateChannelPut;
double delayTime; double delayTime;
bool isDestroyed; bool isDestroyed;
bool runReturned; bool runReturned;
epics::pvData::String threadName; std::string threadName;
Status status; Status status;
Event event; Event event;
Mutex mutex; Mutex mutex;
@ -198,7 +199,7 @@ void LongArrayChannelPut::channelPutConnect(
} }
} }
if(!structureOK) { if(!structureOK) {
String mess("channelPutConnect: illegal structure"); string mess("channelPutConnect: illegal structure");
message(mess,errorMessage); message(mess,errorMessage);
this->status = Status(Status::STATUSTYPE_ERROR,mess); this->status = Status(Status::STATUSTYPE_ERROR,mess);
} }
@ -323,8 +324,8 @@ void LongArrayChannelPut::putDone(
LongArrayPutPtr LongArrayPut::create( LongArrayPutPtr LongArrayPut::create(
String const &providerName, string const &providerName,
String const & channelName, string const & channelName,
size_t arraySize, size_t arraySize,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelPut, int iterBetweenCreateChannelPut,
@ -343,8 +344,8 @@ LongArrayPutPtr LongArrayPut::create(
} }
LongArrayPut::LongArrayPut( LongArrayPut::LongArrayPut(
String const &providerName, string const &providerName,
String const & channelName, string const & channelName,
size_t arraySize, size_t arraySize,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelPut, int iterBetweenCreateChannelPut,

View File

@ -48,8 +48,8 @@ class epicsShareClass LongArrayPut :
public: public:
POINTER_DEFINITIONS(LongArrayPut); POINTER_DEFINITIONS(LongArrayPut);
static LongArrayPutPtr create( static LongArrayPutPtr create(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
size_t arraySize = 100, size_t arraySize = 100,
int iterBetweenCreateChannel = 0, int iterBetweenCreateChannel = 0,
int iterBetweenCreateChannelPut = 0, int iterBetweenCreateChannelPut = 0,
@ -62,16 +62,16 @@ private:
return shared_from_this(); return shared_from_this();
} }
LongArrayPut( LongArrayPut(
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName, std::string const & channelName,
size_t arraySize, size_t arraySize,
int iterBetweenCreateChannel, int iterBetweenCreateChannel,
int iterBetweenCreateChannelPut, int iterBetweenCreateChannelPut,
double delayTime); double delayTime);
bool init(); bool init();
epics::pvData::String providerName; std::string providerName;
epics::pvData::String channelName; std::string channelName;
size_t arraySize; size_t arraySize;
int iterBetweenCreateChannel; int iterBetweenCreateChannel;
int iterBetweenCreateChannelPut; int iterBetweenCreateChannelPut;

View File

@ -38,12 +38,12 @@ using namespace epics::pvDatabase;
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
String channelName("arrayPerformance"); string channelName("arrayPerformance");
size_t arraySize = 10; size_t arraySize = 10;
int iterBetweenCreateChannel = 0; int iterBetweenCreateChannel = 0;
int iterBetweenCreateChannelPut = 0; int iterBetweenCreateChannelPut = 0;
double delayTime = 1.0; double delayTime = 1.0;
if(argc==2 && String(argv[1])==String("-help")) { if(argc==2 && string(argv[1])==string("-help")) {
cout << "longArrayPutMain channelName arraySize "; cout << "longArrayPutMain channelName arraySize ";
cout << "iterBetweenCreateChannel iterBetweenCreateChannelPut delayTime" << endl; cout << "iterBetweenCreateChannel iterBetweenCreateChannelPut delayTime" << endl;
cout << "default" << endl; cout << "default" << endl;

View File

@ -140,7 +140,7 @@ int main(int argc,char *argv[])
size_t size = 50000000; size_t size = 50000000;
double delay = .01; double delay = .01;
size_t nThread = 1; size_t nThread = 1;
if(argc==2 && String(argv[1])==String("-help")) { if(argc==2 && string(argv[1])==string("-help")) {
cout << "vectorPerformanceMain size delay nThread" << endl; cout << "vectorPerformanceMain size delay nThread" << endl;
cout << "default" << endl; cout << "default" << endl;
cout << "vectorPerformance "; cout << "vectorPerformance ";

View File

@ -575,10 +575,10 @@ public:
virtual void destroy(); virtual void destroy();
static PVRecordPtr create( static PVRecordPtr create(
epics::pvData::String const &amp; recordName, std::string const &amp; recordName,
epics::pvData::PVStructurePtr const &amp; pvStructure); epics::pvData::PVStructurePtr const &amp; pvStructure);
virtual ~PVRecord(); virtual ~PVRecord();
epics::pvData::String getRecordName(); std::string getRecordName();
PVRecordStructurePtr getPVRecordStructure(); PVRecordStructurePtr getPVRecordStructure();
PVRecordFieldPtr findPVRecordField( PVRecordFieldPtr findPVRecordField(
epics::pvData::PVFieldPtr const &amp; pvField); epics::pvData::PVFieldPtr const &amp; pvField);
@ -596,13 +596,13 @@ public:
bool removeListener(PVListenerPtr const &amp; pvListener); bool removeListener(PVListenerPtr const &amp; pvListener);
void beginGroupPut(); void beginGroupPut();
void endGroupPut(); void endGroupPut();
epics::pvData::String getRequesterName() {return getRecordName();} std::string getRequesterName() {return getRecordName();}
virtual void message( virtual void message(
epics::pvData::String const &amp; message, std::string const &amp; message,
epics::pvData::MessageType messageType); epics::pvData::MessageType messageType);
void message( void message(
PVRecordFieldPtr const &amp; pvRecordField, PVRecordFieldPtr const &amp; pvRecordField,
epics::pvData::String const &amp; message, std::string const &amp; message,
epics::pvData::MessageType messageType); epics::pvData::MessageType messageType);
void toString(epics::pvData::StringBuilder buf); void toString(epics::pvData::StringBuilder buf);
void toString(epics::pvData::StringBuilder buf,int indentLevel); void toString(epics::pvData::StringBuilder buf,int indentLevel);
@ -610,7 +610,7 @@ public:
void setTraceLevel(int level); void setTraceLevel(int level);
protected: protected:
PVRecord( PVRecord(
epics::pvData::String const &amp; recordName, std::string const &amp; recordName,
epics::pvData::PVStructurePtr const &amp; pvStructure); epics::pvData::PVStructurePtr const &amp; pvStructure);
void initPVRecord(); void initPVRecord();
epics::pvData::PVStructurePtr getPVStructure(); epics::pvData::PVStructurePtr getPVStructure();
@ -742,14 +742,14 @@ public:
virtual void destroy(); virtual void destroy();
PVRecordStructurePtr getParent(); PVRecordStructurePtr getParent();
epics::pvData::PVFieldPtr getPVField(); epics::pvData::PVFieldPtr getPVField();
epics::pvData::String getFullFieldName(); std::string getFullFieldName();
epics::pvData::String getFullName(); std::string getFullName();
PVRecordPtr getPVRecord(); PVRecordPtr getPVRecord();
bool addListener(PVListenerPtr const &amp; pvListener); bool addListener(PVListenerPtr const &amp; pvListener);
virtual void removeListener(PVListenerPtr const &amp; pvListener); virtual void removeListener(PVListenerPtr const &amp; pvListener);
virtual void postPut(); virtual void postPut();
virtual void message( virtual void message(
epics::pvData::String const &amp; message, std::string const &amp; message,
epics::pvData::MessageType messageType); epics::pvData::MessageType messageType);
protected: protected:
PVRecordFieldPtr getPtrSelf() PVRecordFieldPtr getPtrSelf()
@ -896,13 +896,13 @@ public:
static PVDatabasePtr getMaster(); static PVDatabasePtr getMaster();
virtual ~PVDatabase(); virtual ~PVDatabase();
virtual void destroy(); virtual void destroy();
PVRecordPtr findRecord(epics::pvData::String const&amp; recordName); PVRecordPtr findRecord(std::string const&amp; recordName);
bool addRecord(PVRecordPtr const &amp; record); bool addRecord(PVRecordPtr const &amp; record);
epics::pvData::PVStringArrayPtr getRecordNames(); epics::pvData::PVStringArrayPtr getRecordNames();
bool removeRecord(PVRecordPtr const &amp; record); bool removeRecord(PVRecordPtr const &amp; record);
virtual epics::pvData::String getRequesterName(); virtual std::string getRequesterName();
virtual void message( virtual void message(
epics::pvData::String const &amp;message, std::string const &amp;message,
epics::pvData::MessageType messageType); epics::pvData::MessageType messageType);
private: private:
PVDatabase(); PVDatabase();
@ -1227,13 +1227,13 @@ class ExampleServer :
public: public:
POINTER_DEFINITIONS(ExampleServer); POINTER_DEFINITIONS(ExampleServer);
static ExampleServerPtr create( static ExampleServerPtr create(
epics::pvData::String const &amp; recordName); std::string const &amp; recordName);
virtual ~ExampleServer(); virtual ~ExampleServer();
virtual void destroy(); virtual void destroy();
virtual bool init(); virtual bool init();
virtual void process(); virtual void process();
private: private:
ExampleServer(epics::pvData::String const &amp; recordName, ExampleServer(std::string const &amp; recordName,
epics::pvData::PVStructurePtr const &amp; pvStructure); epics::pvData::PVStructurePtr const &amp; pvStructure);
epics::pvData::PVStringPtr pvArgumentValue; epics::pvData::PVStringPtr pvArgumentValue;
@ -1271,7 +1271,7 @@ private:
<p>The implementation of create method is:</p> <p>The implementation of create method is:</p>
<pre> <pre>
ExampleServerPtr ExampleServer::create( ExampleServerPtr ExampleServer::create(
epics::pvData::String const &amp; recordName) std::string const &amp; recordName)
{ {
StandardPVFieldPtr standardPVField = getStandardPVField(); StandardPVFieldPtr standardPVField = getStandardPVField();
PVDataCreatePtr pvDataCreate = getPVDataCreate(); PVDataCreatePtr pvDataCreate = getPVDataCreate();
@ -1302,7 +1302,7 @@ This:
<p>The private constructor method is:</p> <p>The private constructor method is:</p>
<pre> <pre>
ExampleServer::ExampleServer( ExampleServer::ExampleServer(
epics::pvData::String const &amp; recordName, std::string const &amp; recordName,
epics::pvData::PVStructurePtr const &amp; pvStructure) epics::pvData::PVStructurePtr const &amp; pvStructure)
: PVRecord(recordName,pvStructure) : PVRecord(recordName,pvStructure)
{ {
@ -1576,9 +1576,9 @@ class ExampleLink :
public: public:
POINTER_DEFINITIONS(ExampleLink); POINTER_DEFINITIONS(ExampleLink);
static ExampleLinkPtr create( static ExampleLinkPtr create(
epics::pvData::String const &amp; recordName, std::string const &amp; recordName,
epics::pvData::String const &amp; providerName, std::string const &amp; providerName,
epics::pvData::String const &amp; channelName std::string const &amp; channelName
); );
virtual ~ExampleLink() {} virtual ~ExampleLink() {}
virtual void destroy(); virtual void destroy();

View File

@ -42,7 +42,7 @@ static StandardPVFieldPtr standardPVField = getStandardPVField();
static void createStructureArrayRecord( static void createStructureArrayRecord(
PVDatabasePtr const &master, PVDatabasePtr const &master,
String const &recordName) string const &recordName)
{ {
StringArray names(2); StringArray names(2);
FieldConstPtrArray fields(2); FieldConstPtrArray fields(2);
@ -65,7 +65,7 @@ static void createStructureArrayRecord(
static void createRegularUnionArrayRecord( static void createRegularUnionArrayRecord(
PVDatabasePtr const &master, PVDatabasePtr const &master,
String const &recordName) string const &recordName)
{ {
StringArray unionNames(2); StringArray unionNames(2);
FieldConstPtrArray unionFields(2); FieldConstPtrArray unionFields(2);
@ -87,7 +87,7 @@ static void createRegularUnionArrayRecord(
static void createVariantUnionArrayRecord( static void createVariantUnionArrayRecord(
PVDatabasePtr const &master, PVDatabasePtr const &master,
String const &recordName) string const &recordName)
{ {
StringArray names(1); StringArray names(1);
FieldConstPtrArray fields(1); FieldConstPtrArray fields(1);
@ -103,10 +103,10 @@ static void createVariantUnionArrayRecord(
static void createRecords( static void createRecords(
PVDatabasePtr const &master, PVDatabasePtr const &master,
ScalarType scalarType, ScalarType scalarType,
String const &recordNamePrefix, string const &recordNamePrefix,
String const &properties) string const &properties)
{ {
String recordName = recordNamePrefix; string recordName = recordNamePrefix;
PVStructurePtr pvStructure = standardPVField->scalar(scalarType,properties); PVStructurePtr pvStructure = standardPVField->scalar(scalarType,properties);
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure); PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
bool result = master->addRecord(pvRecord); bool result = master->addRecord(pvRecord);
@ -121,13 +121,13 @@ void ExampleDatabase::create()
{ {
PVDatabasePtr master = PVDatabase::getMaster(); PVDatabasePtr master = PVDatabase::getMaster();
PVRecordPtr pvRecord; PVRecordPtr pvRecord;
String recordName; string recordName;
bool result(false); bool result(false);
recordName = "traceRecordPGRPC"; recordName = "traceRecordPGRPC";
pvRecord = TraceRecord::create(recordName); pvRecord = TraceRecord::create(recordName);
result = master->addRecord(pvRecord); result = master->addRecord(pvRecord);
if(!result) cout<< "record " << recordName << " not added" << endl; if(!result) cout<< "record " << recordName << " not added" << endl;
String properties; string properties;
properties = "alarm,timeStamp"; properties = "alarm,timeStamp";
createRecords(master,pvBoolean,"exampleBoolean",properties); createRecords(master,pvBoolean,"exampleBoolean",properties);
createRecords(master,pvByte,"exampleByte",properties); createRecords(master,pvByte,"exampleByte",properties);

View File

@ -42,9 +42,7 @@ int main(int argc,char *argv[])
startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true); startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
cout << "exampleDatabase\n"; cout << "exampleDatabase\n";
PVStringArrayPtr pvNames = master->getRecordNames(); PVStringArrayPtr pvNames = master->getRecordNames();
String buffer; cout << "recordNames" << endl << *pvNames << endl;
pvNames->toString(&buffer);
cout << "recordNames" << endl << buffer << endl;
string str; string str;
while(true) { while(true) {
cout << "Type exit to stop: \n"; cout << "Type exit to stop: \n";

View File

@ -13,12 +13,14 @@
#include <pv/monitorPlugin.h> #include <pv/monitorPlugin.h>
#include <pv/exampleMonitorPlugin.h> #include <pv/exampleMonitorPlugin.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
static String pluginName("onChange"); namespace epics { namespace pvDatabase {
static string pluginName("onChange");
static ConvertPtr convert(getConvert()); static ConvertPtr convert(getConvert());
class OnChangePlugin; class OnChangePlugin;
@ -42,13 +44,13 @@ public:
PVStringPtr pvString = PVStringPtr pvString =
pvFieldOptions->getSubField<PVString>("raiseMonitor"); pvFieldOptions->getSubField<PVString>("raiseMonitor");
if(pvString!=NULL) { if(pvString!=NULL) {
String value = pvString->get(); string value = pvString->get();
if(value.compare("false")==0) raiseMonitor = false; if(value.compare("false")==0) raiseMonitor = false;
} }
} }
return true; return true;
} }
virtual String &getName(){return pluginName;} virtual string &getName(){return pluginName;}
virtual bool causeMonitor( virtual bool causeMonitor(
PVFieldPtr const &pvNew, PVFieldPtr const &pvNew,
PVStructurePtr const &pvTop, PVStructurePtr const &pvTop,
@ -67,7 +69,7 @@ private:
class OnChangePluginCreator : public MonitorPluginCreator class OnChangePluginCreator : public MonitorPluginCreator
{ {
public: public:
virtual String &getName(){return pluginName;} virtual string &getName(){return pluginName;}
virtual MonitorPluginPtr create( virtual MonitorPluginPtr create(
FieldConstPtr const &field, FieldConstPtr const &field,
StructureConstPtr const &top, StructureConstPtr const &top,

View File

@ -36,9 +36,9 @@ class epicsShareClass ExampleLink :
public: public:
POINTER_DEFINITIONS(ExampleLink); POINTER_DEFINITIONS(ExampleLink);
static ExampleLinkPtr create( static ExampleLinkPtr create(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::String const & providerName, std::string const & providerName,
epics::pvData::String const & channelName std::string const & channelName
); );
virtual ~ExampleLink() {} virtual ~ExampleLink() {}
virtual void destroy(); virtual void destroy();
@ -59,20 +59,20 @@ public:
epics::pvAccess::ChannelGet::shared_pointer const & channelGet, epics::pvAccess::ChannelGet::shared_pointer const & channelGet,
epics::pvData::PVStructurePtr const & pvStructure, epics::pvData::PVStructurePtr const & pvStructure,
epics::pvData::BitSetPtr const &bitSet); epics::pvData::BitSetPtr const &bitSet);
virtual epics::pvData::String getRequesterName() {return channelName;} virtual std::string getRequesterName() {return channelName;}
virtual void message( virtual void message(
epics::pvData::String const & message, std::string const & message,
epics::pvData::MessageType messageType) epics::pvData::MessageType messageType)
{ {
std::cout << "Why is ExampleLink::message called\n"; std::cout << "Why is ExampleLink::message called\n";
} }
private: private:
ExampleLink(epics::pvData::String const & recordName, ExampleLink(std::string const & recordName,
epics::pvData::String providerName, std::string providerName,
epics::pvData::String channelName, std::string channelName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::String providerName; std::string providerName;
epics::pvData::String channelName; std::string channelName;
epics::pvData::ConvertPtr convert; epics::pvData::ConvertPtr convert;
epics::pvData::PVDoubleArrayPtr pvValue; epics::pvData::PVDoubleArrayPtr pvValue;
epics::pvData::PVTimeStamp pvTimeStamp; epics::pvData::PVTimeStamp pvTimeStamp;

View File

@ -38,7 +38,7 @@ int main(int argc,char *argv[])
ChannelProviderLocalPtr channelProvider = getChannelProviderLocal(); ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
PVRecordPtr pvRecord; PVRecordPtr pvRecord;
bool result(false); bool result(false);
String recordName; string recordName;
recordName = "powerSupply"; recordName = "powerSupply";
PVStructurePtr pv = createPowerSupply(); PVStructurePtr pv = createPowerSupply();
pvRecord = PowerSupply::create(recordName,pv); pvRecord = PowerSupply::create(recordName,pv);

View File

@ -29,13 +29,13 @@ class epicsShareClass ExampleServer :
public: public:
POINTER_DEFINITIONS(ExampleServer); POINTER_DEFINITIONS(ExampleServer);
static ExampleServerPtr create( static ExampleServerPtr create(
epics::pvData::String const & recordName); std::string const & recordName);
virtual ~ExampleServer(); virtual ~ExampleServer();
virtual void destroy(); virtual void destroy();
virtual bool init(); virtual bool init();
virtual void process(); virtual void process();
private: private:
ExampleServer(epics::pvData::String const & recordName, ExampleServer(std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVStringPtr pvArgumentValue; epics::pvData::PVStringPtr pvArgumentValue;

View File

@ -70,7 +70,7 @@ void PVDatabase::unlock() {
mutex.unlock(); mutex.unlock();
} }
PVRecordPtr PVDatabase::findRecord(String const& recordName) PVRecordPtr PVDatabase::findRecord(string const& recordName)
{ {
lock(); lock();
try { try {
@ -104,13 +104,13 @@ PVStringArrayPtr PVDatabase::getRecordNames()
PVStringArrayPtr pvStringArray = static_pointer_cast<PVStringArray> PVStringArrayPtr pvStringArray = static_pointer_cast<PVStringArray>
(getPVDataCreate()->createPVScalarArray(pvString)); (getPVDataCreate()->createPVScalarArray(pvString));
size_t len = recordMap.size(); size_t len = recordMap.size();
shared_vector<String> names(len); shared_vector<string> names(len);
PVRecordMap::iterator iter; PVRecordMap::iterator iter;
size_t i = 0; size_t i = 0;
for(iter = recordMap.begin(); iter!=recordMap.end(); ++iter) { for(iter = recordMap.begin(); iter!=recordMap.end(); ++iter) {
names[i++] = (*iter).first; names[i++] = (*iter).first;
} }
shared_vector<const String> temp(freeze(names)); shared_vector<const string> temp(freeze(names));
pvStringArray->replace(temp); pvStringArray->replace(temp);
unlock(); unlock();
return pvStringArray; return pvStringArray;
@ -128,7 +128,7 @@ bool PVDatabase::addRecord(PVRecordPtr const & record)
unlock(); unlock();
return false; return false;
} }
String recordName = record->getRecordName(); string recordName = record->getRecordName();
PVRecordMap::iterator iter = recordMap.find(recordName); PVRecordMap::iterator iter = recordMap.find(recordName);
if(iter!=recordMap.end()) { if(iter!=recordMap.end()) {
unlock(); unlock();
@ -152,7 +152,7 @@ bool PVDatabase::removeRecord(PVRecordPtr const & record)
unlock(); unlock();
return false; return false;
} }
String recordName = record->getRecordName(); string recordName = record->getRecordName();
PVRecordMap::iterator iter = recordMap.find(recordName); PVRecordMap::iterator iter = recordMap.find(recordName);
if(iter!=recordMap.end()) { if(iter!=recordMap.end()) {
PVRecordPtr pvRecord = (*iter).second; PVRecordPtr pvRecord = (*iter).second;

View File

@ -35,7 +35,7 @@ namespace epics { namespace pvDatabase {
class PVRecord; class PVRecord;
typedef std::tr1::shared_ptr<PVRecord> PVRecordPtr; typedef std::tr1::shared_ptr<PVRecord> PVRecordPtr;
typedef std::map<epics::pvData::String,PVRecordPtr> PVRecordMap; typedef std::map<std::string,PVRecordPtr> PVRecordMap;
class PVRecordField; class PVRecordField;
typedef std::tr1::shared_ptr<PVRecordField> PVRecordFieldPtr; typedef std::tr1::shared_ptr<PVRecordField> PVRecordFieldPtr;
@ -97,7 +97,7 @@ public:
* @return A shared pointer to the newly created record. * @return A shared pointer to the newly created record.
*/ */
static PVRecordPtr create( static PVRecordPtr create(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
/** /**
* The Destructor. Must be virtual. * The Destructor. Must be virtual.
@ -107,7 +107,7 @@ public:
* Get the name of the record. * Get the name of the record.
* @return The name. * @return The name.
*/ */
epics::pvData::String getRecordName(); std::string getRecordName();
/** /**
* Get the top level PVStructure. * Get the top level PVStructure.
* @return The shared pointer. * @return The shared pointer.
@ -187,13 +187,15 @@ public:
* Calls the next method with indentLevel = 0. * Calls the next method with indentLevel = 0.
* @param buf String Builder. * @param buf String Builder.
*/ */
void toString(epics::pvData::StringBuilder buf); // TODO
void toString(std::string* buf);
/** /**
* Dumps the data from the top level PVStructure. * Dumps the data from the top level PVStructure.
* @param buf String Builder. * @param buf String Builder.
* @param indentLevel The indentation level. * @param indentLevel The indentation level.
*/ */
void toString(epics::pvData::StringBuilder buf,int indentLevel); // TODO
void toString(std::string* buf,int indentLevel);
/** /**
* get trace level (0,1,2) means (nothing,lifetime,process) * get trace level (0,1,2) means (nothing,lifetime,process)
* @return the level * @return the level
@ -211,7 +213,7 @@ protected:
* @param pvStructure The top level PVStructutre * @param pvStructure The top level PVStructutre
*/ */
PVRecord( PVRecord(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
/** /**
* Initializes the base class. Must be called by derived classes. * Initializes the base class. Must be called by derived classes.
@ -230,7 +232,7 @@ private:
PVRecordFieldPtr findPVRecordField( PVRecordFieldPtr findPVRecordField(
PVRecordStructurePtr const & pvrs, PVRecordStructurePtr const & pvrs,
epics::pvData::PVFieldPtr const & pvField); epics::pvData::PVFieldPtr const & pvField);
epics::pvData::String recordName; std::string recordName;
epics::pvData::PVStructurePtr pvStructure; epics::pvData::PVStructurePtr pvStructure;
epics::pvData::ConvertPtr convert; epics::pvData::ConvertPtr convert;
PVRecordStructurePtr pvRecordStructure; PVRecordStructurePtr pvRecordStructure;
@ -284,12 +286,12 @@ public:
* Get the full name of the field, i.e. field,field,.. * Get the full name of the field, i.e. field,field,..
* @return The full name. * @return The full name.
*/ */
epics::pvData::String getFullFieldName(); std::string getFullFieldName();
/** /**
* Get the recordName plus the full name of the field, i.e. recordName.field,field,.. * Get the recordName plus the full name of the field, i.e. recordName.field,field,..
* @return The name. * @return The name.
*/ */
epics::pvData::String getFullName(); std::string getFullName();
/** /**
* Returns the PVRecord to which this field belongs. * Returns the PVRecord to which this field belongs.
* @return The shared pointer, * @return The shared pointer,
@ -331,8 +333,8 @@ private:
bool isStructure; bool isStructure;
PVRecordStructurePtr parent; PVRecordStructurePtr parent;
PVRecordPtr pvRecord; PVRecordPtr pvRecord;
epics::pvData::String fullName; std::string fullName;
epics::pvData::String fullFieldName; std::string fullFieldName;
friend class PVRecordStructure; friend class PVRecordStructure;
friend class PVRecord; friend class PVRecord;
}; };
@ -481,7 +483,7 @@ public:
* @param recordName The record to find. * @param recordName The record to find.
* @return The shared pointer. * @return The shared pointer.
*/ */
PVRecordPtr findRecord(epics::pvData::String const& recordName); PVRecordPtr findRecord(std::string const& recordName);
/** /**
* Add a record. * Add a record.
* @param The record to add. * @param The record to add.

View File

@ -22,7 +22,7 @@ using namespace std;
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
PVRecordPtr PVRecord::create( PVRecordPtr PVRecord::create(
String const &recordName, string const &recordName,
PVStructurePtr const & pvStructure) PVStructurePtr const & pvStructure)
{ {
PVRecordPtr pvRecord(new PVRecord(recordName,pvStructure)); PVRecordPtr pvRecord(new PVRecord(recordName,pvStructure));
@ -35,7 +35,7 @@ PVRecordPtr PVRecord::create(
PVRecord::PVRecord( PVRecord::PVRecord(
String const & recordName, string const & recordName,
PVStructurePtr const & pvStructure) PVStructurePtr const & pvStructure)
: recordName(recordName), : recordName(recordName),
pvStructure(pvStructure), pvStructure(pvStructure),
@ -103,7 +103,7 @@ void PVRecord::destroy()
} }
} }
String PVRecord::getRecordName() {return recordName;} string PVRecord::getRecordName() {return recordName;}
PVRecordStructurePtr PVRecord::getPVRecordStructure() {return pvRecordStructure;} PVRecordStructurePtr PVRecord::getPVRecordStructure() {return pvRecordStructure;}
@ -346,15 +346,17 @@ void PVRecord::endGroupPut()
} }
} }
void PVRecord::toString(StringBuilder buf) void PVRecord::toString(string* buf)
{ {
toString(buf,0); toString(buf,0);
} }
void PVRecord::toString(StringBuilder buf,int indentLevel) void PVRecord::toString(string* buf,int indentLevel)
{ {
*buf += "\nrecord " + recordName + " "; std::ostringstream oss;
pvRecordStructure->getPVStructure()->toString(buf, indentLevel); // TODO indent ignored
oss << endl << recordName << ' ' << *pvRecordStructure->getPVStructure();
*buf += oss.str();
} }
PVRecordField::PVRecordField( PVRecordField::PVRecordField(
@ -373,7 +375,7 @@ void PVRecordField::init()
fullFieldName = pvField->getFieldName(); fullFieldName = pvField->getFieldName();
PVRecordStructurePtr pvParent = parent; PVRecordStructurePtr pvParent = parent;
while(pvParent.get()!= NULL) { while(pvParent.get()!= NULL) {
String parentName = pvParent->getPVField()->getFieldName(); string parentName = pvParent->getPVField()->getFieldName();
if(parentName.size()>0) { if(parentName.size()>0) {
fullFieldName = pvParent->getPVField()->getFieldName() fullFieldName = pvParent->getPVField()->getFieldName()
+ '.' + fullFieldName; + '.' + fullFieldName;
@ -404,9 +406,9 @@ PVRecordStructurePtr PVRecordField::getParent() {return parent;}
PVFieldPtr PVRecordField::getPVField() {return pvField;} PVFieldPtr PVRecordField::getPVField() {return pvField;}
String PVRecordField::getFullFieldName() {return fullFieldName; } string PVRecordField::getFullFieldName() {return fullFieldName; }
String PVRecordField::getFullName() {return fullName; } string PVRecordField::getFullName() {return fullName; }
PVRecordPtr PVRecordField::getPVRecord() {return pvRecord;} PVRecordPtr PVRecordField::getPVRecord() {return pvRecord;}

View File

@ -20,14 +20,15 @@
#include <pv/channelProviderLocal.h> #include <pv/channelProviderLocal.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
namespace epics { namespace pvDatabase {
static ConvertPtr convert = getConvert(); static ConvertPtr convert = getConvert();
static StructureConstPtr nullStructure; static StructureConstPtr nullStructure;
@ -830,9 +831,9 @@ ChannelArrayLocalPtr ChannelArrayLocal::create(
return channelArray; return channelArray;
} }
PVFieldPtr pvField = pvFields[0]; PVFieldPtr pvField = pvFields[0];
String fieldName(""); string fieldName("");
while(true) { while(true) {
String name = pvField->getFieldName(); string name = pvField->getFieldName();
if(fieldName.size()>0) fieldName += '.'; if(fieldName.size()>0) fieldName += '.';
fieldName += name; fieldName += name;
PVStructurePtr pvs = static_pointer_cast<PVStructure>(pvField); PVStructurePtr pvs = static_pointer_cast<PVStructure>(pvField);
@ -1150,21 +1151,21 @@ void ChannelLocal::detach(PVRecordPtr const & pvRecord)
} }
String ChannelLocal::getRequesterName() string ChannelLocal::getRequesterName()
{ {
return requester->getRequesterName(); return requester->getRequesterName();
} }
void ChannelLocal::message( void ChannelLocal::message(
String const &message, string const &message,
MessageType messageType) MessageType messageType)
{ {
requester->message(message,messageType); requester->message(message,messageType);
} }
String ChannelLocal::getRemoteAddress() string ChannelLocal::getRemoteAddress()
{ {
return String("local"); return string("local");
} }
Channel::ConnectionState ChannelLocal::getConnectionState() Channel::ConnectionState ChannelLocal::getConnectionState()
@ -1172,7 +1173,7 @@ Channel::ConnectionState ChannelLocal::getConnectionState()
return Channel::CONNECTED; return Channel::CONNECTED;
} }
String ChannelLocal::getChannelName() string ChannelLocal::getChannelName()
{ {
return pvRecord->getRecordName(); return pvRecord->getRecordName();
} }
@ -1188,7 +1189,7 @@ bool ChannelLocal::isConnected()
} }
void ChannelLocal::getField(GetFieldRequester::shared_pointer const &requester, void ChannelLocal::getField(GetFieldRequester::shared_pointer const &requester,
String const &subField) string const &subField)
{ {
if(subField.size()<1) { if(subField.size()<1) {
StructureConstPtr structure = StructureConstPtr structure =
@ -1203,14 +1204,14 @@ void ChannelLocal::getField(GetFieldRequester::shared_pointer const &requester,
return; return;
} }
Status status(Status::STATUSTYPE_ERROR, Status status(Status::STATUSTYPE_ERROR,
String("client asked for illegal field")); "client asked for illegal field");
requester->getDone(status,FieldConstPtr()); requester->getDone(status,FieldConstPtr());
} }
AccessRights ChannelLocal::getAccessRights( AccessRights ChannelLocal::getAccessRights(
PVField::shared_pointer const &pvField) PVField::shared_pointer const &pvField)
{ {
throw std::logic_error(String("Not Implemented")); throw std::logic_error("Not Implemented");
} }
ChannelProcess::shared_pointer ChannelLocal::createChannelProcess( ChannelProcess::shared_pointer ChannelLocal::createChannelProcess(
@ -1270,7 +1271,7 @@ ChannelRPC::shared_pointer ChannelLocal::createChannelRPC(
PVStructure::shared_pointer const & pvRequest) PVStructure::shared_pointer const & pvRequest)
{ {
Status status(Status::STATUSTYPE_ERROR, Status status(Status::STATUSTYPE_ERROR,
String("ChannelRPC not supported")); "ChannelRPC not supported");
channelRPCRequester->channelRPCConnect(status,ChannelRPC::shared_pointer()); channelRPCRequester->channelRPCConnect(status,ChannelRPC::shared_pointer());
return ChannelRPC::shared_pointer(); return ChannelRPC::shared_pointer();
} }
@ -1302,12 +1303,12 @@ ChannelArray::shared_pointer ChannelLocal::createChannelArray(
void ChannelLocal::printInfo() void ChannelLocal::printInfo()
{ {
cout << "ChannelLocal provides access to service" << endl; printInfo(std::cout);
} }
void ChannelLocal::printInfo(StringBuilder out) void ChannelLocal::printInfo(std::ostream& out)
{ {
*out += "ChannelLocal provides access to service"; out << "ChannelLocal provides access to service";
} }
}} }}

View File

@ -17,16 +17,17 @@
#include <pv/channelProviderLocal.h> #include <pv/channelProviderLocal.h>
#include <pv/traceRecord.h> #include <pv/traceRecord.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
static String providerName("local"); namespace epics { namespace pvDatabase {
static string providerName("local");
class LocalChannelProviderFactory; class LocalChannelProviderFactory;
@ -37,7 +38,7 @@ class LocalChannelProviderFactory : public ChannelProviderFactory
public: public:
POINTER_DEFINITIONS(LocalChannelProviderFactory); POINTER_DEFINITIONS(LocalChannelProviderFactory);
virtual String getFactoryName() { return providerName;} virtual string getFactoryName() { return providerName;}
static LocalChannelProviderFactoryPtr create( static LocalChannelProviderFactoryPtr create(
ChannelProviderLocalPtr const &channelProvider) ChannelProviderLocalPtr const &channelProvider)
{ {
@ -97,13 +98,13 @@ void ChannelProviderLocal::destroy()
pvDatabase->destroy(); pvDatabase->destroy();
} }
String ChannelProviderLocal::getProviderName() string ChannelProviderLocal::getProviderName()
{ {
return providerName; return providerName;
} }
ChannelFind::shared_pointer ChannelProviderLocal::channelFind( ChannelFind::shared_pointer ChannelProviderLocal::channelFind(
String const & channelName, string const & channelName,
ChannelFindRequester::shared_pointer const &channelFindRequester) ChannelFindRequester::shared_pointer const &channelFindRequester)
{ {
Lock xx(mutex); Lock xx(mutex);
@ -115,7 +116,7 @@ ChannelFind::shared_pointer ChannelProviderLocal::channelFind(
true); true);
} else { } else {
Status notFoundStatus(Status::STATUSTYPE_ERROR,String("pv not found")); Status notFoundStatus(Status::STATUSTYPE_ERROR,"pv not found");
channelFindRequester->channelFindResult( channelFindRequester->channelFindResult(
notFoundStatus, notFoundStatus,
channelFinder, channelFinder,
@ -138,7 +139,7 @@ ChannelFind::shared_pointer ChannelProviderLocal::channelList(
} }
Channel::shared_pointer ChannelProviderLocal::createChannel( Channel::shared_pointer ChannelProviderLocal::createChannel(
String const & channelName, string const & channelName,
ChannelRequester::shared_pointer const &channelRequester, ChannelRequester::shared_pointer const &channelRequester,
short priority) short priority)
{ {
@ -146,10 +147,10 @@ Channel::shared_pointer ChannelProviderLocal::createChannel(
} }
Channel::shared_pointer ChannelProviderLocal::createChannel( Channel::shared_pointer ChannelProviderLocal::createChannel(
String const & channelName, string const & channelName,
ChannelRequester::shared_pointer const &channelRequester, ChannelRequester::shared_pointer const &channelRequester,
short priority, short priority,
String const &address) string const &address)
{ {
Lock xx(mutex); Lock xx(mutex);
PVRecordPtr pvRecord = pvDatabase->findRecord(channelName); PVRecordPtr pvRecord = pvDatabase->findRecord(channelName);
@ -162,7 +163,7 @@ Channel::shared_pointer ChannelProviderLocal::createChannel(
pvRecord->addPVRecordClient(channel); pvRecord->addPVRecordClient(channel);
return channel; return channel;
} }
Status notFoundStatus(Status::STATUSTYPE_ERROR,String("pv not found")); Status notFoundStatus(Status::STATUSTYPE_ERROR,"pv not found");
channelRequester->channelCreated( channelRequester->channelCreated(
notFoundStatus, notFoundStatus,
Channel::shared_pointer()); Channel::shared_pointer());

View File

@ -86,21 +86,21 @@ public:
POINTER_DEFINITIONS(ChannelProviderLocal); POINTER_DEFINITIONS(ChannelProviderLocal);
virtual ~ChannelProviderLocal(); virtual ~ChannelProviderLocal();
virtual void destroy(); virtual void destroy();
virtual epics::pvData::String getProviderName(); virtual std::string getProviderName();
virtual epics::pvAccess::ChannelFind::shared_pointer channelFind( virtual epics::pvAccess::ChannelFind::shared_pointer channelFind(
epics::pvData::String const &channelName, std::string const &channelName,
epics::pvAccess::ChannelFindRequester::shared_pointer const & channelFindRequester); epics::pvAccess::ChannelFindRequester::shared_pointer const & channelFindRequester);
virtual epics::pvAccess::ChannelFind::shared_pointer channelList( virtual epics::pvAccess::ChannelFind::shared_pointer channelList(
epics::pvAccess::ChannelListRequester::shared_pointer const & channelListRequester); epics::pvAccess::ChannelListRequester::shared_pointer const & channelListRequester);
virtual epics::pvAccess::Channel::shared_pointer createChannel( virtual epics::pvAccess::Channel::shared_pointer createChannel(
epics::pvData::String const &channelName, std::string const &channelName,
epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester, epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester,
short priority); short priority);
virtual epics::pvAccess::Channel::shared_pointer createChannel( virtual epics::pvAccess::Channel::shared_pointer createChannel(
epics::pvData::String const &channelName, std::string const &channelName,
epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester, epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester,
short priority, short priority,
epics::pvData::String const &address); std::string const &address);
private: private:
shared_pointer getPtrSelf() shared_pointer getPtrSelf()
{ {
@ -129,22 +129,22 @@ public:
); );
virtual ~ChannelLocal(); virtual ~ChannelLocal();
virtual void destroy(); virtual void destroy();
virtual epics::pvData::String getRequesterName(); virtual std::string getRequesterName();
virtual void message( virtual void message(
epics::pvData::String const & message, std::string const & message,
epics::pvData::MessageType messageType); epics::pvData::MessageType messageType);
virtual epics::pvAccess::ChannelProvider::shared_pointer getProvider() virtual epics::pvAccess::ChannelProvider::shared_pointer getProvider()
{ {
return provider; return provider;
} }
virtual epics::pvData::String getRemoteAddress(); virtual std::string getRemoteAddress();
virtual epics::pvAccess::Channel::ConnectionState getConnectionState(); virtual epics::pvAccess::Channel::ConnectionState getConnectionState();
virtual epics::pvData::String getChannelName(); virtual std::string getChannelName();
virtual epics::pvAccess::ChannelRequester::shared_pointer getChannelRequester(); virtual epics::pvAccess::ChannelRequester::shared_pointer getChannelRequester();
virtual bool isConnected(); virtual bool isConnected();
virtual void getField( virtual void getField(
epics::pvAccess::GetFieldRequester::shared_pointer const &requester, epics::pvAccess::GetFieldRequester::shared_pointer const &requester,
epics::pvData::String const & subField); std::string const & subField);
virtual epics::pvAccess::AccessRights getAccessRights( virtual epics::pvAccess::AccessRights getAccessRights(
epics::pvData::PVField::shared_pointer const &pvField); epics::pvData::PVField::shared_pointer const &pvField);
virtual epics::pvAccess::ChannelProcess::shared_pointer createChannelProcess( virtual epics::pvAccess::ChannelProcess::shared_pointer createChannelProcess(
@ -169,7 +169,7 @@ public:
epics::pvAccess::ChannelArrayRequester::shared_pointer const &requester, epics::pvAccess::ChannelArrayRequester::shared_pointer const &requester,
epics::pvData::PVStructurePtr const &pvRequest); epics::pvData::PVStructurePtr const &pvRequest);
virtual void printInfo(); virtual void printInfo();
virtual void printInfo(epics::pvData::StringBuilder out); virtual void printInfo(std::ostream& out);
virtual void detach(PVRecordPtr const &pvRecord); virtual void detach(PVRecordPtr const &pvRecord);
protected: protected:
shared_pointer getPtrSelf() shared_pointer getPtrSelf()

View File

@ -21,12 +21,14 @@
#include <pv/channelProviderLocal.h> #include <pv/channelProviderLocal.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvAccess; using namespace epics::pvAccess;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
namespace epics { namespace pvDatabase {
static MonitorPtr nullMonitor; static MonitorPtr nullMonitor;
static MonitorElementPtr NULLMonitorElement; static MonitorElementPtr NULLMonitorElement;
@ -384,7 +386,7 @@ bool MultipleElementQueue::dataChanged()
queue->setUsed(activeElement); queue->setUsed(activeElement);
activeElement = queue->getFree(); activeElement = queue->getFree();
if(activeElement==NULL) { if(activeElement==NULL) {
throw std::logic_error(String("MultipleElementQueue::dataChanged() logic error")); throw std::logic_error("MultipleElementQueue::dataChanged() logic error");
} }
if(queue->getNumberFree()==0) queueIsFull = true; if(queue->getNumberFree()==0) queueIsFull = true;
activeElement->changedBitSet->clear(); activeElement->changedBitSet->clear();

View File

@ -20,14 +20,15 @@
#include <pv/channelProviderLocal.h> #include <pv/channelProviderLocal.h>
#include <pv/pvCopyMonitor.h> #include <pv/pvCopyMonitor.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using std::tr1::dynamic_pointer_cast; using std::tr1::dynamic_pointer_cast;
using std::size_t; using std::size_t;
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string;
namespace epics { namespace pvDatabase {
struct PVCopyMonitorFieldNode struct PVCopyMonitorFieldNode
{ {
@ -73,12 +74,12 @@ PVCopyMonitor::~PVCopyMonitor()
void PVCopyMonitor::init(PVFieldPtr const &pvField) void PVCopyMonitor::init(PVFieldPtr const &pvField)
{ {
size_t offset = pvCopy->getCopyOffset(pvField); size_t offset = pvCopy->getCopyOffset(pvField);
if(offset==String::npos) return; if(offset==string::npos) return;
PVStructurePtr pvOptions = pvCopy->getOptions(offset); PVStructurePtr pvOptions = pvCopy->getOptions(offset);
if(pvOptions!=NULL) { if(pvOptions!=NULL) {
PVStringPtr pvName = pvOptions->getSubField<PVString>("plugin"); PVStringPtr pvName = pvOptions->getSubField<PVString>("plugin");
if(pvName!=NULL) { if(pvName!=NULL) {
String pluginName = pvName->get(); string pluginName = pvName->get();
MonitorPluginManagerPtr manager = MonitorPluginManager::get(); MonitorPluginManagerPtr manager = MonitorPluginManager::get();
MonitorPluginCreatorPtr pluginCreator = manager->findPlugin(pluginName); MonitorPluginCreatorPtr pluginCreator = manager->findPlugin(pluginName);
if(pluginCreator!=NULL) { if(pluginCreator!=NULL) {

View File

@ -20,7 +20,7 @@ using namespace std;
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
RecordListRecordPtr RecordListRecord::create( RecordListRecordPtr RecordListRecord::create(
epics::pvData::String const & recordName) std::string const & recordName)
{ {
FieldCreatePtr fieldCreate = getFieldCreate(); FieldCreatePtr fieldCreate = getFieldCreate();
PVDataCreatePtr pvDataCreate = getPVDataCreate(); PVDataCreatePtr pvDataCreate = getPVDataCreate();
@ -52,7 +52,7 @@ RecordListRecordPtr RecordListRecord::create(
} }
RecordListRecord::RecordListRecord( RecordListRecord::RecordListRecord(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure) epics::pvData::PVStructurePtr const & pvStructure)
: PVRecord(recordName,pvStructure) : PVRecord(recordName,pvStructure)
{ {
@ -93,11 +93,11 @@ void RecordListRecord::process()
{ {
PVStringArrayPtr pvNames = PVDatabase::getMaster()->getRecordNames(); PVStringArrayPtr pvNames = PVDatabase::getMaster()->getRecordNames();
names->replace(pvNames->view()); names->replace(pvNames->view());
String message(""); string message("");
if(database->get().compare("master")!=0) { if(database->get().compare("master")!=0) {
message += " can only access master "; message += " can only access master ";
} }
String regEx = regularExpression->get(); string regEx = regularExpression->get();
if(regEx.compare("")!=0 && regEx.compare(".*")!=0) { if(regEx.compare("")!=0 && regEx.compare(".*")!=0) {
message += " regularExpression not implemented "; message += " regularExpression not implemented ";
} }

View File

@ -26,13 +26,13 @@ class epicsShareClass RecordListRecord :
public: public:
POINTER_DEFINITIONS(RecordListRecord); POINTER_DEFINITIONS(RecordListRecord);
static RecordListRecordPtr create( static RecordListRecordPtr create(
epics::pvData::String const & recordName); std::string const & recordName);
virtual ~RecordListRecord(); virtual ~RecordListRecord();
virtual void destroy(); virtual void destroy();
virtual bool init(); virtual bool init();
virtual void process(); virtual void process();
private: private:
RecordListRecord(epics::pvData::String const & recordName, RecordListRecord(std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVStringPtr database; epics::pvData::PVStringPtr database;
epics::pvData::PVStringPtr regularExpression; epics::pvData::PVStringPtr regularExpression;

View File

@ -20,7 +20,7 @@ using namespace std;
namespace epics { namespace pvDatabase { namespace epics { namespace pvDatabase {
TraceRecordPtr TraceRecord::create( TraceRecordPtr TraceRecord::create(
epics::pvData::String const & recordName) std::string const & recordName)
{ {
FieldCreatePtr fieldCreate = getFieldCreate(); FieldCreatePtr fieldCreate = getFieldCreate();
PVDataCreatePtr pvDataCreate = getPVDataCreate(); PVDataCreatePtr pvDataCreate = getPVDataCreate();
@ -50,7 +50,7 @@ TraceRecordPtr TraceRecord::create(
} }
TraceRecord::TraceRecord( TraceRecord::TraceRecord(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure) epics::pvData::PVStructurePtr const & pvStructure)
: PVRecord(recordName,pvStructure), : PVRecord(recordName,pvStructure),
pvDatabase(PVDatabase::getMaster()), pvDatabase(PVDatabase::getMaster()),
@ -82,7 +82,7 @@ bool TraceRecord::init()
void TraceRecord::process() void TraceRecord::process()
{ {
String name = pvRecordName->get(); string name = pvRecordName->get();
PVRecordPtr pvRecord = pvDatabase->findRecord(name); PVRecordPtr pvRecord = pvDatabase->findRecord(name);
if(pvRecord==NULL) { if(pvRecord==NULL) {
pvResult->put(name + " not found"); pvResult->put(name + " not found");

View File

@ -27,14 +27,14 @@ class epicsShareClass TraceRecord :
public: public:
POINTER_DEFINITIONS(TraceRecord); POINTER_DEFINITIONS(TraceRecord);
static TraceRecordPtr create( static TraceRecordPtr create(
epics::pvData::String const & recordName); std::string const & recordName);
virtual ~TraceRecord(); virtual ~TraceRecord();
virtual void destroy(); virtual void destroy();
virtual bool init(); virtual bool init();
virtual void process(); virtual void process();
private: private:
TraceRecord( TraceRecord(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
PVDatabasePtr pvDatabase; PVDatabasePtr pvDatabase;
epics::pvData::PVStringPtr pvRecordName; epics::pvData::PVStringPtr pvRecordName;

View File

@ -13,8 +13,10 @@
#include <pv/standardField.h> #include <pv/standardField.h>
#include <pv/standardPVField.h> #include <pv/standardPVField.h>
namespace epics { namespace pvDatabase {
using namespace epics::pvData; using namespace epics::pvData;
using std::string;
namespace epics { namespace pvDatabase {
PVStructurePtr createPowerSupply() PVStructurePtr createPowerSupply()
{ {
@ -31,7 +33,7 @@ PVStructurePtr createPowerSupply()
powerSupply.push_back(standardField->alarm()); powerSupply.push_back(standardField->alarm());
names.push_back("timeStamp"); names.push_back("timeStamp");
powerSupply.push_back(standardField->timeStamp()); powerSupply.push_back(standardField->timeStamp());
String properties("alarm,display"); string properties("alarm,display");
names.push_back("voltage"); names.push_back("voltage");
powerSupply.push_back(standardField->scalar(pvDouble,properties)); powerSupply.push_back(standardField->scalar(pvDouble,properties));
names.push_back("power"); names.push_back("power");
@ -42,11 +44,8 @@ PVStructurePtr createPowerSupply()
fieldCreate->createStructure(names,powerSupply)); fieldCreate->createStructure(names,powerSupply));
} }
using namespace epics::pvData;
PowerSupplyPtr PowerSupply::create( PowerSupplyPtr PowerSupply::create(
String const & recordName, string const & recordName,
PVStructurePtr const & pvStructure) PVStructurePtr const & pvStructure)
{ {
PowerSupplyPtr pvRecord( PowerSupplyPtr pvRecord(
@ -56,7 +55,7 @@ PowerSupplyPtr PowerSupply::create(
} }
PowerSupply::PowerSupply( PowerSupply::PowerSupply(
String const & recordName, string const & recordName,
PVStructurePtr const & pvStructure) PVStructurePtr const & pvStructure)
: PVRecord(recordName,pvStructure) : PVRecord(recordName,pvStructure)
{ {
@ -97,7 +96,7 @@ bool PowerSupply::init()
std::cerr << "no alarm" << std::endl; std::cerr << "no alarm" << std::endl;
return false; return false;
} }
String name; string name;
name = "current.value"; name = "current.value";
pvField = pvStructure->getSubField(name); pvField = pvStructure->getSubField(name);
if(pvField.get()==NULL) { if(pvField.get()==NULL) {

View File

@ -32,7 +32,7 @@ class PowerSupply :
public: public:
POINTER_DEFINITIONS(PowerSupply); POINTER_DEFINITIONS(PowerSupply);
static PowerSupplyPtr create( static PowerSupplyPtr create(
epics::pvData::String const & recordName, std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
virtual ~PowerSupply(); virtual ~PowerSupply();
virtual void destroy(); virtual void destroy();
@ -43,7 +43,7 @@ public:
double getVoltage(); double getVoltage();
double getCurrent(); double getCurrent();
private: private:
PowerSupply(epics::pvData::String const & recordName, PowerSupply(std::string const & recordName,
epics::pvData::PVStructurePtr const & pvStructure); epics::pvData::PVStructurePtr const & pvStructure);
epics::pvData::PVDoublePtr pvCurrent; epics::pvData::PVDoublePtr pvCurrent;
epics::pvData::PVDoublePtr pvPower; epics::pvData::PVDoublePtr pvPower;

View File

@ -43,9 +43,9 @@ using namespace epics::pvDatabase;
void test() void test()
{ {
StandardPVFieldPtr standardPVField = getStandardPVField(); StandardPVFieldPtr standardPVField = getStandardPVField();
String properties; string properties;
ScalarType scalarType; ScalarType scalarType;
String recordName; string recordName;
properties = "alarm,timeStamp"; properties = "alarm,timeStamp";
scalarType = pvDouble; scalarType = pvDouble;
recordName = "exampleDouble"; recordName = "exampleDouble";

View File

@ -42,40 +42,40 @@ typedef std::tr1::shared_ptr<MyRequester> MyRequesterPtr;
class MyRequester : public Requester { class MyRequester : public Requester {
public: public:
POINTER_DEFINITIONS(MyRequester); POINTER_DEFINITIONS(MyRequester);
MyRequester(String const &requesterName) MyRequester(string const &requesterName)
: requesterName(requesterName) : requesterName(requesterName)
{} {}
virtual ~MyRequester() {} virtual ~MyRequester() {}
virtual String getRequesterName() { return requesterName;} virtual string getRequesterName() { return requesterName;}
virtual void message(String const & message,MessageType messageType) virtual void message(string const & message,MessageType messageType)
{ {
cout << message << endl; cout << message << endl;
} }
private: private:
String requesterName; string requesterName;
}; };
static PVRecordPtr createScalar( static PVRecordPtr createScalar(
String const & recordName, string const & recordName,
ScalarType scalarType, ScalarType scalarType,
String const & properties) string const & properties)
{ {
PVStructurePtr pvStructure = getStandardPVField()->scalar(scalarType,properties); PVStructurePtr pvStructure = getStandardPVField()->scalar(scalarType,properties);
return PVRecord::create(recordName,pvStructure); return PVRecord::create(recordName,pvStructure);
} }
static PVRecordPtr createScalarArray( static PVRecordPtr createScalarArray(
String const & recordName, string const & recordName,
ScalarType scalarType, ScalarType scalarType,
String const & properties) string const & properties)
{ {
PVStructurePtr pvStructure = getStandardPVField()->scalarArray(scalarType,properties); PVStructurePtr pvStructure = getStandardPVField()->scalarArray(scalarType,properties);
return PVRecord::create(recordName,pvStructure); return PVRecord::create(recordName,pvStructure);
} }
static void testPVScalar( static void testPVScalar(
String const & valueNameRecord, string const & valueNameRecord,
String const & valueNameCopy, string const & valueNameCopy,
PVRecordPtr const & pvRecord, PVRecordPtr const & pvRecord,
PVCopyPtr const & pvCopy) PVCopyPtr const & pvCopy)
{ {
@ -85,7 +85,6 @@ static void testPVScalar(
PVScalarPtr pvValueRecord; PVScalarPtr pvValueRecord;
PVScalarPtr pvValueCopy; PVScalarPtr pvValueCopy;
BitSetPtr bitSet; BitSetPtr bitSet;
String builder;
size_t offset; size_t offset;
ConvertPtr convert = getConvert(); ConvertPtr convert = getConvert();
@ -95,8 +94,7 @@ static void testPVScalar(
pvValueRecord = static_pointer_cast<PVScalar>(pvField); pvValueRecord = static_pointer_cast<PVScalar>(pvField);
convert->fromDouble(pvValueRecord,.04); convert->fromDouble(pvValueRecord,.04);
StructureConstPtr structure = pvCopy->getStructure(); StructureConstPtr structure = pvCopy->getStructure();
builder.clear(); structure->toString(&builder); cout << "structure from copy" << endl << *structure << endl;
cout << "structure from copy" << endl << builder << endl;
pvStructureCopy = pvCopy->createPVStructure(); pvStructureCopy = pvCopy->createPVStructure();
pvField = pvStructureCopy->getSubField(valueNameCopy); pvField = pvStructureCopy->getSubField(valueNameCopy);
pvValueCopy = static_pointer_cast<PVScalar>(pvField); pvValueCopy = static_pointer_cast<PVScalar>(pvField);
@ -107,51 +105,47 @@ static void testPVScalar(
convert->fromDouble(pvValueRecord,.06); convert->fromDouble(pvValueRecord,.06);
pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet); pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet);
cout << "after put(.06) pvValueCopy " << convert->toDouble(pvValueCopy); cout << "after put(.06) pvValueCopy " << convert->toDouble(pvValueCopy);
builder.clear(); cout << " bitSet " << *bitSet;
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
offset = pvCopy->getCopyOffset(pvValueRecord); offset = pvCopy->getCopyOffset(pvValueRecord);
cout << "getCopyOffset() " << offset; cout << "getCopyOffset() " << offset;
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset(); cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset(); cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
cout << " bitSet " << builder; cout << " bitSet " << *bitSet;
cout << endl; cout << endl;
bitSet->clear(); bitSet->clear();
convert->fromDouble(pvValueRecord,1.0); convert->fromDouble(pvValueRecord,1.0);
builder.clear();
bitSet->toString(&builder);
cout << "before updateCopyFromBitSet"; cout << "before updateCopyFromBitSet";
cout << " recordValue " << convert->toDouble(pvValueRecord); cout << " recordValue " << convert->toDouble(pvValueRecord);
cout << " copyValue " << convert->toDouble(pvValueCopy); cout << " copyValue " << convert->toDouble(pvValueCopy);
cout << " bitSet " << builder; cout << " bitSet " << *bitSet;
cout << endl; cout << endl;
bitSet->set(0); bitSet->set(0);
pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet); pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet);
cout << "after updateCopyFromBitSet"; cout << "after updateCopyFromBitSet";
cout << " recordValue " << convert->toDouble(pvValueRecord); cout << " recordValue " << convert->toDouble(pvValueRecord);
cout << " copyValue " << convert->toDouble(pvValueCopy); cout << " copyValue " << convert->toDouble(pvValueCopy);
cout << " bitSet " << builder; cout << " bitSet " << *bitSet;
cout << endl; cout << endl;
convert->fromDouble(pvValueCopy,2.0); convert->fromDouble(pvValueCopy,2.0);
bitSet->set(0); bitSet->set(0);
cout << "before updateMaster"; cout << "before updateMaster";
cout << " recordValue " << convert->toDouble(pvValueRecord); cout << " recordValue " << convert->toDouble(pvValueRecord);
cout << " copyValue " << convert->toDouble(pvValueCopy); cout << " copyValue " << convert->toDouble(pvValueCopy);
cout << " bitSet " << builder; cout << " bitSet " << *bitSet;
cout << endl; cout << endl;
pvCopy->updateMaster(pvStructureCopy,bitSet); pvCopy->updateMaster(pvStructureCopy,bitSet);
cout << "after updateMaster"; cout << "after updateMaster";
cout << " recordValue " << convert->toDouble(pvValueRecord); cout << " recordValue " << convert->toDouble(pvValueRecord);
cout << " copyValue " << convert->toDouble(pvValueCopy); cout << " copyValue " << convert->toDouble(pvValueCopy);
cout << " bitSet " << builder; cout << " bitSet " << *bitSet;
cout << endl; cout << endl;
} }
static void testPVScalarArray( static void testPVScalarArray(
ScalarType scalarType, ScalarType scalarType,
String const & valueNameRecord, string const & valueNameRecord,
String const & valueNameCopy, string const & valueNameCopy,
PVRecordPtr const & pvRecord, PVRecordPtr const & pvRecord,
PVCopyPtr const & pvCopy) PVCopyPtr const & pvCopy)
{ {
@ -160,7 +154,6 @@ static void testPVScalarArray(
PVScalarArrayPtr pvValueRecord; PVScalarArrayPtr pvValueRecord;
PVScalarArrayPtr pvValueCopy; PVScalarArrayPtr pvValueCopy;
BitSetPtr bitSet; BitSetPtr bitSet;
String builder;
size_t offset; size_t offset;
size_t n = 5; size_t n = 5;
shared_vector<double> values(n); shared_vector<double> values(n);
@ -171,60 +164,43 @@ static void testPVScalarArray(
const shared_vector<const double> xxx(freeze(values)); const shared_vector<const double> xxx(freeze(values));
pvValueRecord->putFrom(xxx); pvValueRecord->putFrom(xxx);
StructureConstPtr structure = pvCopy->getStructure(); StructureConstPtr structure = pvCopy->getStructure();
builder.clear(); structure->toString(&builder); cout << "structure from copy" << endl << *structure << endl;
cout << "structure from copy" << endl << builder << endl;
pvStructureCopy = pvCopy->createPVStructure(); pvStructureCopy = pvCopy->createPVStructure();
pvValueCopy = pvStructureCopy->getScalarArrayField(valueNameCopy,scalarType); pvValueCopy = pvStructureCopy->getScalarArrayField(valueNameCopy,scalarType);
bitSet = BitSetPtr(new BitSet(pvStructureCopy->getNumberFields())); bitSet = BitSetPtr(new BitSet(pvStructureCopy->getNumberFields()));
pvCopy->initCopy(pvStructureCopy, bitSet); pvCopy->initCopy(pvStructureCopy, bitSet);
builder.clear(); pvValueCopy->toString(&builder); cout << "after initCopy pvValueCopy " << *pvValueCopy << endl;
cout << "after initCopy pvValueCopy " << builder << endl;
cout << endl; cout << endl;
values.resize(n); values.resize(n);
for(size_t i=0; i<n; i++) values[i] = i + .06; for(size_t i=0; i<n; i++) values[i] = i + .06;
const shared_vector<const double> yyy(freeze(values)); const shared_vector<const double> yyy(freeze(values));
pvValueRecord->putFrom(yyy); pvValueRecord->putFrom(yyy);
pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet); pvCopy->updateCopySetBitSet(pvStructureCopy,bitSet);
builder.clear(); pvValueCopy->toString(&builder); cout << "after put(i+ .06) pvValueCopy " << *pvValueCopy << endl;
cout << "after put(i+ .06) pvValueCopy " << builder << endl; cout << " bitSet " << *bitSet;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
offset = pvCopy->getCopyOffset(pvValueRecord); offset = pvCopy->getCopyOffset(pvValueRecord);
cout << "getCopyOffset() " << offset; cout << "getCopyOffset() " << offset;
cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset(); cout << " pvValueCopy->getOffset() " << pvValueCopy->getFieldOffset();
cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset(); cout << " pvValueRecord->getOffset() " << pvValueRecord->getFieldOffset();
builder.clear(); cout << " bitSet " << *bitSet;
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
bitSet->clear(); bitSet->clear();
values.resize(n); values.resize(n);
for(size_t i=0; i<n; i++) values[i] = i + 1.0; for(size_t i=0; i<n; i++) values[i] = i + 1.0;
const shared_vector<const double> zzz(freeze(values)); const shared_vector<const double> zzz(freeze(values));
pvValueRecord->putFrom(zzz); pvValueRecord->putFrom(zzz);
builder.clear();
bitSet->toString(&builder);
cout << "before updateCopyFromBitSet"; cout << "before updateCopyFromBitSet";
builder.clear(); pvValueRecord->toString(&builder); cout << " recordValue " << *pvValueRecord << endl;
cout << " recordValue " << builder << endl; cout << " copyValue " << *pvValueCopy << endl;
builder.clear(); pvValueCopy->toString(&builder); cout << " bitSet " << *bitSet;
cout << " copyValue " << builder << endl;
cout << " bitSet " << builder;
builder.clear();
bitSet->toString(&builder);
cout << endl; cout << endl;
bitSet->set(0); bitSet->set(0);
pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet); pvCopy->updateCopyFromBitSet(pvStructureCopy,bitSet);
cout << "after updateCopyFromBitSet"; cout << "after updateCopyFromBitSet";
builder.clear(); pvValueRecord->toString(&builder); cout << " recordValue " << *pvValueRecord << endl;
cout << " recordValue " << builder << endl; cout << " copyValue " << *pvValueCopy << endl;
builder.clear(); pvValueCopy->toString(&builder); cout << " bitSet " << *bitSet;
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
values.resize(n); values.resize(n);
for(size_t i=0; i<n; i++) values[i] = i + 2.0; for(size_t i=0; i<n; i++) values[i] = i + 2.0;
@ -232,23 +208,15 @@ static void testPVScalarArray(
pvValueRecord->putFrom(ttt); pvValueRecord->putFrom(ttt);
bitSet->set(0); bitSet->set(0);
cout << "before updateMaster"; cout << "before updateMaster";
builder.clear(); pvValueRecord->toString(&builder); cout << " recordValue " << *pvValueRecord << endl;
cout << " recordValue " << builder << endl; cout << " copyValue " << *pvValueCopy << endl;
builder.clear(); pvValueCopy->toString(&builder); cout << " bitSet " << *bitSet;
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
pvCopy->updateMaster(pvStructureCopy,bitSet); pvCopy->updateMaster(pvStructureCopy,bitSet);
cout << "after updateMaster"; cout << "after updateMaster";
builder.clear(); pvValueRecord->toString(&builder); cout << " recordValue " << *pvValueRecord << endl;
cout << " recordValue " << builder << endl; cout << " copyValue " << *pvValueRecord << endl;
builder.clear(); pvValueCopy->toString(&builder); cout << " bitSet " << *bitSet;
cout << " copyValue " << builder << endl;
builder.clear();
bitSet->toString(&builder);
cout << " bitSet " << builder;
cout << endl; cout << endl;
} }
@ -257,12 +225,12 @@ static void scalarTest()
cout << endl << endl << "****scalarTest****" << endl; cout << endl << endl << "****scalarTest****" << endl;
RequesterPtr requester(new MyRequester("exampleTest")); RequesterPtr requester(new MyRequester("exampleTest"));
PVRecordPtr pvRecord; PVRecordPtr pvRecord;
String request; string request;
PVStructurePtr pvRequest; PVStructurePtr pvRequest;
PVCopyPtr pvCopy; PVCopyPtr pvCopy;
String builder; string builder;
String valueNameRecord; string valueNameRecord;
String valueNameCopy; string valueNameCopy;
pvRecord = createScalar("doubleRecord",pvDouble,"alarm,timeStamp,display"); pvRecord = createScalar("doubleRecord",pvDouble,"alarm,timeStamp,display");
valueNameRecord = request = "value"; valueNameRecord = request = "value";
@ -294,12 +262,12 @@ static void arrayTest()
cout << endl << endl << "****arrayTest****" << endl; cout << endl << endl << "****arrayTest****" << endl;
RequesterPtr requester(new MyRequester("exampleTest")); RequesterPtr requester(new MyRequester("exampleTest"));
PVRecordPtr pvRecord; PVRecordPtr pvRecord;
String request; string request;
PVStructurePtr pvRequest; PVStructurePtr pvRequest;
PVCopyPtr pvCopy; PVCopyPtr pvCopy;
String builder; string builder;
String valueNameRecord; string valueNameRecord;
String valueNameCopy; string valueNameCopy;
CreateRequest::shared_pointer createRequest = CreateRequest::create(); CreateRequest::shared_pointer createRequest = CreateRequest::create();
pvRecord = createScalarArray("doubleArrayRecord",pvDouble,"alarm,timeStamp"); pvRecord = createScalarArray("doubleArrayRecord",pvDouble,"alarm,timeStamp");
@ -331,12 +299,12 @@ static void powerSupplyTest()
cout << endl << endl << "****powerSupplyTest****" << endl; cout << endl << endl << "****powerSupplyTest****" << endl;
RequesterPtr requester(new MyRequester("exampleTest")); RequesterPtr requester(new MyRequester("exampleTest"));
PowerSupplyPtr pvRecord; PowerSupplyPtr pvRecord;
String request; string request;
PVStructurePtr pvRequest; PVStructurePtr pvRequest;
PVCopyPtr pvCopy; PVCopyPtr pvCopy;
String builder; string builder;
String valueNameRecord; string valueNameRecord;
String valueNameCopy; string valueNameCopy;
CreateRequest::shared_pointer createRequest = CreateRequest::create(); CreateRequest::shared_pointer createRequest = CreateRequest::create();
PVStructurePtr pv = createPowerSupply(); PVStructurePtr pv = createPowerSupply();

View File

@ -34,11 +34,12 @@ using namespace std;
using std::tr1::static_pointer_cast; using std::tr1::static_pointer_cast;
using namespace epics::pvData; using namespace epics::pvData;
using namespace epics::pvDatabase; using namespace epics::pvDatabase;
using std::string;
static PVRecordPtr createScalar( static PVRecordPtr createScalar(
String const & recordName, string const & recordName,
ScalarType scalarType, ScalarType scalarType,
String const & properties) string const & properties)
{ {
PVStructurePtr pvStructure = getStandardPVField()->scalar(scalarType,properties); PVStructurePtr pvStructure = getStandardPVField()->scalar(scalarType,properties);
PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure); PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
@ -47,9 +48,9 @@ static PVRecordPtr createScalar(
} }
static PVRecordPtr createScalarArray( static PVRecordPtr createScalarArray(
String const & recordName, string const & recordName,
ScalarType scalarType, ScalarType scalarType,
String const & properties) string const & properties)
{ {
PVStructurePtr pvStructure = getStandardPVField()->scalarArray(scalarType,properties); PVStructurePtr pvStructure = getStandardPVField()->scalarArray(scalarType,properties);
return PVRecord::create(recordName,pvStructure); return PVRecord::create(recordName,pvStructure);