File MIES_Utilities_DataFolder.ipf

utility functions for datafolder handling

Functions

string GetListOfObjects(dfref dfr, string matchExpr, variable typeFlag = defaultValue, variable fullPath = defaultValue, variable recursive = defaultValue, variable exprType = defaultValue)

Alternative implementation for WaveList/VariableList/etc. which honours a dfref and thus does not require SetDataFolder calls.

Parameters:
  • dfr – datafolder reference to search for the objects

  • matchExpr – expression matching the objects, either a regular (exprType == MATCH_REGEXP) or wildcard (exprType == MATCH_WILDCARD) expression

  • typeFlag – [optional, default: COUNTOBJECTS_WAVES] One of TypeFlags

  • fullPath – [optional, default: false] should only the object name or the absolute path of the object be returned

  • recursive – [optional, default: false] descent into all subfolders recursively

  • exprType – [optional, defaults: MATCH_REGEXP] convention used for matchExpr, one of MatchExpressions

Returns:

list of object names matching matchExpr

static string GetAllObjects(dfref dfr, variable typeFlag)

Return a list of all objects of the given type from dfr.

variable DataFolderExistsDFR(dfref dfr)

Checks if the datafolder referenced by dfr exists.

Parameters:

dfr[in] data folder to test

Returns:

one if dfr is valid and references an existing or free datafolder, zero otherwise UTF_NOINSTRUMENTATION

variable IsGlobalDataFolder(dfref dfr)

Check if the passed datafolder reference is a global/permanent datafolder.

UTF_NOINSTRUMENTATION

variable IsFreeDatafolder(dfref dfr)

Returns 1 if dfr is a valid free datafolder, 0 otherwise.

UTF_NOINSTRUMENTATION

dfref createDFWithAllParents(string dataFolder)

Create a datafolder and all its parents,.

Includes fast handling of the common case that the datafolder exists.

Returns:

reference to the datafolder UTF_NOINSTRUMENTATION

variable RemoveEmptyDataFolder(dfref dfr)

Removes the datafolder reference if there are no objects in it anymore.

Parameters:

dfr – data folder reference to kill

Returns:

1 in case the folder was removed and 0 in all other cases

variable IsDataFolderEmpty(dfref dfr)

Return 1 if the datafolder is empty, zero if not.

variable RemoveAllEmptyDataFolders(dfref sourceDFR)

Remove all empty datafolders in the passed datafolder reference recursively including sourceDFR.

dfref UniqueDataFolder(dfref dfr, string baseName)

Returns a reference to a newly created datafolder.

Basically a datafolder aware version of UniqueName for datafolders

Parameters:
  • dfr – datafolder reference where the new datafolder should be created

  • baseName – first part of the datafolder, might be shortend due to Igor Pro limitations

string UniqueDataFolderName(dfref dfr, string baseName)

Return an absolute unique data folder name which does not exist in dfr.

Parameters:
  • dfr – datafolder to search

  • baseName – first part of the datafolder

variable RenameDataFolderToUniqueName(string path, string suffix)

Rename the given datafolder path to a unique name.

With path root:a:b:c and suffix _old the datafolder is renamed to root:a:b:c_old or if that exists root:a:b:c_old_1 and so on.

variable RefCounterDFIncrease(dfref dfr)

For DF memory management, increase reference count.

Parameters:

dfr – data folder reference of the target df

variable RefCounterDFDecrease(dfref dfr)

For DF memory management, decrease reference count and kill DF if zero is reached.

Parameters:

dfr – data folder reference of the target df

variable DFREFClear(dfref *dfr)

Clear the given datafolder reference.