source: issm/trunk-jpl/src/c/classes/Inputs2/IntInput2.cpp@ 24335

Last change on this file since 24335 was 24335, checked in by Mathieu Morlighem, 5 years ago

NEW: added Inputs2, TODO: still AMR, GEMB and DC do not work, and need to delete current Inputs

File size: 2.0 KB
Line 
1/*!\file IntInput2.c
2 * \brief: implementation of the IntInput2 object
3 */
4
5#ifdef HAVE_CONFIG_H
6 #include <config.h>
7#else
8#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
9#endif
10
11#include "../classes.h"
12#include "../../shared/shared.h"
13#include "./IntInput2.h"
14
15/*IntInput2 constructors and destructor*/
16IntInput2::IntInput2(){/*{{{*/
17 this->size = -1;
18 this->values = NULL;
19}
20/*}}}*/
21IntInput2::IntInput2(int size_in){/*{{{*/
22 _assert_(size_in>0);
23 _assert_(size_in<1e11);
24 this->size = size_in;
25 this->values = xNew<int>(size_in);
26}
27/*}}}*/
28IntInput2::~IntInput2(){/*{{{*/
29 xDelete<int>(this->values);
30}
31/*}}}*/
32
33/*Object virtual functions definitions:*/
34Input2* IntInput2::copy() {/*{{{*/
35
36 IntInput2* output = new IntInput2(this->size);
37 xMemCpy<int>(output->values,this->values,this->size);
38
39 return output;
40}
41/*}}}*/
42void IntInput2::DeepEcho(void){/*{{{*/
43
44 _printf_("IntInput2 Echo:\n");
45 _printf_(" Size: "<<size<<"\n");
46 printarray(this->values,this->size);
47 //_printf_(setw(15)<<" IntInput2 "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n");
48}
49/*}}}*/
50void IntInput2::Echo(void){/*{{{*/
51 this->DeepEcho();
52}
53/*}}}*/
54int IntInput2::Id(void){ return -1; }/*{{{*/
55/*}}}*/
56void IntInput2::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
57
58 MARSHALLING_ENUM(IntInput2Enum);
59
60 MARSHALLING(this->size);
61 if(this->size > 0){
62 MARSHALLING_DYNAMIC(this->values,int,this->size)
63 }
64 else this->values = NULL;
65
66}
67/*}}}*/
68int IntInput2::ObjectEnum(void){/*{{{*/
69
70 return IntInput2Enum;
71
72}
73/*}}}*/
74
75/*IntInput2 management*/
76void IntInput2::GetInput(int* pvalue,int index){/*{{{*/
77
78 if(index<0){
79 printf("-------------- file: IntInput2.cpp line: %i\n",__LINE__);
80 int* temp = xNew<int>(3);
81 }
82 _assert_(index>=0);
83 _assert_(index<this->size);
84
85 *pvalue = this->values[index];
86}
87/*}}}*/
88void IntInput2::SetInput(int index,int value){/*{{{*/
89
90 _assert_(index>=0);
91 _assert_(index<this->size);
92
93 this->values[index] = value;
94}
95/*}}}*/
96
97/*Object functions*/
Note: See TracBrowser for help on using the repository browser.