1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "SUIT_DataObjectKey.h"
25 #define _typeinfo std::type_info
28 #define _typeinfo type_info
31 /*!\class SUIT_DataObjectKey
32 * Key for personal idetfication of SUIT_DataObject.
38 SUIT_DataObjectKey::SUIT_DataObjectKey()
46 SUIT_DataObjectKey::~SUIT_DataObjectKey()
50 /*!\class SUIT_DataObjectKeyHandle
51 * Wrapper around the pointer of class SUIT_DataObjectKey.
57 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle()
65 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( const SUIT_DataObjectKeyHandle& other )
66 : myKey( other.myKey )
74 Constructor. Initialize by key \a key.
76 SUIT_DataObjectKeyHandle::SUIT_DataObjectKeyHandle( SUIT_DataObjectKey* key )
85 SUIT_DataObjectKeyHandle::~SUIT_DataObjectKeyHandle()
91 * Checks: Is key null?
92 *\retval TRUE - if null, esle false.
94 bool SUIT_DataObjectKeyHandle::isNull() const
102 void SUIT_DataObjectKeyHandle::nullify()
109 *\retval boolean. TRUE - If current key less than \a kw.
111 bool SUIT_DataObjectKeyHandle::operator<( const SUIT_DataObjectKeyHandle& kw ) const
113 if ( myKey == kw.myKey )
116 if ( !myKey || !kw.myKey )
117 return myKey < kw.myKey;
119 const _typeinfo& i1 = typeid( *myKey );
120 const _typeinfo& i2 = typeid( *kw.myKey );
122 int cmp = strcmp( i1.name(), i2.name() );
128 return myKey->isLess( kw.myKey );
133 *\retval boolean. TRUE - If current key equal \a kw.
135 bool SUIT_DataObjectKeyHandle::operator==( const SUIT_DataObjectKeyHandle& kw ) const
137 if ( myKey == kw.myKey )
140 if ( !myKey || !kw.myKey )
143 if ( typeid( *myKey ) != typeid( *kw.myKey ) )
146 return myKey->isEqual( kw.myKey );
150 * Copy value of key \a kw to current.
152 SUIT_DataObjectKeyHandle& SUIT_DataObjectKeyHandle::operator=( const SUIT_DataObjectKeyHandle& kw )
154 if ( myKey != kw.myKey )
166 * Inctrement reference counter for current key.
168 void SUIT_DataObjectKeyHandle::beginScope()
175 * Decrement reference counter for current key.
177 void SUIT_DataObjectKeyHandle::endScope()
184 if ( !myKey->refCounter )