本文整理汇总了C++中PVFieldPtr::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PVFieldPtr::get方法的具体用法?C++ PVFieldPtr::get怎么用?C++ PVFieldPtr::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVFieldPtr
的用法示例。
在下文中一共展示了PVFieldPtr::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: channelGetConnect
void PvValue::channelGetConnect(
const Status& status,
ChannelGet::shared_pointer const & channelGet,
PVStructure::shared_pointer const & pvStructure,
BitSet::shared_pointer const & bitSet)
{
if(!status.isOK()) {
this->status = status;
} else {
this->status = Status::Ok;
this->channelGet = channelGet;
pvGetStructure = pvStructure;
PVFieldPtr pvValue = pvGetStructure->getSubField("value");
PVFieldPtr pvAlarm = pvGetStructure->getSubField("alarm");
PVFieldPtr pvTimeStamp = pvGetStructure->getSubField("timeStamp");
bool allGood = true;
if(pvValue.get()==NULL) allGood = false;
if(!allGood) {
string builder("channel ");
builder += channelName;
if(pvValue.get()==NULL) builder += " no value field ";
if(pvAlarm.get()==NULL) builder += " no alarm field ";
if(pvTimeStamp.get()==NULL) builder += " no timeStamp field ";
this->status = Status(Status::STATUSTYPE_ERROR,builder);
builder.clear();
pvGetStructure->toString(&builder);
printf("channel %s pvGetStructure\n%s\n",
channelName.c_str(),builder.c_str());
}
}
event.signal();
}
示例2: s
std::ostream& PVStructure::dumpValue(std::ostream& o) const
{
o << format::indent() << getStructure()->getID() << ' ' << getFieldName();
String extendsName = getExtendsStructureName();
if(extendsName.length()>0) {
o << " extends " << extendsName;
}
o << std::endl;
{
format::indent_scope s(o);
PVFieldPtrArray const & fieldsData = getPVFields();
if (fieldsData.size() != 0) {
size_t length = getStructure()->getNumberFields();
for(size_t i=0; i<length; i++) {
PVFieldPtr fieldField = fieldsData[i];
Type type = fieldField->getField()->getType();
if (type == scalar || type == scalarArray)
o << format::indent() << fieldField->getField()->getID() << ' ' << fieldField->getFieldName() << ' ' << *(fieldField.get()) << std::endl;
else
o << *(fieldField.get());
}
}
}
return o;
}
示例3: getScalarArrayField
PVScalarArrayPtr PVStructure::getScalarArrayField(
String const &fieldName,ScalarType elementType)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return nullPVScalarArray;
}
FieldConstPtr field = pvField->getField();
Type type = field->getType();
if(type!=scalarArray) {
String message("fieldName ");
message += fieldName + " does not have type array ";
this->message(message, errorMessage);
return nullPVScalarArray;
}
ScalarArrayConstPtr pscalarArray
= static_pointer_cast<const ScalarArray>(pvField->getField());
if(pscalarArray->getElementType()!=elementType) {
String message("fieldName ");
message += fieldName + " is array but does not have elementType ";
ScalarTypeFunc::toString(&message,elementType);
this->message(message, errorMessage);
return nullPVScalarArray;
}
return std::tr1::static_pointer_cast<PVScalarArray>(pvField);
}
示例4: getAlarm
Status PvValue::getAlarm(Alarm &alarm)
{
if(pvGetStructure.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no alarm field");
}
PVAlarm pvAlarm;
PVFieldPtr pvField = pvGetStructure->getSubField("alarm");
if(pvField.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no alarm field");
}
if(!pvAlarm.attach(pvField)) {
return Status(Status::STATUSTYPE_ERROR, "no alarm field");
}
pvAlarm.get(alarm);
return Status::Ok;
}
示例5: getTimeStamp
Status PvValue::getTimeStamp(TimeStamp &timeStamp)
{
if(pvGetStructure.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
PVTimeStamp pvTimeStamp;
PVFieldPtr pvField = pvGetStructure->getSubField("timeStamp");
if(pvField.get()==NULL) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
if(!pvTimeStamp.attach(pvField)) {
return Status(Status::STATUSTYPE_ERROR, "no timeStamp field");
}
pvTimeStamp.get(timeStamp);
return Status::Ok;
}
示例6: getStructureField
PVStructurePtr PVStructure::getStructureField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return nullPVStructure;
}
if(pvField->getField()->getType()==structure) {
return std::tr1::static_pointer_cast<PVStructure>(pvField);
}
String message("fieldName ");
message += fieldName + " does not have type structure ";
this->message(message, errorMessage);
return nullPVStructure;
}
示例7: getSubField
PVFieldPtr PVStructure::getSubField(size_t fieldOffset) const
{
if(fieldOffset<=getFieldOffset()) {
return nullPVField;
}
if(fieldOffset>getNextFieldOffset()) return nullPVField;
size_t numFields = pvFields.size();
for(size_t i=0; i<numFields; i++) {
PVFieldPtr pvField = pvFields[i];
if(pvField->getFieldOffset()==fieldOffset) return pvFields[i];
if(pvField->getNextFieldOffset()<=fieldOffset) continue;
if(pvField->getField()->getType()==structure) {
PVStructure *pvStructure = static_cast<PVStructure *>(pvField.get());
return pvStructure->getSubField(fieldOffset);
}
}
throw std::logic_error("PVStructure.getSubField: Logic error");
}
示例8: init
bool RecordListRecord::init()
{
initPVRecord();
PVStructurePtr pvStructure = getPVStructure();
database = pvStructure->getStringField("argument.database");
if(database.get()==NULL) return false;
regularExpression = pvStructure->getStringField(
"argument.regularExpression");
if(regularExpression.get()==NULL) return false;
status = pvStructure->getStringField("result.status");
if(status.get()==NULL) return false;
PVFieldPtr pvField = pvStructure->getSubField("result.names");
if(pvField.get()==NULL) {
std::cerr << "no result.names" << std::endl;
return false;
}
name = static_pointer_cast<PVStringArray>(
pvStructure->getScalarArrayField("result.names",pvString));
if(name.get()==NULL) return false;
return true;
}
示例9: getStringField
PVStringPtr PVStructure::getStringField(String const &fieldName)
{
PVFieldPtr pvField = findSubField(fieldName,this);
if(pvField.get()==NULL) {
String message("fieldName ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return nullPVString;
}
if(pvField->getField()->getType()==scalar) {
ScalarConstPtr pscalar = static_pointer_cast<const Scalar>(
pvField->getField());
if(pscalar->getScalarType()==pvString) {
return std::tr1::static_pointer_cast<PVString>(pvField);
}
}
String message("fieldName ");
message += fieldName + " does not have type string ";
this->message(message, errorMessage);
return nullPVString;
}
示例10: testScalarArrayCommon
static void testScalarArrayCommon(string /*fieldName*/,ScalarType stype)
{
PVStructurePtr pvStructure = standardPVField->scalarArray(
stype,alarmTimeStamp);
PVScalarArrayPtr scalarArray = pvStructure->getSubField<PVScalarArray>("value");
testOk1(scalarArray.get()!=0);
if(stype==pvBoolean) {
StringArray values(3);
values[0] = "true";
values[1] = "false";
values[2] = "true";
convert->fromStringArray(scalarArray, 0,3,values,0);
} else {
StringArray values(3);
values[0] = "0";
values[1] = "1";
values[2] = "2";
convert->fromStringArray(scalarArray, 0,3,values,0);
}
PVFieldPtr pvField = pvStructure->getSubField<PVInt>("alarm.status");
testOk1(pvField.get()!=0);
}
示例11: removePVField
void PVStructure::removePVField(String const &fieldName)
{
PVFieldPtr pvField = getSubField(fieldName);
if(pvField.get()==NULL) {
String message("removePVField ");
message += fieldName + " does not exist";
this->message(message, errorMessage);
return;
}
size_t origLength = pvFields.size();
size_t newLength = origLength - 1;
PVFieldPtrArray const & origPVFields = pvFields;
FieldConstPtrArray origFields = structurePtr->getFields();
PVFieldPtrArray newPVFields;
newPVFields.reserve(newLength);
StringArray newFieldNames;
newFieldNames.reserve(newLength);
FieldConstPtrArray fields;
fields.reserve(newLength);
for(size_t i=0; i<origLength; i++) {
if(origPVFields[i]!=pvField) {
newFieldNames.push_back(origPVFields[i]->getFieldName());
newPVFields.push_back(origPVFields[i]);
fields.push_back(origFields[i]);
}
}
PVFieldPtrArray * xxx = const_cast<PVFieldPtrArray *>(&pvFields);
xxx->swap(newPVFields);
FieldConstPtr field = getFieldCreate()->createStructure(
structurePtr->getID(),newFieldNames,fields);
replaceField(field);
structurePtr = static_pointer_cast<const Structure>(field);
StringArray fieldNames = structurePtr->getFieldNames();
for(size_t i=0; i<newLength; i++) {
pvFields[i]->setParentAndName(this,fieldNames[i]);
}
}
示例12: impl_print
void PrinterBase::impl_print(const PVField& pv)
{
static const PVField* marker = (const PVField*)▮
/* Depth first recursive iteration.
* Each PV to be printed is appended to the todo queue.
* The last child of a structure is followed by a NULL.
* As the tree is walked structures and structarrays
* are appended to the inprog queue.
*/
std::deque<const PVField*> todo, inprog;
todo.push_back(&pv);
while(!todo.empty()) {
const PVField *next = todo.front();
todo.pop_front();
if(next==marker) {
// finished with a structure or structarray,
// now we fall back to its parent.
assert(!inprog.empty());
switch(inprog.back()->getField()->getType()) {
case structure:
endStructure(*static_cast<const PVStructure *>(inprog.back()));
break;
case structureArray:
endStructureArray(*static_cast<const PVStructureArray *>(inprog.back()));
break;
case union_:
endUnion(*static_cast<const PVUnion *>(inprog.back()));
break;
case unionArray:
endUnionArray(*static_cast<const PVUnionArray *>(inprog.back()));
break;
default:
assert(false); // oops!
return;
}
inprog.pop_back();
} else {
// real field
if(!next) {
// NULL entry in a structure array
encodeNull();
continue;
}
switch(next->getField()->getType()) {
case scalar:
encodeScalar(*static_cast<const PVScalar*>(next));
break;
case scalarArray:
encodeArray(*static_cast<const PVScalarArray*>(next));
break;
case structure: {
const PVStructure &fld = *static_cast<const PVStructure*>(next);
const PVFieldPtrArray& vals = fld.getPVFields();
inprog.push_back(next);
beginStructure(fld);
for(size_t i=0, nfld=fld.getStructure()->getNumberFields(); i<nfld; i++)
todo.push_back(vals[i].get());
todo.push_back(marker);
break;
}
case structureArray: {
const PVStructureArray &fld = *static_cast<const PVStructureArray*>(next);
PVStructureArray::const_svector vals(fld.view());
inprog.push_back(next);
beginStructureArray(fld);
for(PVStructureArray::const_svector::const_iterator it=vals.begin();
it!=vals.end(); ++it)
{
todo.push_back(it->get());
}
todo.push_back(marker);
break;
}
case union_: {
const PVUnion &fld = *static_cast<const PVUnion*>(next);
inprog.push_back(next);
beginUnion(fld);
PVFieldPtr val = fld.get();
if (val.get()) // TODO print "(none)" ?
todo.push_back(val.get());
//.........这里部分代码省略.........