Back to index

salome-kernel  6.5.0
SALOMEDS_AttributeTreeNode_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDS_AttributeTreeNode_i.cxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #include "SALOMEDS_AttributeTreeNode_i.hxx"
00028 #include "utilities.h"
00029 #include "SALOMEDS.hxx"
00030 
00031 static SALOMEDSImpl_AttributeTreeNode* GetNode(SALOMEDS::AttributeTreeNode_ptr value,
00032                                                SALOMEDSImpl_AttributeTreeNode* aNode) 
00033 {
00034   SALOMEDSImpl_AttributeTreeNode* aResult = NULL;
00035   DF_Label aLabel = DF_Label::Label(aNode->Label(), value->Label());
00036   if (aLabel.IsNull()) {
00037     MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
00038     MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such label")
00039     return aResult;
00040   }
00041   if (!(aResult=(SALOMEDSImpl_AttributeTreeNode*)aLabel.FindAttribute(aNode->ID()))) {
00042     MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
00043     MESSAGE("SALOMEDS_AttributeTreeNode_i class: no such attribute")
00044   }
00045   return aResult;
00046 }
00047 
00048 void SALOMEDS_AttributeTreeNode_i::SetFather(SALOMEDS::AttributeTreeNode_ptr value) 
00049 {
00050   SALOMEDS::Locker lock;
00051   CheckLocked();
00052   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00053   aNode->SetFather(GetNode(value, aNode));
00054 }
00055 
00056 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFather() 
00057 {
00058   SALOMEDS::Locker lock;
00059   return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasFather();
00060 }
00061 
00062 SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFather() 
00063 {
00064   SALOMEDS::Locker lock;
00065   SALOMEDS_AttributeTreeNode_i* aFather;
00066   aFather = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFather(), _orb);
00067 #ifndef WIN32
00068   return aFather->POA_SALOMEDS::AttributeTreeNode::_this();
00069 #else
00070   return aFather->AttributeTreeNode::_this();
00071 #endif
00072 }
00073 
00074 void SALOMEDS_AttributeTreeNode_i::SetPrevious(SALOMEDS::AttributeTreeNode_ptr value) 
00075 {
00076   SALOMEDS::Locker lock;
00077   CheckLocked();
00078   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00079   aNode->SetPrevious(GetNode(value, aNode));
00080 }
00081 
00082 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasPrevious() 
00083 {
00084   SALOMEDS::Locker lock;
00085   return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasPrevious();
00086 }
00087 
00088 SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetPrevious() 
00089 {
00090   SALOMEDS::Locker lock;
00091   SALOMEDS_AttributeTreeNode_i* aPrevious;
00092   aPrevious=new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetPrevious(), _orb);
00093 #ifndef WIN32
00094   return aPrevious->POA_SALOMEDS::AttributeTreeNode::_this();
00095 #else
00096   return aPrevious->AttributeTreeNode::_this();
00097 #endif
00098 }
00099 
00100 void SALOMEDS_AttributeTreeNode_i::SetNext(SALOMEDS::AttributeTreeNode_ptr value) 
00101 {
00102   SALOMEDS::Locker lock;
00103   CheckLocked();
00104   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00105   aNode->SetNext(GetNode(value, aNode));
00106 }
00107 
00108 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasNext() 
00109 {
00110   SALOMEDS::Locker lock;
00111   return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasNext();
00112 }
00113 
00114 SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetNext() 
00115 {
00116   SALOMEDS::Locker lock;
00117   SALOMEDS_AttributeTreeNode_i* aNext;
00118   aNext = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetNext(), _orb);
00119 #ifndef WIN32
00120   return aNext->POA_SALOMEDS::AttributeTreeNode::_this();
00121 #else
00122   return aNext->AttributeTreeNode::_this();
00123 #endif
00124 }
00125 
00126 void SALOMEDS_AttributeTreeNode_i::SetFirst(SALOMEDS::AttributeTreeNode_ptr value) 
00127 {
00128   SALOMEDS::Locker lock;
00129   CheckLocked();
00130   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00131   aNode->SetFirst(GetNode(value, aNode));
00132 }
00133 
00134 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::HasFirst() 
00135 {
00136   SALOMEDS::Locker lock;
00137   return dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->HasFirst();
00138 }
00139 
00140 SALOMEDS::AttributeTreeNode_ptr SALOMEDS_AttributeTreeNode_i::GetFirst() 
00141 {
00142   SALOMEDS::Locker lock;
00143   SALOMEDS_AttributeTreeNode_i* aFirst;
00144   aFirst = new SALOMEDS_AttributeTreeNode_i(dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl)->GetFirst(), _orb);
00145 #ifndef WIN32
00146   return aFirst->POA_SALOMEDS::AttributeTreeNode::_this();
00147 #else
00148   return aFirst->AttributeTreeNode::_this();
00149 #endif
00150 }
00151 
00152 void SALOMEDS_AttributeTreeNode_i::SetTreeID(const char* value) 
00153 {
00154   SALOMEDS::Locker lock;
00155   CheckLocked();
00156   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00157   aNode->SetTreeID(value);
00158 }
00159 
00160 char* SALOMEDS_AttributeTreeNode_i::GetTreeID() 
00161 {
00162   SALOMEDS::Locker lock;
00163   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00164   return CORBA::String_var(CORBA::string_dup(aNode->ID().c_str()))._retn();
00165 }
00166 
00167 void SALOMEDS_AttributeTreeNode_i::Append(SALOMEDS::AttributeTreeNode_ptr value) 
00168 {
00169   SALOMEDS::Locker lock;
00170   CheckLocked();
00171   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00172   aNode->Append(GetNode(value, aNode));
00173 }
00174 
00175 void SALOMEDS_AttributeTreeNode_i::Prepend(SALOMEDS::AttributeTreeNode_ptr value) 
00176 {
00177   SALOMEDS::Locker lock;
00178   CheckLocked();
00179   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00180   aNode->Prepend(GetNode(value, aNode));
00181 }
00182 
00183 void SALOMEDS_AttributeTreeNode_i::InsertBefore(SALOMEDS::AttributeTreeNode_ptr value) 
00184 {
00185   SALOMEDS::Locker lock;
00186   CheckLocked();
00187   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00188   aNode->InsertBefore(GetNode(value, aNode));
00189 }
00190 
00191 void SALOMEDS_AttributeTreeNode_i::InsertAfter(SALOMEDS::AttributeTreeNode_ptr value) 
00192 {
00193   SALOMEDS::Locker lock;
00194   CheckLocked();
00195   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00196   aNode->InsertAfter(GetNode(value, aNode));
00197 }
00198 
00199 void SALOMEDS_AttributeTreeNode_i::Remove() 
00200 {
00201   SALOMEDS::Locker lock;
00202   CheckLocked();
00203   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00204   aNode->Remove();
00205 }
00206 
00207 CORBA::Long SALOMEDS_AttributeTreeNode_i::Depth() 
00208 {
00209   SALOMEDS::Locker lock;
00210   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00211   return aNode->Depth();
00212 }
00213 
00214 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsRoot() 
00215 {
00216   SALOMEDS::Locker lock;
00217   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00218   return aNode->IsRoot();
00219 }
00220 
00221 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsDescendant(SALOMEDS::AttributeTreeNode_ptr value) 
00222 {
00223   SALOMEDS::Locker lock;
00224   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00225   return aNode->IsDescendant(GetNode(value, aNode));
00226 }
00227 
00228 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsFather(SALOMEDS::AttributeTreeNode_ptr value) 
00229 {
00230   SALOMEDS::Locker lock;
00231   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00232   return aNode->IsFather(GetNode(value, aNode));
00233 }
00234 
00235 CORBA::Boolean SALOMEDS_AttributeTreeNode_i::IsChild(SALOMEDS::AttributeTreeNode_ptr value) 
00236 {
00237   SALOMEDS::Locker lock;
00238   SALOMEDSImpl_AttributeTreeNode* aNode = dynamic_cast<SALOMEDSImpl_AttributeTreeNode*>(_impl);
00239   return aNode->IsChild(GetNode(value, aNode));
00240 }
00241 
00242 char* SALOMEDS_AttributeTreeNode_i::Label() 
00243 {
00244   SALOMEDS::Locker lock;
00245   return CORBA::String_var(CORBA::string_dup(_impl->Label().Entry().c_str()))._retn();
00246 }
00247