source: issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp@ 12832

Last change on this file since 12832 was 12832, checked in by Eric.Larour, 13 years ago

Almost done migrating objects to classes

File size: 2.6 KB
Line 
1/*!\file VectorParam.c
2 * \brief: implementation of the VectorParam object
3 */
4
5/*header files: */
6/*{{{*/
7#ifdef HAVE_CONFIG_H
8 #include <config.h>
9#else
10#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11#endif
12
13#include <stdio.h>
14#include <string.h>
15#include "../objects.h"
16#include "../../../EnumDefinitions/EnumDefinitions.h"
17#include "../../../shared/shared.h"
18#include "../../../Container/Container.h"
19#include "../../../include/include.h"
20/*}}}*/
21
22/*VectorParam constructors and destructor*/
23/*FUNCTION VectorParam::VectorParam(){{{*/
24VectorParam::VectorParam(){
25 return;
26}
27/*}}}*/
28/*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/
29VectorParam::VectorParam(int in_enum_type,Vector* in_value){
30
31 enum_type=in_enum_type;
32
33 value=NULL;
34
35 if(in_value){
36 value=in_value->Duplicate();
37 in_value->Copy(value);
38 }
39}
40/*}}}*/
41/*FUNCTION VectorParam::~VectorParam(){{{*/
42VectorParam::~VectorParam(){
43 xdelete(&value);
44}
45/*}}}*/
46
47/*Object virtual functions definitions:*/
48/*FUNCTION VectorParam::Echo {{{*/
49void VectorParam::Echo(void){
50
51 _printLine_("VectorParam:");
52 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
53
54}
55/*}}}*/
56/*FUNCTION VectorParam::DeepEcho{{{*/
57void VectorParam::DeepEcho(void){
58
59 int i;
60 _printLine_("VectorParam:");
61 _printLine_(" enum: " << this->enum_type << " (" << EnumToStringx(this->enum_type) << ")");
62 value->Echo();
63}
64/*}}}*/
65/*FUNCTION VectorParam::Id{{{*/
66int VectorParam::Id(void){ return -1; }
67/*}}}*/
68/*FUNCTION VectorParam::MyRank{{{*/
69int VectorParam::MyRank(void){
70 extern int my_rank;
71 return my_rank;
72}
73/*}}}*/
74/*FUNCTION VectorParam::ObjectEnum{{{*/
75int VectorParam::ObjectEnum(void){
76
77 return VectorParamEnum;
78
79}
80/*}}}*/
81/*FUNCTION VectorParam::copy{{{*/
82Object* VectorParam::copy() {
83
84 return new VectorParam(this->enum_type,this->value);
85
86}
87/*}}}*/
88
89/*VectorParam virtual functions definitions: */
90/*FUNCTION VectorParam::GetParameterValue{{{*/
91void VectorParam::GetParameterValue(Vector** poutput){
92 Vector* output=NULL;
93
94 if(value){
95 output=value->Duplicate();
96 value->Copy(output);
97 }
98 *poutput=output;
99}
100/*}}}*/
101/*FUNCTION VectorParam::GetParameterName{{{*/
102void VectorParam::GetParameterName(char**pname){
103 EnumToStringx(pname,this->enum_type);
104}
105/*}}}*/
106/*FUNCTION VectorParam::SetValue{{{*/
107void VectorParam::SetValue(Vector* vector){
108
109 /*avoid leak: */
110 xdelete(&value);
111
112 /*copy: */
113 value=vector->Duplicate();
114 vector->Copy(value);
115}
116/*}}}*/
117/*FUNCTION VectorParam::UnitConversion{{{*/
118void VectorParam::UnitConversion(int direction_enum){
119 /*do nothing, no unit conversion*/
120}
121/*}}}*/
Note: See TracBrowser for help on using the repository browser.