File MIES_TraceUserData.ipf

This file holds helper functions to work with our own trace user data handling.

It works by storing the trace user data in one wave per graph. It is cleaned up when the graph is killed. For subwindows the window hook responsible for cleaning up is attached to the top-most parent as only that is receiving window hook events.

Functions

variable TUD_RemoveUserDataWave(WMWinHookStruct *s)

Window hook for clearing the user data of the attached graph.

variable TUD_Clear(string graph, variable recursive = defaultValue)

Clear the user data wave and release the indexing JSON document.

Works recursively on all child windows and calls TUD_ClearImpl on each graph.

static variable TUD_ClearImpl(string graph)
string TUD_GetUserData(string graph, string trace, string key)

Return the user data given by the graph and trace named key

wave TUD_GetAllUserData(string graph, string trace)

Return all the user data from trace of graph

wave TUD_GetUserDataAsWave(string graph, string key, WaveText keys = defaultValue, WaveText values = defaultValue, variable returnIndizes = defaultValue)

Return the user data for key of all traces in graph in a 1D text wave.

Parameters:
  • graph – existing graph

  • key – key value to gather data for

  • keys – [optional] Either both keys and values are present or none of them. These allow to further restrict the returned result to traces having all of the additional key/value pairs

  • values – [optional] See key

  • returnIndizes – [optional, default to false] Return the indizes of the matches instead of the values

variable TUD_SetUserData(string graph, string trace, string key, string value)

Set the given user data for the trace of the graph.

variable TUD_SetUserDataFromWaves(string graph, string trace, WaveText keys, WaveText values)

Set the given user data for the trace of the graph.

The keys/values must span a consecutive range.

static variable TUD_GraphIsManaged(string graph)
variable TUD_GetTraceCount(string graph)

Return the number of traces in the user data.

variable TUD_RemoveUserData(string graph, string trace)

Remove all user data from the given trace.

variable TUD_TraceIsOnGraph(string graph, string trace)

Check if the given trace is displayed on the graph.

variable TUD_Init(string graph)

Initialize the graph for our user trace data handling.

This is done implicitly after the user data wave is created. Once that is cleared with TUD_Clear() and the window is gone, this function can be used to reattach the cleanup hook to the newly created graph.

static variable TUD_AddTrace(variable jsonID, WaveText graphUserData, string trace)
static variable TUD_RemoveTrace(WaveText graphUserData, string trace)
static variable TUD_ConvertTraceNameToRowIndex(WaveText graphUserData, string trace, variable create = defaultValue, variable allowMissing = defaultValue)
static variable TUD_GetIndexJSON(WaveText graphUserData)
static variable TUD_RegenerateJSONIndex(variable jsonID, WaveText graphUserData)