File MIES_JSONWaveNotes.ipf

Functions

string JWN_GetWaveNoteAsString(wave wv)

Gets the JSON wave note part as string.

variable JWN_GetWaveNoteAsJSON(wave wv)

Gets the JSON wave note part as JSON object The caller is responsible to release the returned jsonId after use.

variable JWN_SetWaveNoteFromJSON(wave wv, variable jsonID, variable release = defaultValue)

Set the JSON json document as JSON wave note. Releases json if release is true (default).

variable JWN_GetNumberFromWaveNote(wave wv, string jsonPath)

Return the numerical value at jsonPath found in the wave note.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to string

Returns:

the value on success. NaN is returned if it could not be found

wave JWN_GetNumericWaveFromWaveNote(wave wv, string jsonPath)

Return the numeric wave value at jsonPath found in the wave note Note that for numeric waves the data type of the returned wave is double precision.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to string

Returns:

the wave on success. null wave is returned if it could not be found or the referenced entry contains non-numeric data

wave JWN_GetTextWaveFromWaveNote(wave wv, string jsonPath)

Return the text wave value at jsonPath found in the wave note.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to string

Returns:

the wave on success. null wave is returned if it could not be found

wave JWN_GetWaveRefNumericFromWaveNote(wave wv, string jsonPath)

Return the wave reference wave at jsonPath found in the wave note.

All contained waves must be numeric.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to array

Returns:

the wave on success. null wave is returned if it could not be found

wave JWN_GetWaveRefTextFromWaveNote(wave wv, string jsonPath)

Return the wave reference wave at jsonPath found in the wave note.

All contained waves must be text.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to array

Returns:

the wave on success. null wave is returned if it could not be found

static wave JWN_GetWaveRefFromWaveNote_Impl(wave wv, string jsonPath, variable type)
string JWN_GetStringFromWaveNote(wave wv, string jsonPath)

Return the string value at jsonPath found in the wave note.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to string

Returns:

the value on success. An empty string is returned if it could not be found

string JWN_GetWaveNoteHeader(WaveOrNull wv)

Gets the non-JSON wave note part.

static variable JWN_WriteWaveNote(wave wv, string header, variable jsonID, variable release = defaultValue)

Writes a wave note from header string and json back. Releases json if release is true (default).

variable JWN_SetNumberInWaveNote(wave wv, string jsonPath, variable val)

Updates the numeric value of key found in the wave note as jsonPath.

Parameters:
  • wv – wave

  • jsonPath – path in json

  • val – new numerical value

variable JWN_SetStringInWaveNote(wave wv, string jsonPath, string str)

Update the string value at jsonPath found in the wave note at jsonPath.

Parameters:
  • wv – wave

  • jsonPath – path in json

  • str – new string value

variable JWN_SetWaveInWaveNote(wave wv, string jsonPath, wave noteWave)

Update the wave value at jsonPath found in the wave note at jsonPath Note that only wave data and dimensions are stored.

Parameters:
  • wv – wave

  • jsonPath – path in json

  • noteWave – new wave value

wave JWN_CreatePath(wave wv, string jsonPath)

Create a JSON object at the specified path.

Non-existing path elements are recursively created.

Parameters:
  • wv – wave reference where the WaveNote is taken from

  • jsonPath – path to create as object

Variables

static const double JWN_DEFAULT_RELEASE = 1