1 // Copyright (C) 2007-2013 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
23 #include "SUIT_DataObjectKey.h"
29 #define _typeinfo std::type_info
32 #define _typeinfo type_info
35 /*!\class SUIT_DataObjectKey
36 * Key for personal idetfication of SUIT_DataObject.
42 SUIT_DataObjectKey::SUIT_DataObjectKey()
50 SUIT_DataObjectKey::~SUIT_DataObjectKey()
54 /*!\class SUIT_DataObjectKeyHandle
55 * Wrapper around the pointer of class SUIT_DataObjectKey.
61 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle()
69 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( const SUIT_DataObjectKeyHandle& other )
70 : myKey( other.myKey )
78 Constructor. Initialize by key \a key.
80 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( SUIT_DataObjectKey* key )
89 SUIT_DataObjectKeyHandle::~SUIT_DataObjectKeyHandle()
95 * Checks: Is key null?
96 *\retval TRUE - if null, esle false.
98 bool SUIT_DataObjectKeyHandle::isNull() const
106 void SUIT_DataObjectKeyHandle::nullify()
113 *\retval boolean. TRUE - If current key less than \a kw.
115 bool SUIT_DataObjectKeyHandle::operator<( const SUIT_DataObjectKeyHandle& kw ) const
117 if ( myKey == kw.myKey )
120 if ( !myKey || !kw.myKey )
121 return myKey < kw.myKey;
123 const _typeinfo& i1 = typeid( *myKey );
124 const _typeinfo& i2 = typeid( *kw.myKey );
126 int cmp = strcmp( i1.name(), i2.name() );
132 return myKey->isLess( kw.myKey );
137 *\retval boolean. TRUE - If current key equal \a kw.
139 bool SUIT_DataObjectKeyHandle::operator==( const SUIT_DataObjectKeyHandle& kw ) const
141 if ( myKey == kw.myKey )
144 if ( !myKey || !kw.myKey )
147 if ( typeid( *myKey ) != typeid( *kw.myKey ) )
150 return myKey->isEqual( kw.myKey );
154 * Copy value of key \a kw to current.
156 SUIT_DataObjectKeyHandle& SUIT_DataObjectKeyHandle::operator=( const SUIT_DataObjectKeyHandle& kw )
158 if ( myKey != kw.myKey )
170 * Inctrement reference counter for current key.
172 void SUIT_DataObjectKeyHandle::beginScope()
179 * Decrement reference counter for current key.
181 void SUIT_DataObjectKeyHandle::endScope()
188 if ( !myKey->refCounter )