Ice Sheet System Model  4.18
Code documentation
Public Member Functions | Data Fields
GenericOption< OptionType > Class Template Reference

#include <GenericOption.h>

Inheritance diagram for GenericOption< OptionType >:
Option Object

Public Member Functions

 GenericOption ()
 
 ~GenericOption ()
 
Objectcopy ()
 
void DeepEcho ()
 
void DeepEcho (char *indent)
 
void Echo ()
 
int Id ()
 
int ObjectEnum ()
 
void Get (OptionType *pvalue)
 
char * Name ()
 
void Get (IssmDouble **pvalue)
 
void Get (char **pvalue)
 
 ~GenericOption ()
 
- Public Member Functions inherited from Option
 Option ()
 
 ~Option ()
 
Objectcopy ()
 
int Id ()
 
void Marshall (char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
 
int ObjectEnum ()
 
- Public Member Functions inherited from Object
virtual ~Object ()
 

Data Fields

char * name
 
OptionType value
 
int size [2]
 

Detailed Description

template<class OptionType>
class GenericOption< OptionType >

Definition at line 22 of file GenericOption.h.

Constructor & Destructor Documentation

◆ GenericOption()

template<class OptionType >
GenericOption< OptionType >::GenericOption ( )
inline

Definition at line 30 of file GenericOption.h.

30  { /*{{{*/
31  name = NULL;
32  size[0] = 0;
33  size[1] = 0;
34  } /*}}}*/

◆ ~GenericOption() [1/2]

template<class OptionType >
GenericOption< OptionType >::~GenericOption ( )
inline

Definition at line 35 of file GenericOption.h.

35  { /*{{{*/
36  if(name) xDelete<char>(name);
37  } /*}}}*/

◆ ~GenericOption() [2/2]

GenericOption< char * >::~GenericOption ( )
inline

Definition at line 108 of file GenericOption.h.

108  { /*{{{*/
109  if(name) xDelete<char>(name);
110  if(value) xDelete<char>(value);
111 }

Member Function Documentation

◆ copy()

template<class OptionType >
Object* GenericOption< OptionType >::copy ( void  )
inlinevirtual

Implements Object.

Definition at line 40 of file GenericOption.h.

40  {/*{{{*/
41  _error_("Not implemented yet");
42  };/*}}}*/

◆ DeepEcho() [1/2]

template<class OptionType >
void GenericOption< OptionType >::DeepEcho ( void  )
inlinevirtual

Implements Option.

Definition at line 43 of file GenericOption.h.

43  { /*{{{*/
44  char indent[81]="";
45  this->DeepEcho(indent);
46  } /*}}}*/

◆ DeepEcho() [2/2]

template<class OptionType >
void GenericOption< OptionType >::DeepEcho ( char *  indent)
inlinevirtual

Implements Option.

Definition at line 47 of file GenericOption.h.

47  { /*{{{*/
48 
49  char cstr[81];
50 
51  _printf_(indent << " name: \"" << name << "\"\n");
52  _printf_(indent << " size: " << size[0] <<"x"<<size[1]<< "\n");
53  _printf_(indent << " value: " << value << "\n");
54  } /*}}}*/

◆ Echo()

template<class OptionType >
void GenericOption< OptionType >::Echo ( void  )
inlinevirtual

Implements Option.

Definition at line 55 of file GenericOption.h.

55  { /*{{{*/
56  this->DeepEcho();
57  } /*}}}*/

◆ Id()

template<class OptionType >
int GenericOption< OptionType >::Id ( void  )
inlinevirtual

Implements Object.

Definition at line 58 of file GenericOption.h.

58  {/*{{{*/
59  _error_("Not implemented yet");
60  };/*}}}*/

◆ ObjectEnum()

template<class OptionType >
int GenericOption< OptionType >::ObjectEnum ( void  )
inlinevirtual

Implements Object.

Definition at line 61 of file GenericOption.h.

61  {/*{{{*/
62  return GenericOptionEnum;
63  };/*}}}*/

◆ Get() [1/3]

template<class OptionType >
void GenericOption< OptionType >::Get ( OptionType *  pvalue)
inline

Definition at line 66 of file GenericOption.h.

66  {/*{{{*/
67  *pvalue=value;
68  };/*}}}*/

◆ Name()

template<class OptionType >
char* GenericOption< OptionType >::Name ( )
inlinevirtual

Implements Option.

Definition at line 69 of file GenericOption.h.

69  {/*{{{*/
70  return name;
71  };/*}}}*/

◆ Get() [2/3]

void GenericOption< IssmDouble * >::Get ( IssmDouble **  pvalue)
inline

Definition at line 87 of file GenericOption.h.

87  { /*{{{*/
88 
89  /*Copy vector*/
90  int numel = this->size[0]*this->size[1];
91  IssmDouble* outvalue=xNew<IssmDouble>(numel);
92  for(int i=0;i<numel;i++) outvalue[i]=this->value[i];
93 
94  /*Assign output pointer*/
95  *pvalue=outvalue;
96 } /*}}}*/

◆ Get() [3/3]

void GenericOption< char * >::Get ( char **  pvalue)
inline

Definition at line 97 of file GenericOption.h.

97  { /*{{{*/
98 
99  int stringsize=strlen(this->value)+1;
100  char* outstring=xNew<char>(stringsize);
101  xMemCpy<char>(outstring,this->value,stringsize);
102 
103  *pvalue=outstring;
104 }

Field Documentation

◆ name

template<class OptionType >
char* GenericOption< OptionType >::name

Definition at line 25 of file GenericOption.h.

◆ value

template<class OptionType >
OptionType GenericOption< OptionType >::value

Definition at line 26 of file GenericOption.h.

◆ size

template<class OptionType >
int GenericOption< OptionType >::size[2]

Definition at line 27 of file GenericOption.h.


The documentation for this class was generated from the following file:
GenericOption::size
int size[2]
Definition: GenericOption.h:27
IssmDouble
double IssmDouble
Definition: types.h:37
_printf_
#define _printf_(StreamArgs)
Definition: Print.h:22
GenericOption::name
char * name
Definition: GenericOption.h:25
GenericOption::value
OptionType value
Definition: GenericOption.h:26
GenericOption::DeepEcho
void DeepEcho()
Definition: GenericOption.h:43
GenericOptionEnum
@ GenericOptionEnum
Definition: EnumDefinitions.h:1082
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49