/** * Copyright - See the COPYRIGHT that is included with this distribution. * pvAccessCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #include #include #include #include #include #if !defined(_WIN32) #include #define USE_SIGNAL #endif #include #include #include #include //! [Headers] #include #include #include #include //! [Headers] namespace pvd = epics::pvData; namespace pva = epics::pvAccess; namespace { typedef epicsGuard Guard; typedef epicsGuardRelease UnGuard; epicsMutex mutex; epicsEvent done; size_t waitingFor; #ifdef USE_SIGNAL void alldone(int num) { (void)num; done.signal(); } #endif struct PutTracker : public TestClientChannel::PutCallback { POINTER_DEFINITIONS(PutTracker); TestOperation op; const std::string value; PutTracker(TestClientChannel& channel, const pvd::PVStructure::const_shared_pointer& pvReq, const std::string& value) :op(channel.put(this, pvReq)) // put() starts here ,value(value) {} virtual ~PutTracker() { op.cancel(); } virtual pvd::PVStructure::const_shared_pointer putBuild(const epics::pvData::StructureConstPtr &build) { pvd::PVStructurePtr root(pvd::getPVDataCreate()->createPVStructure(build)); pvd::PVScalarPtr valfld(root->getSubFieldT("value")); valfld->putFrom(value); std::cout<<"Put value "<] [-w ] [-r ] pvname=value ...\n"; } std::string strip(const std::string& inp) { size_t f=inp.find_first_not_of(" \t\n\r"), l=inp.find_last_not_of (" \t\n\r"); if(f==inp.npos || f>l) throw std::invalid_argument("Empty string"); return inp.substr(f, l-f+1); } } // namespace int main(int argc, char *argv[]) { try { double waitTime = 5.0; std::string providerName("pva"), request("field()"); int opt; while( (opt=getopt(argc, argv, "hP:w:r:"))!=-1) { switch(opt) { case 'P': providerName = optarg; break; case 'w': waitTime = pvd::castUnsafe(optarg); break; case 'r': request = optarg; break; default: std::cerr<<"Unknown argument "< > args_t; args_t args; for(int i=optind; i