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


C++ PVStructurePtr类代码示例

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


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

示例1: getPVStructure

string PvaClientData::getString()
{
    if(PvaClient::getDebug()) cout << "PvaClientData::getString\n";
    PVScalarPtr pvScalar;
    PVStructurePtr pvStructure = getPVStructure();
    PVFieldPtr pvValue  = pvStructure->getSubField("value");
    if(pvValue) {
        Type type = pvValue->getField()->getType();
        if(type==scalar) pvScalar = static_pointer_cast<PVScalar>(pvValue);
    }
    if(!pvScalar) {
        while(true) {
             const PVFieldPtrArray fieldPtrArray(pvStructure->getPVFields());
             if(fieldPtrArray.size()!=1) {
                  throw std::logic_error(
                      "PvaClientData::getString() pvRequest for multiple fields");
             }
             PVFieldPtr pvField(fieldPtrArray[0]);
             Type type = pvField->getField()->getType();
             if(type==scalar) {
                 pvScalar = static_pointer_cast<PVScalar>(pvField);
                 break;
             }
             if(pvField->getField()->getType()!=epics::pvData::structure) break;
             pvStructure = static_pointer_cast<PVStructure>(pvField);
        }
    }
    if(!pvScalar) {
        throw std::logic_error(
            "PvaClientData::getString() did not find a scalar field");
    }
    return convert->toString(pvScalar);
}
开发者ID:epics-base,项目名称:pvaClientCPP,代码行数:33,代码来源:pvaClientData.cpp

示例2: dimVector

void NTNDArrayRecord::setDimension(const int32_t * dims, size_t ndims)
{
    // Get the dimension field
    PVStructureArrayPtr dimField = ndarray->getDimension();

    // create a shared_vector or try to reuse the dimension field's one  
    PVStructureArray::svector dimVector(dimField->reuse());
    // resize/reserve the number of elements
    dimVector.resize(ndims);
    // Iterate over the number of dimensions, creating and adding the
    // appropriate dimension structures.
    for (size_t i = 0; i < ndims; i++)
    {
        PVStructurePtr d = dimVector[i];
        if (!d || !d.unique())
            d = dimVector[i] = getPVDataCreate()->createPVStructure(dimField->getStructureArray()->getStructure());
        d->getSubField<PVInt>("size")->put(dims[i]);
        d->getSubField<PVInt>("offset")->put(0);
        d->getSubField<PVInt>("fullSize")->put(dims[i]);
        d->getSubField<PVInt>("binning")->put(1);
        d->getSubField<PVBoolean>("reverse")->put(false);
    }
    // replace the dimensions field's shared_vector
    // (Remember to freeze first)
    dimField->replace(freeze(dimVector));
}
开发者ID:mrkraimer,项目名称:pvDataWWW,代码行数:26,代码来源:ntndarrayServer.cpp

示例3: xx

void PvaClientPut::getDone(
    const Status& status,
    ChannelPut::shared_pointer const & channelPut,
    PVStructurePtr const & pvStructure,
    BitSetPtr const & bitSet)
{
    if(PvaClient::getDebug()) {
        cout << "PvaClientPut::getDone"
           << " channelName " << pvaClientChannel->getChannel()->getChannelName()
           << " status.isOK " << (status.isOK() ? "true" : "false")
           << endl;
    }
    {
        Lock xx(mutex);
        channelGetPutStatus = status;
        if(status.isOK()) {
            PVStructurePtr pvs = pvaClientData->getPVStructure();
            pvs->copyUnchecked(*pvStructure,*bitSet);
            BitSetPtr bs = pvaClientData->getChangedBitSet();
            bs->clear();
            *bs |= *bitSet;
            putState = putComplete;
        }
    }
    PvaClientPutRequesterPtr  req(pvaClientPutRequester.lock());
    if(req) {
          req->getDone(status,shared_from_this());
    }
    waitForGetPut.signal();
}
开发者ID:epics-base,项目名称:pvaClientCPP,代码行数:30,代码来源:pvaClientPut.cpp

示例4: putBitSet

void ChannelPutGetLocal::getPut()
{
    ChannelPutGetRequester::shared_pointer requester = channelPutGetRequester.lock();
    if(!requester) return;
    if(isDestroyed) {
         requester->getPutDone(
              channelDestroyedStatus,getPtrSelf(),nullPVStructure,nullBitSet);
         return;
    } 
    try {
        PVStructurePtr pvPutStructure = pvPutCopy->createPVStructure();
        BitSetPtr putBitSet(new BitSet(pvPutStructure->getNumberFields()));
        {
            epicsGuard <PVRecord> guard(*pvRecord);
            pvPutCopy->initCopy(pvPutStructure, putBitSet);
        }
        requester->getPutDone(
            Status::Ok,getPtrSelf(),pvPutStructure,putBitSet);
        if(pvRecord->getTraceLevel()>1)
        {
            cout << "ChannelPutGetLocal::getPut" << endl;
        }
    } catch(std::exception& ex) {
        Status status = Status(Status::STATUSTYPE_FATAL, ex.what());
        PVStructurePtr pvPutStructure;
        BitSetPtr putBitSet;
        requester->getPutDone(status,getPtrSelf(),pvGetStructure,getBitSet);
    }
}
开发者ID:mrkraimer,项目名称:pvDatabaseCPP,代码行数:29,代码来源:channelLocal.cpp

示例5: findSubField

static PVFieldPtr findSubField(
    String const & fieldName,
    PVStructure const *pvStructure)
{
    if( fieldName.length()<1) return PVFieldPtr();
    String::size_type index = fieldName.find('.');
    String name = fieldName;
    String restOfName = String();
    if(index>0) {
        name = fieldName.substr(0, index);
        if(fieldName.length()>index) {
            restOfName = fieldName.substr(index+1);
        }
    }
    PVFieldPtrArray  pvFields = pvStructure->getPVFields();
    PVFieldPtr pvField;
    size_t numFields = pvStructure->getStructure()->getNumberFields();
    for(size_t i=0; i<numFields; i++) {
        pvField = pvFields[i];
        size_t result = pvField->getFieldName().compare(name);
        if(result==0) {
            if(restOfName.length()==0) return pvFields[i];
            if(pvField->getField()->getType()!=structure) return PVFieldPtr();
            PVStructurePtr pvStructure =
                std::tr1::static_pointer_cast<PVStructure>(pvField);
            return findSubField(restOfName,pvStructure.get());
        }
    }
    return PVFieldPtr();
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例6: test_wrap

void test_wrap()
{
    testDiag("test_wrap");

    NTMultiChannelPtr nullPtr = NTMultiChannel::wrap(PVStructurePtr());
    testOk(nullPtr.get() == 0, "nullptr wrap");

    nullPtr = NTMultiChannel::wrap(
                getPVDataCreate()->createPVStructure(
                    NTField::get()->createTimeStamp()
                    )
                );
    testOk(nullPtr.get() == 0, "wrong type wrap");


    NTMultiChannelBuilderPtr builder = NTMultiChannel::createBuilder();
    testOk(builder.get() != 0, "Got builder");

    PVStructurePtr pvStructure = builder->
            createPVStructure();
    testOk1(pvStructure.get() != 0);
    if (!pvStructure)
        return;

    NTMultiChannelPtr ptr = NTMultiChannel::wrap(pvStructure);
    testOk(ptr.get() != 0, "wrap OK");

    builder = NTMultiChannel::createBuilder();
    ptr = NTMultiChannel::wrapUnsafe(pvStructure);
    testOk(ptr.get() != 0, "wrapUnsafe OK");
}
开发者ID:mdavidsaver,项目名称:normativeTypesCPP,代码行数:31,代码来源:ntmultiChannelTest.cpp

示例7: getFieldOffset

void PVStructure::deserialize(ByteBuffer *pbuffer,
        DeserializableControl *pcontrol, BitSet *pbitSet) {
    size_t offset = getFieldOffset();
    size_t numberFields = getNumberFields();
    int32 next = pbitSet->nextSetBit(offset);

    // no more changes or no changes in this structure
    if(next<0||next>=static_cast<int32>(offset+numberFields)) return;

    // entire structure
    if(static_cast<int32>(offset)==next) {
        deserialize(pbuffer, pcontrol);
        return;
    }

    size_t fieldsSize = pvFields.size();
    for(size_t i = 0; i<fieldsSize; i++) {
        PVFieldPtr pvField = pvFields[i];
        offset = pvField->getFieldOffset();
        int32 inumberFields = pvField->getNumberFields();
        next = pbitSet->nextSetBit(offset);
        // no more changes
        if(next<0) return;
        //  no change in this pvField
        if(next>=static_cast<int32>(offset+inumberFields)) continue;

        // deserialize field or fields
        if(inumberFields==1) {
            pvField->deserialize(pbuffer, pcontrol);
        } else {
            PVStructurePtr pvStructure = std::tr1::static_pointer_cast<PVStructure>(pvField);
            pvStructure->deserialize(pbuffer, pcontrol, pbitSet);
        }
    }
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例8: test_wrap

void test_wrap()
{
    testDiag("test_wrap");

    NTTablePtr nullPtr = NTTable::wrap(PVStructurePtr());
    testOk(nullPtr.get() == 0, "nullptr wrap");

    nullPtr = NTTable::wrap(
                getPVDataCreate()->createPVStructure(
                    NTField::get()->createTimeStamp()
                    )
                );
    testOk(nullPtr.get() == 0, "wrong type wrap");


    NTTableBuilderPtr builder = NTTable::createBuilder();
    testOk(builder.get() != 0, "Got builder");

    PVStructurePtr pvStructure = builder->
            addColumn("column0", pvDouble)->
            addColumn("column1", pvString)->
            addColumn("column2", pvInt)->
            createPVStructure();
    testOk1(pvStructure.get() != 0);
    if (!pvStructure)
        return;

    NTTablePtr ptr = NTTable::wrap(pvStructure);
    testOk(ptr.get() != 0, "wrap OK");

    ptr = NTTable::wrapUnsafe(pvStructure);
    testOk(ptr.get() != 0, "wrapUnsafe OK");
}
开发者ID:mdavidsaver,项目名称:normativeTypesCPP,代码行数:33,代码来源:nttableTest.cpp

示例9: test_labels

void test_labels()
{
    testDiag("test_labels");

    NTTableBuilderPtr builder = NTTable::createBuilder();
    testOk(builder.get() != 0, "Got builder");

    PVStructurePtr pvStructure = builder->
            addColumn("column0", pvDouble)->
            addColumn("column1", pvString)->
            addColumn("column2", pvInt)->
            createPVStructure();
    testOk1(pvStructure.get() != 0);
    if (!pvStructure)
        return;

    testOk1(NTTable::isCompatible(pvStructure)==true);
    std::cout << *pvStructure << std::endl;

    PVStringArrayPtr labels = pvStructure->getSubField<PVStringArray>("labels");
    testOk1(labels.get() != 0);
    testOk1(labels->getLength() == 3);

    PVStringArray::const_svector l(labels->view());
    testOk1(l[0] == "column0");
    testOk1(l[1] == "column1");
    testOk1(l[2] == "column2");
}
开发者ID:mdavidsaver,项目名称:normativeTypesCPP,代码行数:28,代码来源:nttableTest.cpp

示例10: test_wrap

void test_wrap()
{
    testDiag("test_wrap");

    NTScalarArrayPtr nullPtr = NTScalarArray::wrap(PVStructurePtr());
    testOk(nullPtr.get() == 0, "nullptr wrap");

    nullPtr = NTScalarArray::wrap(
                getPVDataCreate()->createPVStructure(
                    NTField::get()->createTimeStamp()
                    )
                );
    testOk(nullPtr.get() == 0, "wrong type wrap");


    NTScalarArrayBuilderPtr builder = NTScalarArray::createBuilder();
    testOk(builder.get() != 0, "Got builder");

    PVStructurePtr pvStructure = builder->
            value(pvDouble)->
            createPVStructure();
    testOk1(pvStructure.get() != 0);
    if (!pvStructure)
        return;

    testOk1(NTScalarArray::isCompatible(pvStructure)==true);
    NTScalarArrayPtr ptr = NTScalarArray::wrap(pvStructure);
    testOk(ptr.get() != 0, "wrap OK");

    ptr = NTScalarArray::wrapUnsafe(pvStructure);
    testOk(ptr.get() != 0, "wrapUnsafe OK");
}
开发者ID:mdavidsaver,项目名称:normativeTypesCPP,代码行数:32,代码来源:ntscalarArrayTest.cpp

示例11: createScalar

static PVRecordPtr createScalar(
    string const & recordName,
    ScalarType scalarType,
    string const & properties)
{
    PVStructurePtr pvStructure = getStandardPVField()->scalar(scalarType,properties);
    PVRecordPtr pvRecord = PVRecord::create(recordName,pvStructure);
    pvStructure.reset();
    return pvRecord;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:10,代码来源:testPVRecord.cpp

示例12: isCompatible

bool NTMultiChannel::isCompatible(PVStructurePtr const &pvStructure)
{
    if(!pvStructure) return false;
    PVUnionArrayPtr pvValue = pvStructure->getSubField<PVUnionArray>("value");
    if(!pvValue) return false;
    PVFieldPtr pvField = pvStructure->getSubField("descriptor");
    if(pvField && !pvStructure->getSubField<PVString>("descriptor")) return false;
    pvField = pvStructure->getSubField("alarm");
    if(pvField && !ntField->isAlarm(pvField->getField())) return false;
    pvField = pvStructure->getSubField("timeStamp");
    if(pvField && !ntField->isTimeStamp(pvField->getField())) return false;
    pvField = pvStructure->getSubField("severity");
    if(pvField && !pvStructure->getSubField<PVIntArray>("severity")) return false;
    pvField = pvStructure->getSubField("status");
    if(pvField && !pvStructure->getSubField<PVIntArray>("status")) return false;
    pvField = pvStructure->getSubField("message");
    if(pvField && !pvStructure->getSubField<PVStringArray>("message")) return false;
    pvField = pvStructure->getSubField("secondsPastEpoch");
    if(pvField && !pvStructure->getSubField<PVLongArray>("secondsPastEpoch")) return false;
    pvField = pvStructure->getSubField("nanoseconds");
    if(pvField && !pvStructure->getSubField<PVIntArray>("nanoseconds")) return false;
    pvField = pvStructure->getSubField("userTag");
    if(pvField && !pvStructure->getSubField<PVIntArray>("userTag")) return false;
    return true;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:25,代码来源:ntmultiChannel.cpp

示例13: isCompatible

bool NTTable::isCompatible(PVStructurePtr const & pvStructure)
{
    if(!pvStructure) return false;
    PVFieldPtr pvField = pvStructure->getSubField("alarm");
    if(pvField && !ntField->isAlarm(pvField->getField())) return false;
    pvField = pvStructure->getSubField("timeStamp");
    if(pvField && !ntField->isTimeStamp(pvField->getField())) return false;
    PVStringArrayPtr pvLabel = pvStructure->getSubField<PVStringArray>("labels");
    if(!pvLabel) return false;
    return true;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:11,代码来源:nttable.cpp

示例14: checkBitSetPVField

static bool checkBitSetPVField(
    PVFieldPtr const &pvField,BitSetPtr const &bitSet,int32 initialOffset)
{
    int32 offset = initialOffset;
    int32 nbits = static_cast<int32>(pvField->getNumberFields());
    if(nbits==1) return bitSet->get(offset);
    int32 nextSetBit = bitSet->nextSetBit(offset);
    if(nextSetBit>=(offset+nbits)) return false;
    if(nextSetBit<0) return false;
    if(bitSet->get(offset)) {
        if(nbits>1) {
            for(int32 i=offset+1; i<offset+nbits; i++) bitSet->clear(i);
        }
        return true;
    }

    bool atLeastOneBitSet = false;
    bool allBitsSet = true;
    PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
    offset = static_cast<int32>(pvStructure->getFieldOffset()) + 1;
    while(offset<initialOffset + nbits) {
        PVFieldPtr pvSubField = pvStructure->getSubField(offset);
        int32 nbitsNow = static_cast<int32>(pvSubField->getNumberFields());
        if(nbitsNow==1) {
            if(bitSet->get(offset)) {
                atLeastOneBitSet = true;
            } else {
                allBitsSet = false;
            }
            offset++;
        } else {
            bool result = checkBitSetPVField(pvSubField,bitSet,offset);
            if(result) {
                atLeastOneBitSet = true;
                if(!bitSet->get(offset)) {
                    allBitsSet = false;
                }
            } else {
                allBitsSet = false;
            }
            offset += static_cast<int32>(pvSubField->getNumberFields());
        }
    }
    if(allBitsSet) {
        if(nbits>1) {
            for(int32 i=initialOffset+1; i<initialOffset+nbits; i++) {
                bitSet->clear(i);
            }
        }
        bitSet->set(initialOffset);
    }
    return atLeastOneBitSet;
}
开发者ID:ncanestrari,项目名称:EPICS-EPICS_V4,代码行数:53,代码来源:bitSetUtil.cpp

示例15: testDeserializeStructureAndCreatePVStructure

void testDeserializeStructureAndCreatePVStructure()
{
	buffer->clear();
	registry->reset();
	StructureConstPtr structureIn = getStructure("structure1");
	serialize(structureIn,registry);

	buffer->flip();
	PVStructurePtr pvStructureOut = registry->deserializeStructureAndCreatePVStructure(buffer,control);
	StructureConstPtr structureOut = pvStructureOut->getStructure();
	assert(structureIn->getFieldName() == structureOut->getFieldName());
	assert(structureIn->getType() == structureOut->getType());
	delete pvStructureOut;
}
开发者ID:,项目名称:,代码行数:14,代码来源:


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