X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOMEDS%2FSALOMEDS_AttributeTreeNode_i.cxx;h=f4da8df6cd115540fc127026042a68baa3e0f5b2;hb=d6fee8b4014bd0f4805a04d8a2d870901fdb7065;hp=b4ae565ce62af527e825a0641ab9c1a5839f3fe0;hpb=e6bfea36374791cd31c274a2f97df90dc60ddaf3;p=modules%2Fkernel.git diff --git a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx index b4ae565ce..f4da8df6c 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTreeNode_i.cxx @@ -1,50 +1,44 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SALOMEDS_AttributeTreeNode_i.cxx // Author : Sergey RUIN // Module : SALOME - - +// #include "SALOMEDS_AttributeTreeNode_i.hxx" #include "utilities.h" #include "SALOMEDS.hxx" -#include -#include -#include -#include - -using namespace std; -static Handle(SALOMEDSImpl_AttributeTreeNode) GetNode(SALOMEDS::AttributeTreeNode_ptr value, - const Handle(SALOMEDSImpl_AttributeTreeNode)& aNode) +static SALOMEDSImpl_AttributeTreeNode* GetNode(SALOMEDS::AttributeTreeNode_ptr value, + SALOMEDSImpl_AttributeTreeNode* aNode) { - Handle(SALOMEDSImpl_AttributeTreeNode) aResult = new SALOMEDSImpl_AttributeTreeNode; - TCollection_AsciiString anEntry = value->Label(); - TDF_Label aLabel; - TDF_Tool::Label(aNode->Label().Data(), anEntry, aLabel); + SALOMEDSImpl_AttributeTreeNode* aResult = NULL; + DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label()); if (aLabel.IsNull()) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label") return aResult; } - if (!aLabel.FindAttribute(aNode->ID(), aResult)) { + if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) { MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute") } @@ -55,22 +49,22 @@ void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr val { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFather(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFather(); + return dynamic_cast(_impl)->HasFather(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFather; - aFather = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFather(), _orb); -#ifndef WNT + aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFather(), _orb); +#ifndef WIN32 return aFather->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aFather->AttributeTreeNode::_this(); @@ -81,22 +75,22 @@ void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetPrevious(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasPrevious(); + return dynamic_cast(_impl)->HasPrevious(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aPrevious; - aPrevious=new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetPrevious(), _orb); -#ifndef WNT + aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetPrevious(), _orb); +#ifndef WIN32 return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aPrevious->AttributeTreeNode::_this(); @@ -107,22 +101,22 @@ void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetNext(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasNext(); + return dynamic_cast(_impl)->HasNext(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aNext; - aNext = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetNext(), _orb); -#ifndef WNT + aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetNext(), _orb); +#ifndef WIN32 return aNext->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aNext->AttributeTreeNode::_this(); @@ -133,22 +127,22 @@ void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr valu { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->SetFirst(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() { SALOMEDS::Locker lock; - return Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->HasFirst(); + return dynamic_cast(_impl)->HasFirst(); } SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() { SALOMEDS::Locker lock; SALOMEDS_AttributeTreeNode_i* aFirst; - aFirst = new SALOMEDS_AttributeTreeNode_i(Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl)->GetFirst(), _orb); -#ifndef WNT + aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast(_impl)->GetFirst(), _orb); +#ifndef WIN32 return aFirst->POA_SALOMEDS::AttributeTreeNode::_this(); #else return aFirst->AttributeTreeNode::_this(); @@ -159,24 +153,22 @@ void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); - aNode->SetTreeID(Standard_GUID(aNode->ID())); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + aNode->SetTreeID(value); } char* SALOMEDS_AttributeTreeNode_i::GetTreeID() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); - char aGUID[40]; - aNode->ID().ToCString(aGUID); - return CORBA::String_var(CORBA::string_dup(aGUID))._retn(); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); + return CORBA::String_var(CORBA::string_dup(aNode->ID().c_str()))._retn(); } void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Append(GetNode(value, aNode)); } @@ -184,7 +176,7 @@ void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Prepend(GetNode(value, aNode)); } @@ -192,7 +184,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertBefore(GetNode(value, aNode)); } @@ -200,7 +192,7 @@ void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr v { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->InsertAfter(GetNode(value, aNode)); } @@ -208,50 +200,48 @@ void SALOMEDS_AttributeTreeNode_i::Remove() { SALOMEDS::Locker lock; CheckLocked(); - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); aNode->Remove(); } CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->Depth(); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsRoot(); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsDescendant(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsFather(GetNode(value, aNode)); } CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value) { SALOMEDS::Locker lock; - Handle(SALOMEDSImpl_AttributeTreeNode) aNode = Handle(SALOMEDSImpl_AttributeTreeNode)::DownCast(_impl); + SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast(_impl); return aNode->IsChild(GetNode(value, aNode)); } char* SALOMEDS_AttributeTreeNode_i::Label() { SALOMEDS::Locker lock; - TCollection_AsciiString aLabelName; - TDF_Tool::Entry(_impl->Label(),aLabelName); - return CORBA::String_var(CORBA::string_dup(aLabelName.ToCString()))._retn(); + return CORBA::String_var(CORBA::string_dup(_impl->Label().Entry().c_str()))._retn(); }