Example #1
0
static void powerSupplyTest()
{
    if(debug) { cout << endl << endl << "****powerSupplyTest****" << endl; }
    PVStructurePtr pvMaster;
    string request;
    PVStructurePtr pvRequest;
    PVFieldPtr pvMasterField;
    PVCopyPtr pvCopy;
    string builder;
    string valueNameMaster;
    string valueNameCopy;

    CreateRequest::shared_pointer createRequest = CreateRequest::create();
    pvMaster = createPowerSupply();
    valueNameMaster = request = "power.value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
    request = "";
    valueNameMaster = "power.value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
    request = "alarm,timeStamp,voltage.value,power.value,current.value";
    valueNameMaster = "power.value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
    request = "alarm,timeStamp,voltage{value,alarm},power{value,alarm,display},current.value";
    valueNameMaster = "power.value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
}
static void powerSupplyTest()
{
    cout << endl << endl << "****powerSupplyTest****" << endl;
    RequesterPtr requester(new MyRequester("exampleTest"));
    PowerSupplyPtr pvRecord;
    string request;
    PVStructurePtr pvRequest;
    PVCopyPtr pvCopy;
    string builder;
    string valueNameRecord;
    string valueNameCopy;

    CreateRequest::shared_pointer createRequest = CreateRequest::create();
    PVStructurePtr pv = createPowerSupply();
    pvRecord = PowerSupply::create("powerSupply",pv);
    valueNameRecord = request = "power.value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    request = "";
    valueNameRecord = "power.value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    request = "alarm,timeStamp,voltage.value,power.value,current.value";
    valueNameRecord = "power.value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    request = "alarm,timeStamp,voltage{value,alarm},power{value,alarm,display},current.value";
    valueNameRecord = "power.value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "power.value";
    testPVScalar(valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    pvRecord->destroy();
}
Example #3
0
static void scalarTest()
{
    if(debug) { cout << endl << endl << "****scalarTest****" << endl; }
    PVStructurePtr pvMaster;
    string request;
    PVStructurePtr pvRequest;
    PVFieldPtr pvMasterField;
    PVCopyPtr pvCopy;
    string valueNameMaster;
    string valueNameCopy;

    StandardPVFieldPtr standardPVField = getStandardPVField();
    pvMaster = standardPVField->scalar(pvDouble,"alarm,timeStamp,display");
    
    valueNameMaster = request = "value";
    CreateRequest::shared_pointer createRequest = CreateRequest::create();
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
    request = "";
    valueNameMaster = "value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
    request = "alarm,timeStamp,value";
    valueNameMaster = "value";
    pvRequest = createRequest->createRequest(request);
    if(debug) { cout << "request " << request << endl; }
    if(debug) { cout << "pvRequest\n" << *pvRequest << endl; }
    pvCopy = PVCopy::create(pvMaster,pvRequest,"");
    valueNameCopy = "value";
    testPVScalar(valueNameMaster,valueNameCopy,pvMaster,pvCopy);
}
static void arrayTest()
{
    cout << endl << endl << "****arrayTest****" << endl;
    RequesterPtr requester(new MyRequester("exampleTest"));
    PVRecordPtr pvRecord;
    string request;
    PVStructurePtr pvRequest;
    PVCopyPtr pvCopy;
    string builder;
    string valueNameRecord;
    string valueNameCopy;

    CreateRequest::shared_pointer createRequest = CreateRequest::create();
    pvRecord = createScalarArray("doubleArrayRecord",pvDouble,"alarm,timeStamp");
    valueNameRecord = request = "value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "value";
    testPVScalarArray(pvDouble,valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    request = "";
    valueNameRecord = "value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "value";
    testPVScalarArray(pvDouble,valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    request = "alarm,timeStamp,value";
    valueNameRecord = "value";
    pvRequest = createRequest->createRequest(request);
    cout << "request " << request << endl << "pvRequest" << *pvRequest << endl ;
    pvCopy = PVCopy::create(pvRecord->getPVRecordStructure()->getPVStructure(),pvRequest,"");
    valueNameCopy = "value";
    testPVScalarArray(pvDouble,valueNameRecord,valueNameCopy,pvRecord,pvCopy);
    pvRecord->destroy();
}