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*/
|
---|
16 | IntInput2::IntInput2(){/*{{{*/
|
---|
17 | this->size = -1;
|
---|
18 | this->values = NULL;
|
---|
19 | }
|
---|
20 | /*}}}*/
|
---|
21 | IntInput2::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 | /*}}}*/
|
---|
28 | IntInput2::~IntInput2(){/*{{{*/
|
---|
29 | xDelete<int>(this->values);
|
---|
30 | }
|
---|
31 | /*}}}*/
|
---|
32 |
|
---|
33 | /*Object virtual functions definitions:*/
|
---|
34 | Input2* 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 | /*}}}*/
|
---|
42 | void 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 | /*}}}*/
|
---|
50 | void IntInput2::Echo(void){/*{{{*/
|
---|
51 | this->DeepEcho();
|
---|
52 | }
|
---|
53 | /*}}}*/
|
---|
54 | int IntInput2::Id(void){ return -1; }/*{{{*/
|
---|
55 | /*}}}*/
|
---|
56 | void 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 | /*}}}*/
|
---|
68 | int IntInput2::ObjectEnum(void){/*{{{*/
|
---|
69 |
|
---|
70 | return IntInput2Enum;
|
---|
71 |
|
---|
72 | }
|
---|
73 | /*}}}*/
|
---|
74 |
|
---|
75 | /*IntInput2 management*/
|
---|
76 | void 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 | /*}}}*/
|
---|
88 | void 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*/
|
---|