[8600] | 1 | /*!\file IntMatParam.c
|
---|
| 2 | * \brief: implementation of the IntMatParam object
|
---|
| 3 | */
|
---|
| 4 |
|
---|
| 5 | /*header files: */
|
---|
[12365] | 6 | /*{{{*/
|
---|
[8600] | 7 | #ifdef HAVE_CONFIG_H
|
---|
[9320] | 8 | #include <config.h>
|
---|
[8600] | 9 | #else
|
---|
| 10 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
[15012] | 13 | #include "../classes.h"
|
---|
| 14 | #include "shared/shared.h"
|
---|
[8600] | 15 | /*}}}*/
|
---|
| 16 |
|
---|
| 17 | /*IntMatParam constructors and destructor*/
|
---|
[18064] | 18 | IntMatParam::IntMatParam(){/*{{{*/
|
---|
[8600] | 19 | return;
|
---|
| 20 | }
|
---|
| 21 | /*}}}*/
|
---|
[18064] | 22 | IntMatParam::IntMatParam(int in_enum_type,int* in_value, int in_M,int in_N){/*{{{*/
|
---|
[8600] | 23 |
|
---|
| 24 | enum_type=in_enum_type;
|
---|
| 25 | M=in_M;
|
---|
| 26 | N=in_N;
|
---|
| 27 |
|
---|
[12451] | 28 | value=xNew<int>(M*N);
|
---|
[12474] | 29 | xMemCpy<int>(value,in_value,M*N);
|
---|
[8600] | 30 | }
|
---|
| 31 | /*}}}*/
|
---|
[18064] | 32 | IntMatParam::~IntMatParam(){/*{{{*/
|
---|
[12451] | 33 | xDelete<int>(value);
|
---|
[8600] | 34 | return;
|
---|
| 35 | }
|
---|
| 36 | /*}}}*/
|
---|
| 37 |
|
---|
| 38 | /*Object virtual functions definitions:*/
|
---|
[18064] | 39 | void IntMatParam::Echo(void){/*{{{*/
|
---|
[8600] | 40 |
|
---|
[15104] | 41 | _printf_("IntMatParam:\n");
|
---|
| 42 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
---|
[15100] | 43 | _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
|
---|
[8600] | 44 |
|
---|
| 45 | }
|
---|
| 46 | /*}}}*/
|
---|
[18064] | 47 | void IntMatParam::DeepEcho(void){/*{{{*/
|
---|
[8600] | 48 |
|
---|
| 49 | int i,j;
|
---|
[13622] | 50 |
|
---|
[15104] | 51 | _printf_("IntMatParam:\n");
|
---|
| 52 | _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
|
---|
[15100] | 53 | _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
|
---|
[8600] | 54 | for(i=0;i<this->M;i++){
|
---|
[16149] | 55 | for(j=0;j<this->N;j++){
|
---|
[15100] | 56 | _printf_("(" << i << "," << j << ") " << *(this->value+N*i+j) << "\n");
|
---|
[8600] | 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 | /*}}}*/
|
---|
[18064] | 61 | int IntMatParam::Id(void){ return -1; }/*{{{*/
|
---|
[8600] | 62 | /*}}}*/
|
---|
[18064] | 63 | int IntMatParam::ObjectEnum(void){/*{{{*/
|
---|
[8600] | 64 |
|
---|
| 65 | return IntMatParamEnum;
|
---|
| 66 |
|
---|
| 67 | }
|
---|
| 68 | /*}}}*/
|
---|
[18064] | 69 | Object* IntMatParam::copy() {/*{{{*/
|
---|
[13622] | 70 |
|
---|
[8600] | 71 | return new IntMatParam(this->enum_type,this->value,this->M,this->N);
|
---|
| 72 |
|
---|
| 73 | }
|
---|
| 74 | /*}}}*/
|
---|
| 75 |
|
---|
| 76 | /*IntMatParam virtual functions definitions: */
|
---|
[18064] | 77 | void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){/*{{{*/
|
---|
[8600] | 78 | int* output=NULL;
|
---|
| 79 |
|
---|
[12451] | 80 | output=xNew<int>(M*N);
|
---|
[12474] | 81 | xMemCpy<int>(output,value,M*N);
|
---|
[8600] | 82 |
|
---|
| 83 | /*Assign output pointers:*/
|
---|
| 84 | if(pM) *pM=M;
|
---|
| 85 | if(pN) *pN=N;
|
---|
| 86 | *pintarray=output;
|
---|
| 87 | }
|
---|
| 88 | /*}}}*/
|
---|
[18064] | 89 | void IntMatParam::SetValue(int* intarray,int in_M,int in_N){/*{{{*/
|
---|
[8600] | 90 |
|
---|
| 91 | /*avoid leak: */
|
---|
[12451] | 92 | xDelete<int>(this->value);
|
---|
[8600] | 93 |
|
---|
[12451] | 94 | this->value=xNew<int>(in_M*in_N);
|
---|
[12474] | 95 | xMemCpy<int>(this->value,intarray,in_M*in_N);
|
---|
[8600] | 96 |
|
---|
| 97 | this->M=in_M;
|
---|
| 98 | this->N=in_N;
|
---|
| 99 | }
|
---|
| 100 | /*}}}*/
|
---|