Replaced 'Standard_Integer' with 'Standard_Size' to avoid compiler warning.
Removed redundant casting to 'Standard_Size'.
Removed code checking if a 'Standard_Size' variable is negative.
//!@{
//! Direct const access to the item
- const TheItemType& Value (const Standard_Integer theIndex) const
+ const TheItemType& Value (const Standard_Size theIndex) const
{
return *(const TheItemType*)this->getValue(theIndex);
}
//! Const access to the item - operator()
- const TheItemType& operator () (const Standard_Integer theIndex) const
+ const TheItemType& operator () (const Standard_Size theIndex) const
{
return Value (theIndex);
}
//! Modification access to the item
- TheItemType& ChangeValue (const Standard_Integer theIndex)
+ TheItemType& ChangeValue (const Standard_Size theIndex)
{
return *(TheItemType*)(this->getValue (theIndex));
}
//! Access to the item - operator()
- TheItemType& operator () (const Standard_Integer theIndex)
+ TheItemType& operator () (const Standard_Size theIndex)
{
return ChangeValue (theIndex);
}
//! Set a value at specified index method
- TheItemType& SetValue (const Standard_Integer theIndex,
+ TheItemType& SetValue (const Standard_Size theIndex,
const TheItemType& theValue)
{
return *(TheItemType*)this->setValue(theIndex, (Standard_Address)&theValue);
}
//! Direct const access to the item
- const TheItemType& Find (const Standard_Integer theIndex) const
+ const TheItemType& Find (const Standard_Size theIndex) const
{
return *(TheItemType*)this->getValue(theIndex);
}
//! Modification access to the item; allocates space if
//! necessary and marks the item as defined
- TheItemType& ChangeFind (const Standard_Integer theIndex)
+ TheItemType& ChangeFind (const Standard_Size theIndex)
{
return *(TheItemType*)(this->changeValue (theIndex));
}
//! Set a value as explicit method
- TheItemType& Bind (const Standard_Integer theIndex,
+ TheItemType& Bind (const Standard_Size theIndex,
const TheItemType& theValue)
{
return SetValue(theIndex, theValue);
}
//! Returns True if the item is defined
- Standard_Boolean IsBound (const Standard_Integer theIndex) const
+ Standard_Boolean IsBound (const Standard_Size theIndex) const
{
return this->HasValue(theIndex);
}
//! Remove the item from array
- Standard_Boolean UnBind (const Standard_Integer theIndex)
+ Standard_Boolean UnBind (const Standard_Size theIndex)
{
return this->UnsetValue(theIndex);
}
}
//! Access current index with 'a-la map' interface
- Standard_Integer Key (void) const { return Index(); }
+ Standard_Size Key (void) const { return Index(); }
};
/**
//purpose :
//=======================================================================
-Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Integer theIndex,
+Standard_Address NCollection_SparseArrayBase::setValue (const Standard_Size theIndex,
const Standard_Address theValue)
{
- Standard_OutOfRange_Raise_if (theIndex<0,"NCollection_SparseArray::SetValue()")
- Standard_Size anIndex = (Standard_Size)theIndex;
- Standard_Size iBlock = anIndex / myBlockSize;
+ Standard_Size iBlock = theIndex / myBlockSize;
// resize blocks array if necessary
if ( iBlock >= myNbBlocks )
Block aBlock (getBlock (anAddr));
// mark item as defined
- Standard_Size anInd = anIndex % myBlockSize;
+ Standard_Size anInd = theIndex % myBlockSize;
Standard_Address anItem = getItem (aBlock, anInd);
// either create an item by copy constructor if it is new, or assign it
//purpose :
//=======================================================================
-Standard_Boolean NCollection_SparseArrayBase::HasValue (const Standard_Integer theIndex) const
+Standard_Boolean NCollection_SparseArrayBase::HasValue (const Standard_Size theIndex) const
{
- Standard_Size anIndex = (Standard_Size)theIndex;
- Standard_Size iBlock = anIndex / myBlockSize;
- if ( theIndex < 0 || iBlock >= myNbBlocks ||
+ Standard_Size iBlock = theIndex / myBlockSize;
+ if ( iBlock >= myNbBlocks ||
! myData[iBlock] )
return Standard_False;
- return getBlock(myData[iBlock]).IsSet(anIndex % myBlockSize) ? Standard_True : Standard_False;
+ return getBlock(myData[iBlock]).IsSet(theIndex % myBlockSize) ? Standard_True : Standard_False;
}
//=======================================================================
//purpose :
//=======================================================================
-Standard_Boolean NCollection_SparseArrayBase::UnsetValue (const Standard_Integer theIndex)
+Standard_Boolean NCollection_SparseArrayBase::UnsetValue (const Standard_Size theIndex)
{
// check that the item is defined
- Standard_Size anIndex = (Standard_Size)theIndex;
- Standard_Size iBlock = anIndex / myBlockSize;
- if ( theIndex < 0 || iBlock >= myNbBlocks || ! myData[iBlock] )
+ Standard_Size iBlock = theIndex / myBlockSize;
+ if ( iBlock >= myNbBlocks || ! myData[iBlock] )
return Standard_False;
Block aBlock (getBlock(myData[iBlock]));
- Standard_Size anInd = anIndex % myBlockSize;
+ Standard_Size anInd = theIndex % myBlockSize;
if ( ! aBlock.Unset(anInd) )
return Standard_False;
Standard_Size Size () const { return mySize; }
//! Check whether the value at given index is set
- Standard_EXPORT Standard_Boolean HasValue (const Standard_Integer theIndex) const;
+ Standard_EXPORT Standard_Boolean HasValue (const Standard_Size theIndex) const;
//! Deletes the item from the array;
//! returns True if that item was defined
- Standard_EXPORT Standard_Boolean UnsetValue (const Standard_Integer theIndex);
+ Standard_EXPORT Standard_Boolean UnsetValue (const Standard_Size theIndex);
//!@}
}
//! Direct const access to the item
- Standard_Address getValue (const Standard_Integer theIndex) const
+ Standard_Address getValue (const Standard_Size theIndex) const
{
Standard_OutOfRange_Raise_if (!HasValue(theIndex),"NCollection_SparseArray::Value()")
return Block::ToArray(myData[theIndex/myBlockSize], myBlockSize, myItemSize) +
}
//! Set a value to the specified item; returns address of the set item
- Standard_EXPORT Standard_Address setValue (const Standard_Integer theIndex,
+ Standard_EXPORT Standard_Address setValue (const Standard_Size theIndex,
const Standard_Address theValue);
//! Modification access to the item; allocates necessary space
//! and marks the item as defined
- Standard_EXPORT Standard_Address changeValue (const Standard_Integer theIndex);
+ Standard_EXPORT Standard_Address changeValue (const Standard_Size theIndex);
//! Copy contents of theOther to this;
//! assumes that this and theOther have exactly the same type of arguments
//purpose :
//=======================================================================
-void TObj_TIntSparseArray::SetValue (const Standard_Integer theId,
+void TObj_TIntSparseArray::SetValue (const Standard_Size theId,
const Standard_Integer theValue)
{
// check that modification is allowed
//purpose :
//=======================================================================
-void TObj_TIntSparseArray::UnsetValue (const Standard_Integer theId)
+void TObj_TIntSparseArray::UnsetValue (const Standard_Size theId)
{
// check that modification is allowed
if ( !Label().Data()->IsModificationAllowed() )
TObj_TIntSparseArray_VecOfData::Iterator anIt (myVector);
for (; anIt.More(); anIt.Next())
{
- Standard_Integer anId = anIt.Key();
+ Standard_Size anId = anIt.Key();
Standard_Integer aVal = anIt.Value();
backupValue(anId, aVal, AbsentValue);
}
//purpose :
//=======================================================================
-void TObj_TIntSparseArray::backupValue (const Standard_Integer theId,
+void TObj_TIntSparseArray::backupValue (const Standard_Size theId,
const Standard_Integer theCurrValue,
const Standard_Integer theNewValue)
{
TObj_TIntSparseArray_MapOfData::Iterator anIt (aDelta->myOldMap);
for (; anIt.More(); anIt.Next())
{
- Standard_Integer anId = anIt.Key();
+ Standard_Size anId = anIt.Key();
Standard_Integer anOld = anIt.Value();
if (anOld == AbsentValue)
UnsetValue (anId);
//! Methods for access to data
//! Returns the number of stored values in the set
- Standard_EXPORT Standard_Integer Size() const
+ Standard_EXPORT Standard_Size Size() const
{ return myVector.Size(); }
typedef TObj_TIntSparseArray_VecOfData::ConstIterator Iterator;
Iterator GetIterator() const { return Iterator(myVector); }
//! Returns true if the value with the given ID is present.
- Standard_Boolean HasValue (const Standard_Integer theId) const
+ Standard_Boolean HasValue (const Standard_Size theId) const
{ return myVector.HasValue(theId); }
//! Returns the value by its ID.
//! Raises an exception if no value is stored with this ID
- Standard_Integer Value (const Standard_Integer theId) const
+ Standard_Integer Value (const Standard_Size theId) const
{ return myVector.Value(theId); }
//! Sets the value with the given ID.
//! Raises an exception if theId is not positive
- Standard_EXPORT void SetValue (const Standard_Integer theId,
+ Standard_EXPORT void SetValue (const Standard_Size theId,
const Standard_Integer theValue);
//! Unsets the value with the given ID.
//! Raises an exception if theId is not positive
- Standard_EXPORT void UnsetValue(const Standard_Integer theId);
+ Standard_EXPORT void UnsetValue(const Standard_Size theId);
//! Clears the set
Standard_EXPORT void Clear ();
};
//! backup one value
- void backupValue (const Standard_Integer theId,
+ void backupValue (const Standard_Size theId,
const Standard_Integer theCurrValue,
const Standard_Integer theNewValue);