moved CreateRequest to pvDataCPP
This commit is contained in:
1 parent
2f5f6328db
commit
4405346384
4 files changed
+1
-167
No files matched your search
@@ -34,7 +34,6 @@ LIBSRCS += pvAccess.cpp
|
||||
|
||||
SRC_DIRS += $(PVACCESS)/factory
|
||||
LIBSRCS += ChannelAccessFactory.cpp
|
||||
LIBSRCS += CreateRequestFactory.cpp
|
||||
|
||||
SRC_DIRS += $(PVACCESS)/remote
|
||||
INC += remote.h
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#endif
|
||||
|
||||
#include <pv/pvData.h>
|
||||
#include <pv/createRequest.h>
|
||||
#include <pv/status.h>
|
||||
#include <pv/destroyable.h>
|
||||
#include <pv/monitor.h>
|
||||
@@ -802,36 +803,6 @@ namespace pvAccess {
|
||||
epicsShareExtern void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory);
|
||||
epicsShareExtern void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory);
|
||||
|
||||
/**
|
||||
* Interface for creating request structure.
|
||||
*/
|
||||
class epicsShareClass CreateRequest {
|
||||
public:
|
||||
POINTER_DEFINITIONS(CreateRequest);
|
||||
static CreateRequest::shared_pointer create();
|
||||
virtual ~CreateRequest() {};
|
||||
|
||||
/**
|
||||
* Create a request structure for the create calls in Channel.
|
||||
* See the package overview documentation for details.
|
||||
* @param request The field request. See the package overview documentation for details.
|
||||
* @param requester The requester;
|
||||
* @return The request PVStructure if a valid request was given.
|
||||
* If a NULL PVStructure is returned then getMessage will return
|
||||
* the reason.
|
||||
*/
|
||||
virtual epics::pvData::PVStructure::shared_pointer createRequest(
|
||||
epics::pvData::String const & request) = 0;
|
||||
/**
|
||||
* Get the error message of createRequest returns NULL;
|
||||
* @return the error message
|
||||
*/
|
||||
epics::pvData::String getMessage() {return message;}
|
||||
protected:
|
||||
CreateRequest() {}
|
||||
epics::pvData::String message;
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -6,10 +6,6 @@ include $(TOP)/configure/CONFIG
|
||||
testChannelAccessFactory_SRCS = testChannelAccessFactory.cpp
|
||||
testChannelAccessFactory_LIBS = pvAccess pvData Com
|
||||
|
||||
PROD_HOST += testCreateRequest
|
||||
testCreateRequest_SRCS = testCreateRequest.cpp
|
||||
testCreateRequest_LIBS = pvAccess pvData pvMB Com
|
||||
|
||||
#PROD_HOST += testMockClient
|
||||
testMockClient_SRCS = testMockClient.cpp MockClientImpl.cpp
|
||||
testMockClient_LIBS = pvAccess pvData Com
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
/* testCreateRequest.cpp */
|
||||
/* Author: Matej Sekoranja Date: 2010.12.27 */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <pv/pvAccess.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <epicsAssert.h>
|
||||
#include <epicsExit.h>
|
||||
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
|
||||
|
||||
void testCreateRequest() {
|
||||
printf("testCreateRequest... \n");
|
||||
CreateRequest::shared_pointer createRequest = CreateRequest::create();
|
||||
|
||||
String out;
|
||||
String request = "";
|
||||
std::cout << std::endl << String("request") <<std::endl << request <<std::endl;
|
||||
PVStructurePtr pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "record[process=true] field(alarm , timeStamp) putField( synput:a,synput:b,stnput:c)";
|
||||
std::cout << std::endl << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
|
||||
request = "alarm,timeStamp,power.value";
|
||||
std::cout << std::endl << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "record[process=true]field(alarm,timeStamp,power.value)";
|
||||
std::cout << std::endl << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "record[process=true]field(alarm,timeStamp[algorithm=onChange,causeMonitor=false],power{value,alarm})";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "record[process=true,xxx=yyy]field(alarm,timeStamp[shareData=true],power.value)";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = String("record[process=true,xxx=yyy]")
|
||||
+ "putField(power.value)"
|
||||
+ "getField(alarm,timeStamp,power{value,alarm},"
|
||||
+ "current{value,alarm},voltage{value,alarm})";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = String("field(alarm,timeStamp,supply{")
|
||||
+ "0{voltage.value,current.value,power.value},"
|
||||
+ "1{voltage.value,current.value,power.value}"
|
||||
+ "})";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = String("record[process=true,xxx=yyy]")
|
||||
+ "putField(power.value)"
|
||||
+ "getField(alarm,timeStamp,power{value,alarm},"
|
||||
+ "current{value,alarm},voltage{value,alarm},"
|
||||
+ "ps0{alarm,timeStamp,power{value,alarm},current{value,alarm},voltage{value,alarm}},"
|
||||
+ "ps1{alarm,timeStamp,power{value,alarm},current{value,alarm},voltage{value,alarm}}"
|
||||
+ ")";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "a{b{c{d}}}";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get());
|
||||
out.clear(); pvRequest->toString(&out); std::cout << out << std::endl;
|
||||
|
||||
request = "record[process=true,xxx=yyy]field(alarm,timeStamp[shareData=true],power.value";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
std::cout << std::endl << "Error Expected for next call!!" << std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get()==NULL);
|
||||
std::cout << "reason " << createRequest->getMessage() << std::endl;
|
||||
request = String("record[process=true,xxx=yyy]")
|
||||
+ "putField(power.value)"
|
||||
+ "getField(alarm,timeStamp,power{value,alarm},"
|
||||
+ "current{value,alarm},voltage{value,alarm},"
|
||||
+ "ps0{alarm,timeStamp,power{value,alarm},current{value,alarm},voltage{value,alarm}},"
|
||||
+ "ps1{alarm,timeStamp,power{value,alarm},current{value,alarm},voltage{value,alarm}"
|
||||
+ ")";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
std::cout << std::endl << "Error Expected for next call!!" << std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get()==NULL);
|
||||
std::cout << "reason " << createRequest->getMessage() << std::endl;
|
||||
request = "record[process=true,power.value";
|
||||
std::cout << String("request") <<std::endl << request <<std::endl;
|
||||
std::cout << std::endl << "Error Expected for next call!!" << std::endl;
|
||||
pvRequest = createRequest->createRequest(request);
|
||||
assert(pvRequest.get()==NULL);
|
||||
std::cout << "reason " << createRequest->getMessage() << std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
testCreateRequest();
|
||||
|
||||
//std::cout << "-----------------------------------------------------------------------" << std::endl;
|
||||
//epicsExitCallAtExits();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user