Changeset 8536
- Timestamp:
- 06/07/11 15:37:28 (14 years ago)
- Location:
- issm/trunk/src/c/Container
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Options.cpp
r8224 r8536 213 213 memcpy(outstring,default_value,stringsize*sizeof(char)); 214 214 *pvalue=outstring; 215 } 216 217 } 218 /*}}}*/ 219 /*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{1*/ 220 void Options::Get(char*** ppvalue,int* numel,const char* name){ 221 222 vector<Object*>::iterator object; 223 Option* option=NULL; 224 Option* option2=NULL; 225 Options* options=NULL; 226 int i; 227 228 /*Get option*/ 229 option=GetOption(name); 230 231 /*If the pointer is not NULL, the option has been found*/ 232 if(option){ 233 /*If the object is a Cell, copy the strings from its options dataset*/ 234 if(option->Enum()==OptionCellEnum){ 235 if (option->NumEl()) { 236 *ppvalue=(char **) xmalloc(option->NumEl()*sizeof(char *)); 237 if (numel) *numel=option->NumEl(); 238 option->Get(&options); 239 for (i=0; i<option->NumEl(); i++) { 240 option2=((Option *)options->GetObjectByOffset(i)); 241 if(option2->Enum()==OptionCharEnum && option2->NDims()==2) 242 option2->Get(&((*ppvalue)[i])); 243 else 244 ((*ppvalue)[i])=NULL; 245 } 246 } 247 } 248 /*Else: not supported*/ 249 else{ 250 _error_("Cannot recover field \"%s\" for an option of type %s",name,EnumToStringx(option->Enum())); 251 } 252 } 253 /*Else, the Option does not exist, no default provided*/ 254 else{ 255 *ppvalue=NULL; 256 if (numel) *numel=0; 215 257 } 216 258 -
issm/trunk/src/c/Container/Options.h
r7760 r8536 29 29 void Get(char** pvalue,const char* name); 30 30 void Get(char** pvalue,const char* name,const char* default_value); 31 void Get(char*** pvalue,int* numel,const char* name); 31 32 void Get(double** pvalue,int* numel,const char* name); 32 33 };
Note:
See TracChangeset
for help on using the changeset viewer.