// the dependencies can be in the feature itself
std::shared_ptr<Model_Data> aData =
std::dynamic_pointer_cast<Model_Data>(theFeature->data());
- if (aData && !aData->refsToMe().empty()) {
+ if (aData.get() && !aData->refsToMe().empty()) {
const std::set<AttributePtr>& aRefs = aData->refsToMe();
std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin(), aRefLast = aRefs.end();
for (; aRefIt != aRefLast; aRefIt++) {
void Model_Objects::removeFeature(FeaturePtr theFeature)
{
std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theFeature->data());
- if (aData && aData->isValid()) {
+ if (aData.get() && aData->isValid()) {
// checking that the sub-element of composite feature is removed: if yes, inform the owner
std::set<std::shared_ptr<ModelAPI_Feature> > aRefs;
refsToFeature(theFeature, aRefs, false);
void Model_Objects::clearHistory(ObjectPtr theObj)
{
- if (theObj) {
+ if (theObj.get()) {
const std::string aGroup = theObj->groupName();
std::map<std::string, std::vector<ObjectPtr> >::iterator aHIter = myHistory.find(aGroup);
if (aHIter != myHistory.end())
{
// try feature by label
FeaturePtr aFeature = feature(theLabel);
- if (aFeature)
+ if (aFeature.get())
return feature(theLabel);
TDF_Label aFeatureLabel = theLabel.Father().Father(); // let's suppose it is result
aFeature = feature(aFeatureLabel);
aFeature = feature(aFeatureLabel);
isSubResult = true;
}
- if (aFeature) {
+ if (aFeature.get()) {
const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
for (; aRIter != aResults.cend(); aRIter++) {
if (isSubResult) {
ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(*aRIter);
- if (aCompRes) {
+ if (aCompRes.get()) {
int aNumSubs = aCompRes->numberOfSubs();
for(int a = 0; a < aNumSubs; a++) {
ResultPtr aSub = aCompRes->subResult(a);
theObj->setDoc(myDoc);
theObj->setData(aData);
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
- if (aFeature) {
+ if (aFeature.get()) {
setUniqueName(aFeature); // must be before "initAttributes" because duplicate part uses name
}
theObj->initAttributes();
aFeature = std::dynamic_pointer_cast<Model_Session>(ModelAPI_Session::get())->createFeature(
TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(aLabIter.Value())->Get())
.ToCString(), anOwner);
- if (!aFeature) { // somethig is wrong, most probably, the opened document has invalid structure
+ if (!aFeature.get()) { // somethig is wrong, most probably, the opened document has invalid structure
Events_Error::send("Invalid type of object in the document");
aLabIter.Value()->Label().ForgetAllAttributes();
continue;
FeaturePtr aFeature = aFeatures.Value();
std::shared_ptr<Model_Data> aFData =
std::dynamic_pointer_cast<Model_Data>(aFeature->data());
- if (aFData) {
+ if (aFData.get()) {
aFData->eraseBackReferences();
}
const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
FeaturePtr aFeature = aFeatures.Value();
std::shared_ptr<Model_Data> aFData =
std::dynamic_pointer_cast<Model_Data>(aFeature->data());
- if (aFData) {
+ if (aFData.get()) {
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
aFData->referencesToObjects(aRefs);
std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator
TDataStd_Comment::Set(aLab, ModelAPI_ResultConstruction::group().c_str());
ObjectPtr anOldObject = object(aLab);
std::shared_ptr<ModelAPI_ResultConstruction> aResult;
- if (anOldObject) {
+ if (anOldObject.get()) {
aResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
}
- if (!aResult) {
+ if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultConstruction>(new Model_ResultConstruction);
storeResult(theFeatureData, aResult, theIndex);
}
anOldObject = object(aLab);
}
std::shared_ptr<ModelAPI_ResultBody> aResult;
- if (anOldObject) {
+ if (anOldObject.get()) {
aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
}
- if (!aResult) {
+ if (!aResult.get()) {
// create compsolid anyway; if it is compsolid, it will create sub-bodies internally
if (aResultOwner.get()) {
aResult = std::shared_ptr<ModelAPI_ResultBody>(new Model_ResultBody);
TDataStd_Comment::Set(aLab, ModelAPI_ResultPart::group().c_str());
ObjectPtr anOldObject = object(aLab);
std::shared_ptr<ModelAPI_ResultPart> aResult;
- if (anOldObject) {
+ if (anOldObject.get()) {
aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
}
- if (!aResult) {
+ if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultPart>(new Model_ResultPart);
storeResult(theFeatureData, aResult, theIndex);
}
TDataStd_Comment::Set(aLab, ModelAPI_ResultGroup::group().c_str());
ObjectPtr anOldObject = object(aLab);
std::shared_ptr<ModelAPI_ResultGroup> aResult;
- if (anOldObject) {
+ if (anOldObject.get()) {
aResult = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(anOldObject);
}
- if (!aResult) {
+ if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultGroup>(new Model_ResultGroup(theFeatureData));
storeResult(theFeatureData, aResult, theIndex);
}
TDataStd_Comment::Set(aLab, ModelAPI_ResultParameter::group().c_str());
ObjectPtr anOldObject = object(aLab);
std::shared_ptr<ModelAPI_ResultParameter> aResult;
- if (anOldObject) {
+ if (anOldObject.get()) {
aResult = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(anOldObject);
}
- if (!aResult) {
+ if (!aResult.get()) {
aResult = std::shared_ptr<ModelAPI_ResultParameter>(new Model_ResultParameter);
storeResult(theFeatureData, aResult, theIndex);
}
const std::shared_ptr<ModelAPI_Result>& theResult)
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theResult->data());
- if (aData) {
+ if (aData.get()) {
TDF_Label aFeatureLab = aData->label().Father().Father().Father();
FeaturePtr aFeature = feature(aFeatureLab);
if (!aFeature.get() && aFeatureLab.Depth() > 1) { // this may be sub-result of result
FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, const bool theReverse)
{
std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theCurrent->data());
- if (aData && aData->isValid()) {
+ if (aData.get() && aData->isValid()) {
TDF_Label aFeatureLabel = aData->label().Father();
Handle(TDataStd_ReferenceArray) aRefs;
if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
{
std::shared_ptr<Model_Data> aLaterD = std::static_pointer_cast<Model_Data>(theLater->data());
std::shared_ptr<Model_Data> aCurrentD = std::static_pointer_cast<Model_Data>(theCurrent->data());
- if (aLaterD && aLaterD->isValid() && aCurrentD && aCurrentD->isValid()) {
+ if (aLaterD.get() && aLaterD->isValid() && aCurrentD.get() && aCurrentD->isValid()) {
TDF_Label aLaterL = aLaterD->label().Father();
TDF_Label aCurrentL = aCurrentD->label().Father();
int aLaterI = -1, aCurentI = -1; // not found yet state