/*!\file IntVecParam.c * \brief: implementation of the IntVecParam object */ /*header files: */ /*{{{*/ #ifdef HAVE_CONFIG_H #include #else #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" #endif #include "../classes.h" #include "../../shared/shared.h" /*}}}*/ /*IntVecParam constructors and destructor*/ IntVecParam::IntVecParam(){/*{{{*/ return; } /*}}}*/ IntVecParam::IntVecParam(int in_enum_type,int* in_values, int in_M){/*{{{*/ enum_type=in_enum_type; M=in_M; if(M){ values=xNew(M); xMemCpy(values,in_values,M); } else values=NULL; } /*}}}*/ IntVecParam::IntVecParam(int in_enum_type,IssmDouble* in_values, int in_M){/*{{{*/ enum_type=in_enum_type; M=in_M; if(M){ values=xNew(M); for(int i=0;i(in_values[i]); } else values=NULL; } /*}}}*/ IntVecParam::~IntVecParam(){/*{{{*/ xDelete(values); return; } /*}}}*/ /*Object virtual functions definitions:*/ Param* IntVecParam::copy() {/*{{{*/ return new IntVecParam(this->enum_type,this->values,this->M); } /*}}}*/ void IntVecParam::DeepEcho(void){/*{{{*/ _printf_(setw(22)<<" IntVecParam "<enum_type)<<" ["); for(int i=0;iM;i++) _printf_(" "<values[i]); _printf_("]\n"); } /*}}}*/ void IntVecParam::Echo(void){/*{{{*/ this->DeepEcho(); } /*}}}*/ int IntVecParam::Id(void){ return -1; }/*{{{*/ /*}}}*/ void IntVecParam::Marshall(MarshallHandle* marshallhandle){ /*{{{*/ int object_enum = IntVecParamEnum; marshallhandle->call(object_enum); marshallhandle->call(this->enum_type); marshallhandle->call(this->M); if(M){ marshallhandle->call(this->values,M); } else{ this->values=NULL; } } /*}}}*/ int IntVecParam::ObjectEnum(void){/*{{{*/ return IntVecParamEnum; } /*}}}*/ /*IntVecParam virtual functions definitions: */ void IntVecParam::GetParameterValue(int** pintarray,int* pM){/*{{{*/ int* output=NULL; if(M){ output=xNew(M); xMemCpy(output,values,M); } /*Assign output pointers:*/ if(pM) *pM=M; *pintarray=output; } /*}}}*/ void IntVecParam::SetValue(int* intarray,int in_M){/*{{{*/ /*avoid leak: */ xDelete(this->values); if(in_M){ this->values=xNew(in_M); xMemCpy(this->values,intarray,in_M); } else this->values=NULL; this->M=in_M; } /*}}}*/