Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Private Attributes
StringParam Class Reference

#include <StringParam.h>

Inheritance diagram for StringParam:
Param Object

Public Member Functions

 StringParam ()
 
 StringParam (int enum_type, char *value)
 
 ~StringParam ()
 
Paramcopy ()
 
void DeepEcho ()
 
void Echo ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
void GetParameterValue (bool *pbool)
 
void GetParameterValue (int *pinteger)
 
void GetParameterValue (int **pintarray, int *pM)
 
void GetParameterValue (int **pintarray, int *pM, int *pN)
 
void GetParameterValue (IssmDouble *pIssmDouble)
 
void GetParameterValue (IssmDouble *pdouble, IssmDouble time)
 
void GetParameterValue (char **pstring)
 
void GetParameterValue (char ***pstringarray, int *pM)
 
void GetParameterValue (IssmDouble **pIssmDoublearray, int *pM)
 
void GetParameterValue (IssmDouble **pIssmDoublearray, int *pM, int *pN)
 
void GetParameterValue (IssmDouble ***parray, int *pM, int **pmdims, int **pndims)
 
void GetParameterValue (Vector< IssmDouble > **pvec)
 
void GetParameterValue (Matrix< IssmDouble > **pmat)
 
void GetParameterValue (FILE **pfid)
 
void GetParameterValue (DataSet **pdataset)
 
int InstanceEnum ()
 
void SetEnum (int enum_in)
 
void SetValue (bool boolean)
 
void SetValue (int integer)
 
void SetValue (IssmDouble scalar)
 
void SetValue (char *string)
 
void SetValue (char **stringarray, int M)
 
void SetValue (IssmDouble *IssmDoublearray, int M)
 
void SetValue (IssmDouble *pIssmDoublearray, int M, int N)
 
void SetValue (int *intarray, int M)
 
void SetValue (int *pintarray, int M, int N)
 
void SetValue (Vector< IssmDouble > *vec)
 
void SetValue (Matrix< IssmDouble > *mat)
 
void SetValue (FILE *fid)
 
void SetValue (IssmDouble **array, int M, int *mdim_array, int *ndim_array)
 
- Public Member Functions inherited from Param
virtual ~Param ()
 
virtual void GetParameterValue (IssmDouble *pdouble, int row, IssmDouble time)
 
virtual void SetValue (DataSet *dataset)
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Private Attributes

int enum_type
 
char * value
 

Detailed Description

Definition at line 20 of file StringParam.h.

Constructor & Destructor Documentation

◆ StringParam() [1/2]

StringParam::StringParam ( )

Definition at line 18 of file StringParam.cpp.

18  {/*{{{*/
19  return;
20 }

◆ StringParam() [2/2]

StringParam::StringParam ( int  enum_type,
char *  value 
)

Definition at line 22 of file StringParam.cpp.

22  {/*{{{*/
23 
24  enum_type=in_enum_type;
25  value=xNew<char>(strlen(in_value)+1);
26  xMemCpy<char>(value,in_value,(strlen(in_value)+1));
27 
28 }

◆ ~StringParam()

StringParam::~StringParam ( )

Definition at line 30 of file StringParam.cpp.

30  {/*{{{*/
31  xDelete<char>(value);
32 }

Member Function Documentation

◆ copy()

Param * StringParam::copy ( void  )
virtual

Implements Param.

Definition at line 36 of file StringParam.cpp.

36  {/*{{{*/
37 
38  return new StringParam(this->enum_type,this->value);
39 
40 }

◆ DeepEcho()

void StringParam::DeepEcho ( void  )
virtual

Implements Param.

Definition at line 42 of file StringParam.cpp.

42  {/*{{{*/
43  _printf_(setw(22)<<" StringParam "<<setw(35)<<left<<EnumToStringx(this->enum_type)<<" "<<this->value<<"\n");
44 }

◆ Echo()

void StringParam::Echo ( void  )
virtual

Implements Param.

Definition at line 46 of file StringParam.cpp.

46  {/*{{{*/
47  this->DeepEcho();
48 }

◆ Id()

int StringParam::Id ( void  )
virtual

Implements Object.

Definition at line 50 of file StringParam.cpp.

50 { return -1; }/*{{{*/

◆ Marshall()

void StringParam::Marshall ( char **  pmarshalled_data,
int *  pmarshalled_data_size,
int  marshall_direction 
)
virtual

Implements Param.

Definition at line 52 of file StringParam.cpp.

52  { /*{{{*/
53 
54  int size = 0;
55 
56  if(marshall_direction==MARSHALLING_FORWARD || marshall_direction == MARSHALLING_SIZE)size=strlen(value)+1;
57 
60  MARSHALLING(size);
61  MARSHALLING_DYNAMIC(value,char,size);
62 
63 }

◆ ObjectEnum()

int StringParam::ObjectEnum ( void  )
virtual

Implements Param.

Definition at line 65 of file StringParam.cpp.

65  {/*{{{*/
66 
67  return StringParamEnum;
68 
69 }

◆ GetParameterValue() [1/15]

void StringParam::GetParameterValue ( bool *  pbool)
inlinevirtual

Implements Param.

Definition at line 42 of file StringParam.h.

42 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a bool");}

◆ GetParameterValue() [2/15]

void StringParam::GetParameterValue ( int *  pinteger)
inlinevirtual

Implements Param.

Definition at line 43 of file StringParam.h.

43 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return an integer");}

◆ GetParameterValue() [3/15]

void StringParam::GetParameterValue ( int **  pintarray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 44 of file StringParam.h.

44 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}

◆ GetParameterValue() [4/15]

void StringParam::GetParameterValue ( int **  pintarray,
int *  pM,
int *  pN 
)
inlinevirtual

Implements Param.

Definition at line 45 of file StringParam.h.

45 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return an array of integers");}

◆ GetParameterValue() [5/15]

void StringParam::GetParameterValue ( IssmDouble pIssmDouble)
inlinevirtual

Implements Param.

Definition at line 46 of file StringParam.h.

46 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble");}

◆ GetParameterValue() [6/15]

void StringParam::GetParameterValue ( IssmDouble pdouble,
IssmDouble  time 
)
inlinevirtual

Implements Param.

Definition at line 47 of file StringParam.h.

47 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble for a given time");}

◆ GetParameterValue() [7/15]

void StringParam::GetParameterValue ( char **  pstring)
virtual

Implements Param.

Definition at line 73 of file StringParam.cpp.

73  {/*{{{*/
74 
75  char* outstring=NULL;
76  int stringsize;
77 
78  stringsize=strlen(this->value)+1;
79 
80  outstring=xNew<char>(stringsize);
81  xMemCpy<char>(outstring,this->value,stringsize);
82 
83  *pstring=outstring;
84 
85 }

◆ GetParameterValue() [8/15]

void StringParam::GetParameterValue ( char ***  pstringarray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 49 of file StringParam.h.

49 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a string array");}

◆ GetParameterValue() [9/15]

void StringParam::GetParameterValue ( IssmDouble **  pIssmDoublearray,
int *  pM 
)
inlinevirtual

Implements Param.

Definition at line 50 of file StringParam.h.

50 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}

◆ GetParameterValue() [10/15]

void StringParam::GetParameterValue ( IssmDouble **  pIssmDoublearray,
int *  pM,
int *  pN 
)
inlinevirtual

Implements Param.

Definition at line 51 of file StringParam.h.

51 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}

◆ GetParameterValue() [11/15]

void StringParam::GetParameterValue ( IssmDouble ***  parray,
int *  pM,
int **  pmdims,
int **  pndims 
)
inlinevirtual

Implements Param.

Definition at line 52 of file StringParam.h.

52 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}

◆ GetParameterValue() [12/15]

void StringParam::GetParameterValue ( Vector< IssmDouble > **  pvec)
inlinevirtual

Implements Param.

Definition at line 53 of file StringParam.h.

53 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}

◆ GetParameterValue() [13/15]

void StringParam::GetParameterValue ( Matrix< IssmDouble > **  pmat)
inlinevirtual

Implements Param.

Definition at line 54 of file StringParam.h.

54 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}

◆ GetParameterValue() [14/15]

void StringParam::GetParameterValue ( FILE **  pfid)
inlinevirtual

Implements Param.

Definition at line 55 of file StringParam.h.

55 {_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");}

◆ GetParameterValue() [15/15]

void StringParam::GetParameterValue ( DataSet **  pdataset)
inlinevirtual

Implements Param.

Definition at line 56 of file StringParam.h.

56 {_error_("Param "<< EnumToStringx(enum_type) << " cannot return a DataSet");}

◆ InstanceEnum()

int StringParam::InstanceEnum ( )
inlinevirtual

Implements Param.

Definition at line 57 of file StringParam.h.

57 {return enum_type;}

◆ SetEnum()

void StringParam::SetEnum ( int  enum_in)
inlinevirtual

Implements Param.

Definition at line 59 of file StringParam.h.

59 {this->enum_type = enum_in;};

◆ SetValue() [1/13]

void StringParam::SetValue ( bool  boolean)
inlinevirtual

Implements Param.

Definition at line 60 of file StringParam.h.

60 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a boolean");}

◆ SetValue() [2/13]

void StringParam::SetValue ( int  integer)
inlinevirtual

Implements Param.

Definition at line 61 of file StringParam.h.

61 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an integer");}

◆ SetValue() [3/13]

void StringParam::SetValue ( IssmDouble  scalar)
inlinevirtual

Implements Param.

Definition at line 62 of file StringParam.h.

62 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a scalar");}

◆ SetValue() [4/13]

void StringParam::SetValue ( char *  string)
virtual

Implements Param.

Definition at line 87 of file StringParam.cpp.

87  {/*{{{*/
88 
89  int stringsize;
90 
91  /*avoid leak: */
92  xDelete<char>(this->value);
93 
94  /*copy: */
95  stringsize=strlen(string)+1;
96  this->value=xNew<char>(stringsize);
97  xMemCpy<char>(this->value,string,stringsize);
98 
99 }

◆ SetValue() [5/13]

void StringParam::SetValue ( char **  stringarray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 64 of file StringParam.h.

64 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");}

◆ SetValue() [6/13]

void StringParam::SetValue ( IssmDouble IssmDoublearray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 65 of file StringParam.h.

65 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");}

◆ SetValue() [7/13]

void StringParam::SetValue ( IssmDouble pIssmDoublearray,
int  M,
int  N 
)
inlinevirtual

Implements Param.

Definition at line 66 of file StringParam.h.

66 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");}

◆ SetValue() [8/13]

void StringParam::SetValue ( int *  intarray,
int  M 
)
inlinevirtual

Implements Param.

Definition at line 67 of file StringParam.h.

67 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}

◆ SetValue() [9/13]

void StringParam::SetValue ( int *  pintarray,
int  M,
int  N 
)
inlinevirtual

Implements Param.

Definition at line 68 of file StringParam.h.

68 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}

◆ SetValue() [10/13]

void StringParam::SetValue ( Vector< IssmDouble > *  vec)
inlinevirtual

Implements Param.

Definition at line 69 of file StringParam.h.

69 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}

◆ SetValue() [11/13]

void StringParam::SetValue ( Matrix< IssmDouble > *  mat)
inlinevirtual

Implements Param.

Definition at line 70 of file StringParam.h.

70 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}

◆ SetValue() [12/13]

void StringParam::SetValue ( FILE *  fid)
inlinevirtual

Implements Param.

Definition at line 71 of file StringParam.h.

71 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}

◆ SetValue() [13/13]

void StringParam::SetValue ( IssmDouble **  array,
int  M,
int *  mdim_array,
int *  ndim_array 
)
inlinevirtual

Implements Param.

Definition at line 72 of file StringParam.h.

72 {_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}

Field Documentation

◆ enum_type

int StringParam::enum_type
private

Definition at line 24 of file StringParam.h.

◆ value

char* StringParam::value
private

Definition at line 25 of file StringParam.h.


The documentation for this class was generated from the following files:
StringParamEnum
@ StringParamEnum
Definition: EnumDefinitions.h:1292
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
MARSHALLING_SIZE
@ MARSHALLING_SIZE
Definition: Marshalling.h:11
StringParam::StringParam
StringParam()
Definition: StringParam.cpp:18
MARSHALLING_DYNAMIC
#define MARSHALLING_DYNAMIC(FIELD, TYPE, SIZE)
Definition: Marshalling.h:61
StringParam::enum_type
int enum_type
Definition: StringParam.h:24
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
StringParam::value
char * value
Definition: StringParam.h:25
StringParam::DeepEcho
void DeepEcho()
Definition: StringParam.cpp:42
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
MARSHALLING_FORWARD
@ MARSHALLING_FORWARD
Definition: Marshalling.h:9