source: issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp@ 20827

Last change on this file since 20827 was 20827, checked in by agscott1, 9 years ago

CHG: Alphabetized all function names under classes

File size: 2.3 KB
RevLine 
[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]18IntMatParam::IntMatParam(){/*{{{*/
[8600]19 return;
20}
21/*}}}*/
[18064]22IntMatParam::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]32IntMatParam::~IntMatParam(){/*{{{*/
[12451]33 xDelete<int>(value);
[8600]34 return;
35}
36/*}}}*/
37
38/*Object virtual functions definitions:*/
[20827]39Param* IntMatParam::copy() {/*{{{*/
[8600]40
[20827]41 return new IntMatParam(this->enum_type,this->value,this->M,this->N);
[8600]42
43}
44/*}}}*/
[18064]45void IntMatParam::DeepEcho(void){/*{{{*/
[8600]46
47 int i,j;
[13622]48
[15104]49 _printf_("IntMatParam:\n");
50 _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
[15100]51 _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
[8600]52 for(i=0;i<this->M;i++){
[16149]53 for(j=0;j<this->N;j++){
[15100]54 _printf_("(" << i << "," << j << ") " << *(this->value+N*i+j) << "\n");
[8600]55 }
56 }
57}
58/*}}}*/
[20827]59void IntMatParam::Echo(void){/*{{{*/
[8600]60
[20827]61 _printf_("IntMatParam:\n");
62 _printf_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")\n");
63 _printf_(" matrix size: " << this->M << "x" << this->N << "\n");
[8600]64
65}
66/*}}}*/
[20827]67int IntMatParam::Id(void){ return -1; }/*{{{*/
[8600]68/*}}}*/
[19222]69void IntMatParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
[8600]70
[19222]71 MARSHALLING_ENUM(IntMatParamEnum);
72
73 MARSHALLING(enum_type);
74 MARSHALLING(M);
75 MARSHALLING(N);
76 MARSHALLING_DYNAMIC(value,int,M*N);
77}
78/*}}}*/
[20827]79int IntMatParam::ObjectEnum(void){/*{{{*/
[19222]80
[20827]81 return IntMatParamEnum;
82
83}
84/*}}}*/
85
[8600]86/*IntMatParam virtual functions definitions: */
[18064]87void IntMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){/*{{{*/
[8600]88 int* output=NULL;
89
[12451]90 output=xNew<int>(M*N);
[12474]91 xMemCpy<int>(output,value,M*N);
[8600]92
93 /*Assign output pointers:*/
94 if(pM) *pM=M;
95 if(pN) *pN=N;
96 *pintarray=output;
97}
98/*}}}*/
[18064]99void IntMatParam::SetValue(int* intarray,int in_M,int in_N){/*{{{*/
[8600]100
101 /*avoid leak: */
[12451]102 xDelete<int>(this->value);
[8600]103
[12451]104 this->value=xNew<int>(in_M*in_N);
[12474]105 xMemCpy<int>(this->value,intarray,in_M*in_N);
[8600]106
107 this->M=in_M;
108 this->N=in_N;
109}
110/*}}}*/
Note: See TracBrowser for help on using the repository browser.