当前位置: 首页>>代码示例>>C++>>正文


C++ PVDatabasePtr类代码示例

本文整理汇总了C++中PVDatabasePtr的典型用法代码示例。如果您正苦于以下问题:C++ PVDatabasePtr类的具体用法?C++ PVDatabasePtr怎么用?C++ PVDatabasePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PVDatabasePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc,char *argv[])
{
    PVDatabasePtr master = PVDatabase::getMaster();
    ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
    PVRecordPtr pvRecord;
    string recordName;

    recordName = "powerSupply";
    pvRecord = PowerSupplyRecord::create(recordName);
    master->addRecord(pvRecord);

    ServerContext::shared_pointer ctx =
        startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
    
    string str;
    while(true) {
        cout << "Type exit to stop: \n";
        getline(cin,str);
        if(str.compare("exit")==0) break;

    }
    ctx->destroy();
epicsThreadSleep(3.0); // should not be necessary
    return 0;
}
开发者ID:anjohnson,项目名称:exampleCPP,代码行数:25,代码来源:powerSupplyMain.cpp

示例2: main

int main(int argc,char *argv[])
{
    string provider("pva");
    if(argc>1) provider = argv[1];
    PVDatabasePtr master = PVDatabase::getMaster();
    NTScalarArrayBuilderPtr ntScalarArrayBuilder = NTScalarArray::createBuilder();
    PVStructurePtr pvStructure = ntScalarArrayBuilder->
        value(pvDouble)->
        addAlarm()->
        addTimeStamp()->
        createPVStructure();
    master->addRecord(PVRecord::create("doubleArray",pvStructure));
    ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
    if(provider=="pva") ClientFactory::start();
    ServerContext::shared_pointer ctx =
        startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
    ExampleLinkPtr pvRecord(
        ExampleLink::create(
           "exampleLink",provider,"doubleArray")); 
    master->addRecord(pvRecord);
    cout << "exampleLink\n";
    string str;
    while(true) {
        cout << "Type exit to stop: \n";
        getline(cin,str);
        if(str.compare("exit")==0) break;

    }
    ctx->destroy();
    epicsThreadSleep(3.0);
//    channelProvider->destroy();
//    if(provider=="pva") ClientFactory::stop();
//    epicsThreadSleep(3.0);
    return 0;
}
开发者ID:ralphlange,项目名称:exampleCPP,代码行数:35,代码来源:exampleLinkMain.cpp

示例3: main

int main(int argc,char *argv[])
{
    PVDatabasePtr master = PVDatabase::getMaster();
    PVRecordPtr pvRecord;
    bool result = false;
    string recordName;

    recordName = "exampleServer";
    pvRecord = ExampleServer::create(recordName);
    result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;

    recordName = "traceRecordPGRPC";
    pvRecord = TraceRecord::create(recordName);
    result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;

   
    ContextLocal::shared_pointer contextLocal = ContextLocal::create();
    contextLocal->start();

    PVStringArrayPtr pvNames = master->getRecordNames();
    shared_vector<const string> names = pvNames->view();
    for(size_t i=0; i<names.size(); ++i) cout << names[i] << endl;

    contextLocal->waitForExit();

    return 0;
}
开发者ID:epics-base,项目名称:pvExampleTestCPP,代码行数:29,代码来源:exampleServerMain.cpp

示例4: main

int main(int argc,char *argv[])
{
    string doubleArrayRecordName("doubleArray");
    if(argc==2 && string(argv[1])==string("-help")) {
        cout << "doubleArrayRecordName" << endl;
        cout << "default" << endl;
        cout << doubleArrayRecordName << endl;
        return 0;
    }
    if(argc>1) doubleArrayRecordName = argv[1];
    try {
        PVDatabasePtr master = PVDatabase::getMaster();
        ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
        NTScalarArrayBuilderPtr ntScalarArrayBuilder = NTScalarArray::createBuilder();
        PVStructurePtr pvStructure = ntScalarArrayBuilder->
            value(pvDouble)->
            addAlarm()->
            addTimeStamp()->
            createPVStructure();
        master->addRecord(PVRecord::create(doubleArrayRecordName,pvStructure));
        ServerContext::shared_pointer ctx =
            startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
        string str;
        while(true) {
            cout << "Type exit to stop: \n";
            getline(cin,str);
            if(str.compare("exit")==0) break;
        }
        ctx->destroy();
    } catch (std::runtime_error e) {
        cerr << "exception " << e.what() << endl;
        return 1;
    }
    return 0;
}
开发者ID:anjohnson,项目名称:exampleCPP,代码行数:35,代码来源:doubleArrayMain.cpp

示例5: main

int main(int argc,char *argv[])
{
    string provider("pva");
    string linkedRecordName("doubleArray");
    bool generateLinkedRecord(true);
    if(argc==2 && string(argv[1])==string("-help")) {
        cout << "provider  linkedRecordName generateLinkedRecord" << endl;
        cout << "default" << endl;
        cout << provider << " " << " " << linkedRecordName << " true" << endl;
        return 0;
    }
    if(argc>1) provider = argv[1];
    if(argc>2) linkedRecordName = argv[2];
    if(argc>3) {
        string val = argv[3];
        if(val=="false") generateLinkedRecord = false;
    }
    try {
        PVDatabasePtr master = PVDatabase::getMaster();
        ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
        PvaClientPtr pva= PvaClient::get(provider);
        ServerContext::shared_pointer ctx =
        startPVAServer("local",0,true,true);
        
        if(generateLinkedRecord) {
            NTScalarArrayBuilderPtr ntScalarArrayBuilder = NTScalarArray::createBuilder();
            PVStructurePtr pvStructure = ntScalarArrayBuilder->
                value(pvDouble)->
                addAlarm()->
                addTimeStamp()->
                createPVStructure();
            PVRecordPtr pvRecord(PVRecord::create(linkedRecordName,pvStructure));
            master->addRecord(pvRecord);
        }
        ExampleMonitorLinkRecordPtr pvMonitorRecord(
            ExampleMonitorLinkRecord::create(
                 pva, "exampleMonitorLink",provider,linkedRecordName));
        master->addRecord(pvMonitorRecord);
        ExampleGetLinkRecordPtr pvGetRecord(
            ExampleGetLinkRecord::create(
                 pva,"exampleGetLink",provider,linkedRecordName));
        master->addRecord(pvGetRecord);
        ExamplePutLinkRecordPtr pvPutRecord(
            ExamplePutLinkRecord::create(
                 pva,"examplePutLink",provider,linkedRecordName));
        master->addRecord(pvPutRecord);
        cout << "exampleMonitorLink\n";
        string str;
        while(true) {
            cout << "Type exit to stop: \n";
            getline(cin,str);
            if(str.compare("exit")==0) break;
        }
        ctx->destroy();
    } catch (std::runtime_error e) {
        cerr << "exception " << e.what() << endl;
        return 1;
    }
    return 0;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:60,代码来源:exampleLinkMain.cpp

示例6: NDPluginDriver

adPvaServer::adPvaServer(
    const string & portName,
    const string & imageName,
    int queueSize,
    int blockingCallbacks,
    const string & NDArrayPort,
    int NDArrayAddr,
    int maxbuffers,
    int maxmemory)
: NDPluginDriver(portName.c_str(), queueSize, blockingCallbacks, 
      NDArrayPort.c_str(), NDArrayAddr, 1, NUM_AD_IMAGE_SERVER_PARAMS,
      maxbuffers, maxmemory,
      0,  // interfaceMask
      0,  // interruptMask,
      ASYN_CANBLOCK,
      1,  // autoconnect
      0,  // priority
      0), // stack-size
  imageName(imageName)
{
    createParam("arrayPVName", asynParamOctet, &arrayPVName);

    setStringParam(NDPluginDriverPluginType, "EPICS V4 AD Image Server");
    setStringParam(arrayPVName, imageName.c_str());

    callParamCallbacks();
 
    PVDatabasePtr master = PVDatabase::getMaster();
    record = NDArrayRecord::create(imageName);
    bool result = master->addRecord(record);
    if(!result) std::cerr << "recordname" << " not added" << std::endl;

    connectToArrayPort();
}
开发者ID:dhickin,项目名称:ADPvAccess,代码行数:34,代码来源:adPvaServer.cpp

示例7: exampleRPCCallFunc

static void exampleRPCCallFunc(const iocshArgBuf *args)
{
    PVDatabasePtr master = PVDatabase::getMaster();
    char *recordName = args[0].sval;
    ExampleRPCPtr record = ExampleRPC::create(recordName);
    bool result = master->addRecord(record);
    if(!result) cout << "recordname" << " not added" << endl;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:8,代码来源:exampleRPCRegister.cpp

示例8: xx

PVDatabasePtr PVDatabase::getMaster()
{
    static PVDatabasePtr master;
    static Mutex mutex;
    Lock xx(mutex);
    if(master.get()==NULL) {
        master = PVDatabasePtr(new PVDatabase());
    }
    return master;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:10,代码来源:pvDatabase.cpp

示例9: doubleArrayCallFunc

static void doubleArrayCallFunc(const iocshArgBuf *args)
{
    string recordName("doubleArray");
    char *sval = args[0].sval;
    if(sval) recordName = string(sval);
    PVDatabasePtr master = PVDatabase::getMaster();
    NTScalarArrayBuilderPtr ntScalarArrayBuilder = NTScalarArray::createBuilder();
    PVStructurePtr pvStructure = ntScalarArrayBuilder->
                                 value(pvDouble)->
                                 addAlarm()->
                                 addTimeStamp()->
                                 createPVStructure();
    bool result = master->addRecord(PVRecord::create(recordName,pvStructure));
    if(!result) cout<< "record " << recordName << " not added" << endl;
}
开发者ID:dhickin,项目名称:exampleCPP,代码行数:15,代码来源:doubleArrayRegister.cpp

示例10: createDumbPowerSupplyRecord

static void createDumbPowerSupplyRecord(
    PVDatabasePtr const &master,
    string const &recordName)
{
     StructureConstPtr top = fieldCreate->createFieldBuilder()->
         add("alarm",standardField->alarm()) ->
            add("timeStamp",standardField->timeStamp()) ->
            addNestedStructure("power") ->
               add("value",pvDouble) ->
               add("alarm",standardField->alarm()) ->
               endNested()->
            addNestedStructure("voltage") ->
               add("value",pvDouble) ->
               add("alarm",standardField->alarm()) ->
               endNested()->
            addNestedStructure("current") ->
               add("value",pvDouble) ->
               add("alarm",standardField->alarm()) ->
               endNested()->
            createStructure();
    PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    bool result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;
}
开发者ID:epics-base,项目名称:pvaClientTestCPP,代码行数:25,代码来源:exampleDatabase.cpp

示例11: createRecords

static void createRecords(
    PVDatabasePtr const &master,
    ScalarType scalarType,
    string const &recordNamePrefix,
    string const &properties)
{
    string recordName = recordNamePrefix;
    PVStructurePtr pvStructure = standardPVField->scalar(scalarType,properties);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    bool result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;
    recordName += "Array";
    pvStructure = standardPVField->scalarArray(scalarType,properties);
    pvRecord = PVRecord::create(recordName,pvStructure);
    result = master->addRecord(pvRecord);
}
开发者ID:epics-base,项目名称:pvaClientTestCPP,代码行数:16,代码来源:exampleDatabase.cpp

示例12: exampleServerCallFunc

static void exampleServerCallFunc(const iocshArgBuf *args)
{
    PVDatabasePtr master = PVDatabase::getMaster();
    char *recordName = args[0].sval;
    ExampleServerPtr record = ExampleServer::create(recordName);
    bool result = master->addRecord(record);
    if(!result) cout << "recordname" << " not added" << endl;
    PVRecordPtr pvRecord = TraceRecord::create(
        "laptopTraceRecordPGRPC");
    if(!pvRecord) {
          cout << "TraceRecord::create failed" << endl;
    } else {
        result = master->addRecord(pvRecord);
        if(!result) cout<< "record " << recordName << " not added" << endl;
    }
}
开发者ID:epics-base,项目名称:pvExampleTestCPP,代码行数:16,代码来源:exampleServerRegister.cpp

示例13: createVariantUnionRecord

static void createVariantUnionRecord(
    PVDatabasePtr const &master,
    string const &recordName)
{
    StructureConstPtr top = fieldCreate->createFieldBuilder()->
         add("value",fieldCreate->createVariantUnion())->
         createStructure();
    PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    bool result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;
}
开发者ID:epics-base,项目名称:pvaClientTestCPP,代码行数:12,代码来源:exampleDatabase.cpp

示例14: main

int main(int argc,char *argv[])
{
    PVDatabasePtr master = PVDatabase::getMaster();
    ChannelProviderLocalPtr channelProvider = getChannelProviderLocal();
    ExampleDatabase::create();
    ServerContext::shared_pointer ctx =
        startPVAServer(PVACCESS_ALL_PROVIDERS,0,true,true);
    cout << "exampleDatabase\n";
    PVStringArrayPtr pvNames = master->getRecordNames();
    cout << "recordNames" << endl << *pvNames << endl;
    string str;
    while(true) {
        cout << "Type exit to stop: \n";
        getline(cin,str);
        if(str.compare("exit")==0) break;

    }
    ctx->destroy();
    epicsThreadSleep(1.0);
    channelProvider->destroy();
    return 0;
}
开发者ID:epics-base,项目名称:pvaClientTestCPP,代码行数:22,代码来源:exampleDatabaseMain.cpp

示例15: createRegularUnionArrayRecord

static void createRegularUnionArrayRecord(
    PVDatabasePtr const &master,
    string const &recordName)
{
    StructureConstPtr top = fieldCreate->createFieldBuilder()->
         addNestedUnionArray("value")->
             add("string",pvString)->
             addArray("stringArray",pvString)->
             endNested()->
         createStructure();
    PVStructurePtr pvStructure = pvDataCreate->createPVStructure(top);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    bool result = master->addRecord(pvRecord);
    if(!result) cout<< "record " << recordName << " not added" << endl;
}
开发者ID:epics-base,项目名称:pvaClientTestCPP,代码行数:15,代码来源:exampleDatabase.cpp


注:本文中的PVDatabasePtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。