Changeset 8564
- Timestamp:
- 06/08/11 14:09:17 (14 years ago)
- Location:
- issm/trunk/src/c/objects/Options
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Options/Option.h
r8535 r8564 48 48 virtual void Get(bool* pvalue)=0; 49 49 virtual void Get(char** pvalue)=0; 50 virtual void Get(char*** ppvalue,int *pnumel)=0; 50 51 virtual void Get(double** pvalue,int *pnumel)=0; 51 52 virtual void Get(Options** pvalue)=0; 52 virtual void Get(Options*** p value,int *pnumel)=0;53 virtual void Get(Options*** ppvalue,int *pnumel)=0; 53 54 54 55 }; -
issm/trunk/src/c/objects/Options/OptionCell.h
r8535 r8564 45 45 void Get(bool* pvalue){ _error_("An OptionCell object cannot return a bool");}; 46 46 void Get(char** pvalue){ _error_("An OptionCell object cannot return a string");}; 47 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return a string vec");}; 47 48 void Get(double** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a double vec");}; 48 49 void Get(Options** pvalue); 49 void Get(Options*** p value,int *pnumel){ _error_("An OptionCell object cannot return an Options DataSet vec");};50 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return an Options DataSet vec");}; 50 51 51 52 }; -
issm/trunk/src/c/objects/Options/OptionChar.cpp
r7746 r8564 72 72 void OptionChar::DeepEcho(char* indent){ 73 73 74 int i ;74 int i,nstr,ipt=0; 75 75 int* dims; 76 76 char indent2[81]; … … 85 85 86 86 if (values) { 87 // if (numel == 1) { 88 if (1) { 89 // _printf_(flag,"%s values: \"%s\"\n" ,indent,values[0]); 87 if (ndims == 2 && size[0] == 1) { 90 88 _printf_(flag,"%s values: \"%s\"\n" ,indent,values); 91 89 } 92 90 else { 91 nstr=size[0]; 92 for (i=2; i<ndims; i++) nstr*=size[i]; 93 93 94 dims=(int *) xmalloc(ndims*sizeof(int)); 94 for (i=0; i<n umel; i++) {95 RowWiseDimsFromIndex(dims,i ,size,ndims);95 for (i=0; i<nstr; i++) { 96 RowWiseDimsFromIndex(dims,ipt,size,ndims); 96 97 StringFromDims(cstr,dims,ndims); 97 _printf_(flag,"%s values%s: \"%s\"\n" ,indent,cstr,values[i]); 98 _printf_(flag,"%s values%s: \"%.*s\"\n" ,indent,cstr,size[1],&(values[ipt])); 99 ipt+=size[1]; 98 100 } 99 101 xfree((void**)&dims); … … 141 143 } 142 144 /*}}}*/ 145 /*FUNCTION OptionChar::Get(char*** ppvalue,int *pnumel) {{{1*/ 146 void OptionChar::Get(char*** ppvalue,int *pnumel){ 147 148 char* outstring=NULL; 149 int stringsize; 150 int i,nstr,ipt=0; 151 152 /*We should first check that the size is at least one*/ 153 if(this->NumEl()<=0){ 154 _error_("option \"%s\" is empty and cannot return a string vector",this->name); 155 } 156 157 /*Calculate the size and number of strings*/ 158 stringsize=this->size[1]+1; 159 nstr=this->size[0]; 160 for (i=2; i<this->ndims; i++) nstr*=this->size[i]; 161 162 /*Break concatenated string into individual strings*/ 163 *ppvalue=(char **) xmalloc(nstr*sizeof(char *)); 164 for (i=0; i<nstr; i++) { 165 outstring=(char*)xmalloc(stringsize*sizeof(char)); 166 memcpy(outstring,&(this->values[ipt]),(stringsize-1)*sizeof(char)); 167 outstring[stringsize-1]='\0'; 168 (*ppvalue)[i]=outstring; 169 ipt+=stringsize-1; 170 } 171 172 /*Assign output pointer*/ 173 if(numel) *pnumel=nstr; 174 } 175 /*}}}*/ -
issm/trunk/src/c/objects/Options/OptionChar.h
r8535 r8564 45 45 void Get(bool* pvalue){ _error_("An OptionChar object cannot return a bool");}; 46 46 void Get(char** pvalue); 47 void Get(char*** ppvalue,int *pnumel); 47 48 void Get(double** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a double vec");}; 48 49 void Get(Options** pvalue){ _error_("An OptionChar object cannot return an Options DataSet");}; 49 void Get(Options*** p value,int *pnumel){ _error_("An OptionChar object cannot return an Options DataSet vec");};50 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionChar object cannot return an Options DataSet vec");}; 50 51 51 52 }; -
issm/trunk/src/c/objects/Options/OptionDouble.h
r8535 r8564 45 45 void Get(bool* pvalue){ _error_("An OptionDouble object cannot return a bool");}; 46 46 void Get(char** pvalue){ _error_("An OptionDouble object cannot return a string");}; 47 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return a string vec");}; 47 48 void Get(double** pvalue,int* pnumel); 48 49 void Get(Options** pvalue){ _error_("An OptionDouble object cannot return an Options DataSet");}; 49 void Get(Options*** p value,int *pnumel){ _error_("An OptionDouble object cannot return an Options DataSet vec");};50 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return an Options DataSet vec");}; 50 51 51 52 }; -
issm/trunk/src/c/objects/Options/OptionLogical.h
r8535 r8564 45 45 void Get(bool* pvalue); 46 46 void Get(char** pvalue){ _error_("An OptionLogical object cannot return a string");}; 47 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return a string vec");}; 47 48 void Get(double** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a double vec");}; 48 49 void Get(Options** pvalue){ _error_("An OptionLogical object cannot return an Options DataSet");}; 49 void Get(Options*** p value,int *pnumel){ _error_("An OptionLogical object cannot return an Options DataSet vec");};50 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return an Options DataSet vec");}; 50 51 51 52 }; -
issm/trunk/src/c/objects/Options/OptionStruct.cpp
r8535 r8564 138 138 } 139 139 /*}}}*/ 140 /*FUNCTION OptionStruct::Get(Options*** p value,int* numel) {{{1*/141 void OptionStruct::Get(Options*** p value,int* numel){140 /*FUNCTION OptionStruct::Get(Options*** ppvalue,int* numel) {{{1*/ 141 void OptionStruct::Get(Options*** ppvalue,int* numel){ 142 142 143 143 /*We should first check that the size is at least one*/ … … 147 147 148 148 /*Assign output pointer*/ 149 *p value=this->values;149 *ppvalue=this->values; 150 150 if(numel) *numel=this->NumEl(); 151 151 } -
issm/trunk/src/c/objects/Options/OptionStruct.h
r8535 r8564 45 45 void Get(bool* pvalue){ _error_("An OptionStruct object cannot return a bool");}; 46 46 void Get(char** pvalue){ _error_("An OptionStruct object cannot return a string");}; 47 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionStruct object cannot return a string vec");}; 47 48 void Get(double** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a double vec");}; 48 49 void Get(Options** pvalue); 49 void Get(Options*** p value,int *pnumel);50 void Get(Options*** ppvalue,int *pnumel); 50 51 51 52 };
Note:
See TracChangeset
for help on using the changeset viewer.