Skip to content

Commit

Permalink
more use of parseOptional*()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Smith committed May 18, 2021
1 parent c62fce9 commit 4b54417
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 49 deletions.
28 changes: 4 additions & 24 deletions six/modules/c++/six.sicd/source/ComplexXMLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,12 +1216,7 @@ void ComplexXMLParser::parseImageFormationFromXML(
parseUInt(getFirstAndOnly(tmpElem, "NumChanProc"),
imageFormation->rcvChannelProcessed->numChannelsProcessed);

XMLElem prfXML = getOptional(tmpElem, "PRFScaleFactor");
if (prfXML)
{
//optional
parseDouble(prfXML, imageFormation->rcvChannelProcessed->prfScaleFactor);
}
parseOptionalDouble(tmpElem, "PRFScaleFactor", imageFormation->rcvChannelProcessed->prfScaleFactor);

//TODO make sure there is at least one
std::vector < XMLElem > chansXML;
Expand Down Expand Up @@ -1412,19 +1407,8 @@ void ComplexXMLParser::parseAntennaParametersFromXML(
common().parsePoly1D(tmpElem, params->gainBSPoly);
}

tmpElem = getOptional(antennaParamsXML, "EBFreqShift");
if (tmpElem)
{
//optional
parseBooleanType(tmpElem, params->electricalBoresightFrequencyShift);
}

tmpElem = getOptional(antennaParamsXML, "MLFreqDilation");
if (tmpElem)
{
//optional
parseBooleanType(tmpElem, params->mainlobeFrequencyDilation);
}
parseOptionalBooleanType(antennaParamsXML, "EBFreqShift", params->electricalBoresightFrequencyShift);
parseOptionalBooleanType(antennaParamsXML, "MLFreqDilation", params->mainlobeFrequencyDilation);
}

void ComplexXMLParser::parseAntennaFromXML(
Expand Down Expand Up @@ -1525,11 +1509,7 @@ void ComplexXMLParser::parseINCAFromXML(
common().parsePoly2D(tmpElem, inca->dopplerCentroidPoly);
}

tmpElem = getOptional(incaElem, "DopCentroidCOA");
if (tmpElem)
{
parseBooleanType(tmpElem, inca->dopplerCentroidCOA);
}
parseOptionalBooleanType(incaElem, "DopCentroidCOA", inca->dopplerCentroidCOA);
}

void ComplexXMLParser::parseRgAzCompFromXML(
Expand Down
29 changes: 4 additions & 25 deletions six/modules/c++/six.sidd/source/DerivedXMLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,7 @@ void DerivedXMLParser::parseProductCreationFromXML(
parseString(getFirstAndOnly(informationElem, "Site"),
processorInformation->site);

// optional
XMLElem profileElem = getOptional(informationElem, "Profile");
if (profileElem)
{
parseString(profileElem, processorInformation->profile);
}
parseOptionalString(informationElem, "Profile", processorInformation->profile);
}

void DerivedXMLParser::parseProductCreationFromXML(
Expand All @@ -274,12 +269,7 @@ void DerivedXMLParser::parseProductCreationFromXML(
parseString(getFirstAndOnly(productCreationElem, "ProductClass"),
productCreation->productClass);

// optional
XMLElem productTypeElem = getOptional(productCreationElem, "ProductType");
if (productTypeElem)
{
parseString(productTypeElem, productCreation->productType);
}
parseOptionalString(productCreationElem, "ProductType", productCreation->productType);

// optional
common().parseParameters(productCreationElem, "ProductCreationExtension",
Expand Down Expand Up @@ -629,13 +619,8 @@ XMLElem DerivedXMLParser::parseCylindricalProjection(
cylindricalProj->timeCOAPoly);
common().parseVector3D(getFirstAndOnly(projElem, "StripmapDirection"),
cylindricalProj->stripmapDirection);
// optional
XMLElem curvRadiusElem = getOptional(projElem, "CurvatureRadius");
if (curvRadiusElem)
{
parseDouble(curvRadiusElem, cylindricalProj->curvatureRadius);
}

parseOptionalDouble(projElem, "CurvatureRadius", cylindricalProj->curvatureRadius);
return projElem;
}

Expand Down Expand Up @@ -765,13 +750,7 @@ void DerivedXMLParser::parseExploitationFeaturesFromXML(
getCharacterData());

parseOptionalDouble(polElem, "RcvPolarizationOffset", p->rcvPolarizationOffset);

// optional
tmpElem = getOptional(polElem, "Processed");
if (tmpElem)
{
parseBooleanType(tmpElem, p->processed);
}
parseOptionalBooleanType(polElem, "Processed", p->processed);
}

// parse Geometry -- optional
Expand Down

0 comments on commit 4b54417

Please sign in to comment.