* See \ref MEDCouplingArrayBasicsName "DataArrays infos" for more information.
* \param [in] name - new array name
*/
-void DataArray::setName(const char *name)
+void DataArray::setName(const std::string& name)
{
_name=name;
}
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
for(std::size_t i=0;i<newNbOfCompo;i++)
- setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]).c_str());
+ setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]));
}
void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
for(std::size_t i=0;i<partOfCompoToSet;i++)
- setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i).c_str());
+ setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i));
}
bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const
stream << "\n";
}
-std::string DataArray::cppRepr(const char *varName) const
+std::string DataArray::cppRepr(const std::string& varName) const
{
std::ostringstream ret;
reprCppStream(varName,ret);
* \param [in] info - the string containing the information.
* \throw If \a i is not a valid component index.
*/
-void DataArray::setInfoOnComponent(int i, const char *info)
+void DataArray::setInfoOnComponent(int i, const std::string& info)
{
if(i<(int)_info_on_compo.size() && i>=0)
_info_on_compo[i]=info;
_info_on_compo=info;
}
-void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const
+void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const
{
if(getNumberOfTuples()!=nbOfTuples)
{
}
}
-void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const
+void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const
{
if(getNumberOfComponents()!=nbOfCompo)
{
}
}
-void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const
+void DataArray::checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const
{
if(getNbOfElems()!=nbOfElems)
{
}
}
-void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const
+void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const
{
if(getNumberOfTuples()!=other.getNumberOfTuples())
{
}
}
-void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const
+void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const
{
checkNbOfTuples(nbOfTuples,msg);
checkNbOfComps(nbOfCompo,msg);
/*!
* Simply this method checks that \b value is in [0,\b ref).
*/
-void DataArray::CheckValueInRange(int ref, int value, const char *msg)
+void DataArray::CheckValueInRange(int ref, int value, const std::string& msg)
{
if(value<0 || value>=ref)
{
* This method checks that [\b start, \b end) is compliant with ref length \b value.
* typicaly start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported.
*/
-void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *msg)
+void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg)
{
if(start<0 || start>=value)
{
}
}
-void DataArray::CheckClosingParInRange(int ref, int value, const char *msg)
+void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg)
{
if(value<0 || value>ref)
{
stopSlice=stop;
}
-int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg)
+int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg)
{
if(end<begin)
{
return (end-1-begin)/step+1;
}
-int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg)
+int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg)
{
if(step==0)
throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !");
return ret.str();
}
-void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const char *nameInFile, DataArrayByte *byteArr) const
+void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const
{
static const char SPACE[4]={' ',' ',' ',' '};
checkAllocated();
_mem.reprZip(getNumberOfComponents(),stream);
}
-void DataArrayDouble::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
{
int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
const double *data=getConstPointer();
for(;j<newNbOfComp;j++)
nc[newNbOfComp*i+j]=dftValue;
}
- ret->setName(getName().c_str());
+ ret->setName(getName());
for(int i=0;i<dim;i++)
- ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
- ret->setName(getName().c_str());
+ ret->setInfoOnComponent(i,getInfoOnComponent(i));
+ ret->setName(getName());
return ret.retn();
}
w[1]=wIn[0]*sin(wIn[1]);
w[2]=wIn[2];
}
- ret->setInfoOnComponent(2,getInfoOnComponent(2).c_str());
+ ret->setInfoOnComponent(2,getInfoOnComponent(2));
return ret;
}
* \throw If \a this is not allocated.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const std::string& func) const
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
* \throw If \a this is not allocated.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func) const
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
* \throw If \a func contains vars that are not in \a this->getInfoOnComponent().
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const std::string& func) const
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
* \throw If \a func contains vars not in \a varsOrder.
* \throw If computing \a func fails.
*/
-DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
return newArr;
}
-void DataArrayDouble::applyFuncFast32(const char *func)
+void DataArrayDouble::applyFuncFast32(const std::string& func)
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
declareAsNew();
}
-void DataArrayDouble::applyFuncFast64(const char *func)
+void DataArrayDouble::applyFuncFast64(const std::string& func)
{
checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
int k=0;
for(int i=0;i<(int)a.size();i++)
for(int j=0;j<nbc[i];j++,k++)
- ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str());
+ ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
return ret;
}
sum+=a1Ptr[i*nbOfComp+j]*a2Ptr[i*nbOfComp+j];
retPtr[i]=sum;
}
- ret->setInfoOnComponent(0,a1->getInfoOnComponent(0).c_str());
- ret->setName(a1->getName().c_str());
+ ret->setInfoOnComponent(0,a1->getInfoOnComponent(0));
+ ret->setName(a1->getName());
return ret;
}
*/
void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
{
- setName(tinyInfoS[0].c_str());
+ setName(tinyInfoS[0]);
if(isAllocated())
{
int nbOfCompo=getNumberOfComponents();
for(int i=0;i<nbOfCompo;i++)
- setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+ setInfoOnComponent(i,tinyInfoS[i+1]);
}
}
return ret.str();
}
-void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile, DataArrayByte *byteArr) const
+void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const
{
static const char SPACE[4]={' ',' ',' ',' '};
checkAllocated();
_mem.reprZip(getNumberOfComponents(),stream);
}
-void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayInt::reprCppStream(const std::string& varName, std::ostream& stream) const
{
int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
const int *data=getConstPointer();
for(;j<newNbOfComp;j++)
nc[newNbOfComp*i+j]=dftValue;
}
- ret->setName(getName().c_str());
+ ret->setName(getName());
for(int i=0;i<dim;i++)
- ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
- ret->setName(getName().c_str());
+ ret->setInfoOnComponent(i,getInfoOnComponent(i));
+ ret->setName(getName());
return ret.retn();
}
int k=0;
for(int i=0;i<(int)a.size();i++)
for(int j=0;j<nbc[i];j++,k++)
- ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str());
+ ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
return ret;
}
*/
void DataArrayInt::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
{
- setName(tinyInfoS[0].c_str());
+ setName(tinyInfoS[0]);
if(isAllocated())
{
int nbOfCompo=tinyInfoI[1];
for(int i=0;i<nbOfCompo;i++)
- setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+ setInfoOnComponent(i,tinyInfoS[i+1]);
}
}