本文整理汇总了C++中StructureConstPtr::getFieldIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ StructureConstPtr::getFieldIndex方法的具体用法?C++ StructureConstPtr::getFieldIndex怎么用?C++ StructureConstPtr::getFieldIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StructureConstPtr
的用法示例。
在下文中一共展示了StructureConstPtr::getFieldIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
void RecordProcess::initialize()
{
pvRecord.lock();
try {
if(trace) traceMessage(" initialize");
PVRecordStructure &pvRecordStructure = pvRecord.getPVRecordStructure();
PVStructure &pvStructure = pvRecordStructure.getPVStructure();
fieldSupport = const_cast<Support *>(pvRecordStructure.getSupport());
if(fieldSupport==0) {
throw std::logic_error(pvRecord.getRecordName() + " has no support");
}
PVFieldPtrArray pvFields = pvStructure.getPVFields();
PVRecordFieldPtrArray pvRecordFields =
pvRecordStructure.getPVRecordFields();
StructureConstPtr structure = pvStructure.getStructure();
int index;
index = structure->getFieldIndex("timeStamp");
if(index>=0) {
pvTimeStamp.attach(pvFields[index]);
}
index = structure->getFieldIndex("scan");
if(index>=0) {
scanSupport = pvRecordFields[index]->getSupport();
scanField = ScanField::create(pvRecord);
if(scanField.get()!=0) {
pvSingleProcessRequester =
&scanField->getSingleProcessRequesterPV();
pvRecordFieldSingleProcessRequester =
&pvRecord.findPVRecordField(*pvSingleProcessRequester);
pvProcessAfterStart = &scanField->getProcessAfterStartPV();
}
}
fieldSupport->initialize();
pvRecord.unlock();
} catch(...) {
pvRecord.unlock();
throw;
}
}
示例2: fixParentStructure
void PVStructure::fixParentStructure()
{
PVStructure *parent = getParent();
if(parent==NULL) return;
StructureConstPtr parentStructure = parent->structurePtr;
String fieldName = getFieldName();
size_t index = parentStructure->getFieldIndex(fieldName);
StringArray const &fieldNames = parentStructure->getFieldNames();
size_t num = fieldNames.size();
FieldConstPtrArray fields(num);
FieldConstPtrArray const & oldFields = parentStructure->getFields();
for(size_t i=0; i< num; i++) {
if(i==index) {
fields[i] = structurePtr;
} else {
fields[i] = oldFields[i];
}
}
FieldConstPtr field = getFieldCreate()->createStructure(
parentStructure->getID(),fieldNames,fields);
parent->replaceField(field);
parent->fixParentStructure();
}