Warning, /graphics/kst-plot/devel-docs/dirfile_strings_sindir.notes is written in an unsupported language. File is not indexed.
0001 Before I forget about this, here's some notes on string vector fields in 0002 GetData-0.10, in case you're still interested in adding support for them 0003 into kst: 0004 0005 0006 - A scalar string array (SARRAY) is declared like this: 0007 0008 sarray_field SARRAY string0 string1 string2 string3 ... 0009 0010 0011 0012 - A string vector field (SINDIR) is declared like this: 0013 0014 field SINDIR index_field sarray_field 0015 0016 Where "index_field" is interpreted as an integer. If 0017 index_field[i] = n, then field[i] = sarray_field[n]. The SINDIR has 0018 the same number of samples-per-frame as index_field. SARRAY indices 0019 start from zero. 0020 0021 0022 0023 - The dirfile->VectorList() function doesn't include SINDIRs in the 0024 list it returns (just numeric vector fields), which means no changes 0025 should be needed in kst to use GetData-0.10 as-is. 0026 0027 Use _dirfile->FieldListByType(SindirEntryType) to get a list of 0028 SINDIRs. 0029 0030 0031 0032 - In C++, to retrieve SINDIR data, there's an alternate function signature 0033 for _dirfile->GetData lacking the DataType field: 0034 0035 size_t GetData(const char *field_code, gd_off64_t first_frame, 0036 gd_off64_t first_sample, size_t num_frames, size_t 0037 num_samples, const char** data_out) const; 0038 0039 It fills data_out[] with pointers to immutable C strings. The 0040 pointers point directly into the SARRAY data store, so don't call 0041 free() on them. 0042 0043 0044 0045 - Internally, GetData doesn't think of SINDIR data as strings, but as 0046 integers of width sizeof(const char*). It treats the SARRAY field as 0047 a non-interpolated lookup table to map values of the index field 0048 into pointers values (=integers) which it returns. 0049 0050 As a result, if two samples of the index_field are equal, then the 0051 pointers returned for those two samples are equal as well. (This is 0052 stronger than just saying that the two string values on those samples 0053 are the same.) 0054 0055 0056 0057 - On samples where the index_field is out of range of the SARRAY, NULL 0058 is returned. 0059 0060 0061 0062 - Calling _dirfile->SamplesPerFrame() on a SINDIR works (you get the SPF 0063 of the index field). 0064 0065 0066 0067 - Calling _dirfile->NativeType() on a SINDIR will return 0068 GetData::String (which it also does for SARRAY and STRING fields). 0069 0070 0071 0072 - For backwards compatibility, you can use the GD_GETDATA_INT_VERSION CPP 0073 macro, introduced in GetData-0.9, for conditional compilation of 0074 GetData-0.10 features: 0075 0076 #if defined GD_GETDATA_INT_VERSION && GD_GETDATA_INT_VERSION >= 1000 0077 ... 0078 #endif 0079 0080 -don 0081 0082