1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "SUIT_DataObjectKey.h"
28 #define _typeinfo std::type_info
31 #define _typeinfo type_info
34 /*!\class SUIT_DataObjectKey
35 * Key for personal idetfication of SUIT_DataObject.
41 SUIT_DataObjectKey::SUIT_DataObjectKey()
49 SUIT_DataObjectKey::~SUIT_DataObjectKey()
53 /*!\class SUIT_DataObjectKeyHandle
54 * Wrapper around the pointer of class SUIT_DataObjectKey.
60 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle()
68 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( const SUIT_DataObjectKeyHandle& other )
69 : myKey( other.myKey )
77 Constructor. Initialize by key \a key.
79 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( SUIT_DataObjectKey* key )
88 SUIT_DataObjectKeyHandle::~SUIT_DataObjectKeyHandle()
94 * Checks: Is key null?
95 *\retval TRUE - if null, esle false.
97 bool SUIT_DataObjectKeyHandle::isNull() const
105 void SUIT_DataObjectKeyHandle::nullify()
112 *\retval boolean. TRUE - If current key less than \a kw.
114 bool SUIT_DataObjectKeyHandle::operator<( const SUIT_DataObjectKeyHandle& kw ) const
116 if ( myKey == kw.myKey )
119 if ( !myKey || !kw.myKey )
120 return myKey < kw.myKey;
122 const _typeinfo& i1 = typeid( *myKey );
123 const _typeinfo& i2 = typeid( *kw.myKey );
125 int cmp = strcmp( i1.name(), i2.name() );
131 return myKey->isLess( kw.myKey );
136 *\retval boolean. TRUE - If current key equal \a kw.
138 bool SUIT_DataObjectKeyHandle::operator==( const SUIT_DataObjectKeyHandle& kw ) const
140 if ( myKey == kw.myKey )
143 if ( !myKey || !kw.myKey )
146 if ( typeid( *myKey ) != typeid( *kw.myKey ) )
149 return myKey->isEqual( kw.myKey );
153 * Copy value of key \a kw to current.
155 SUIT_DataObjectKeyHandle& SUIT_DataObjectKeyHandle::operator=( const SUIT_DataObjectKeyHandle& kw )
157 if ( myKey != kw.myKey )
169 * Inctrement reference counter for current key.
171 void SUIT_DataObjectKeyHandle::beginScope()
178 * Decrement reference counter for current key.
180 void SUIT_DataObjectKeyHandle::endScope()
187 if ( !myKey->refCounter )