throw INTERP_KERNEL::Exception("DataArrayChar::checkAllocated : Array is defined but not allocated ! Call alloc or setValues method first !");
}
+/*!
+ * This method desallocated \a this without modification of informations relative to the components.
+ * After call of this method, DataArrayChar::isAllocated will return false.
+ * If \a this is already not allocated, \a this is let unchanged.
+ */
+void DataArrayChar::desallocate() throw(INTERP_KERNEL::Exception)
+{
+ _mem.destroy();
+}
+
std::size_t DataArrayChar::getHeapMemorySize() const
{
std::size_t sz=_mem.getNbOfElemAllocated();
* than the current number the array is truncated, otherwise the array is extended.
* \param [in] nbOfTuples - new number of tuples.
* \throw If \a this is not allocated.
+ * \throw If \a nbOfTuples is negative.
*/
void DataArrayChar::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayChar::reAlloc : input new number of tuples should be >=0 !");
checkAllocated();
_mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
declareAsNew();
return _mem[tupleId*_info_on_compo.size()+compoId];
}
+/*!
+ * Returns the first value of \a this.
+ * \return char - the last value of \a this array.
+ * \throw If \a this is not allocated.
+ * \throw If \a this->getNumberOfComponents() != 1.
+ * \throw If \a this->getNumberOfTuples() < 1.
+ */
+char DataArrayChar::front() const throw(INTERP_KERNEL::Exception)
+{
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayChar::front : number of components not equal to one !");
+ int nbOfTuples=getNumberOfTuples();
+ if(nbOfTuples<1)
+ throw INTERP_KERNEL::Exception("DataArrayChar::front : number of tuples must be >= 1 !");
+ return *(getConstPointer());
+}
+
/*!
* Returns the last value of \a this.
- * \return double - the last value of \a this array.
+ * \return char - the last value of \a this array.
* \throw If \a this is not allocated.
* \throw If \a this->getNumberOfComponents() != 1.
* \throw If \a this->getNumberOfTuples() < 1.
* this[*id] in [\b vmin,\b vmax)
*
* \param [in] vmin begin of range. This value is included in range.
- * \param [out] vmax end of range. This value is \b not included in range.
+ * \param [in] vmax end of range. This value is \b not included in range.
* \return a newly allocated data array that the caller should deal with.
*/
DataArrayInt *DataArrayChar::getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception)