Changeset 12330 for issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
- Timestamp:
- 06/01/12 17:26:03 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
r11995 r12330 59 59 } 60 60 /*}}}*/ 61 #ifdef _SERIAL_62 /*FUNCTION DoubleInput::Marshall{{{1*/63 void DoubleInput::Marshall(char** pmarshalled_dataset){64 65 char* marshalled_dataset=NULL;66 int enum_value=0;67 68 /*recover marshalled_dataset: */69 marshalled_dataset=*pmarshalled_dataset;70 71 /*get enum value of DoubleInput: */72 enum_value=DoubleInputEnum;73 74 /*marshall enum: */75 memcpy(marshalled_dataset,&enum_value,sizeof(enum_value));marshalled_dataset+=sizeof(enum_value);76 77 /*marshall DoubleInput data: */78 memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);79 memcpy(marshalled_dataset,&value,sizeof(value));marshalled_dataset+=sizeof(value);80 81 *pmarshalled_dataset=marshalled_dataset;82 }83 /*}}}*/84 /*FUNCTION DoubleInput::MarshallSize{{{1*/85 int DoubleInput::MarshallSize(){86 87 return sizeof(value)+88 +sizeof(enum_type)+89 +sizeof(int); //sizeof(int) for enum value90 }91 /*}}}*/92 /*FUNCTION DoubleInput::Demarshall{{{1*/93 void DoubleInput::Demarshall(char** pmarshalled_dataset){94 95 char* marshalled_dataset=NULL;96 int i;97 98 /*recover marshalled_dataset: */99 marshalled_dataset=*pmarshalled_dataset;100 101 /*this time, no need to get enum type, the pointer directly points to the beginning of the102 *object data (thanks to DataSet::Demarshall):*/103 memcpy(&enum_type,marshalled_dataset,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);104 memcpy(&value,marshalled_dataset,sizeof(value));marshalled_dataset+=sizeof(value);105 106 /*return: */107 *pmarshalled_dataset=marshalled_dataset;108 return;109 }110 /*}}}*/111 #endif112 61 /*FUNCTION DoubleInput::ObjectEnum{{{1*/ 113 62 int DoubleInput::ObjectEnum(void){ … … 159 108 /*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{1*/ 160 109 void DoubleInput::GetInputValue(bool* pvalue){ 161 #ifdef _SERIAL_162 *pvalue=(bool)value;163 #else164 110 _error_("Double input of enum %s cannot return a boolean",EnumToStringx(enum_type)); 165 #endif166 111 167 112 } … … 169 114 /*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{1*/ 170 115 void DoubleInput::GetInputValue(int* pvalue){ 171 #ifdef _SERIAL_172 *pvalue=(int)value;173 #else174 116 _error_("Double input of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type)); 175 #endif176 117 177 118 }
Note:
See TracChangeset
for help on using the changeset viewer.