Workspace 6.21.5
Public Member Functions | Static Public Member Functions | List of all members
OperationIdRegistry Class Reference

#include <Workspace/DataExecution/Operations/operationidregistry.h>

Public Member Functions

 OperationIdRegistry (const QString &workspaceName, bool regenerateIds=false, bool saveLegacyIds=false, const QString &legacyVersionNum="")
 
 ~OperationIdRegistry ()
 
const QHash< QUuid, QUuid > & getRegeneratedIdMap () const
 
void setRegeneratedIdMap (const QHash< QUuid, QUuid > &map)
 

Static Public Member Functions

static QString canonicalPluginName (const Application::WorkspacePlugin &plugin)
 
static QUuid generateId ()
 
static QUuid generateIdFromString (const QString &string)
 
static QString idToString (const QUuid &id)
 
static bool isRegistryActive ()
 

Constructor & Destructor Documentation

◆ OperationIdRegistry()

OperationIdRegistry ( const QString &  workspaceName,
bool  regenerateIds = false,
bool  saveLegacyIds = false,
const QString &  legacyVersionNum = "" 
)

Constructs a new OperationIdRegistry. While this registry is in scope, any operations that are loaded (deserialized) will register any legacy ids with this registry. When the registry is deleted / goes out of scope, this registry will no longer be active.

◆ ~OperationIdRegistry()

Member Function Documentation

◆ canonicalPluginName()

QString canonicalPluginName ( const Application::WorkspacePlugin plugin)
static

◆ generateId()

QUuid generateId ( )
static

◆ generateIdFromString()

QUuid generateIdFromString ( const QString &  string)
static
Parameters
stringThe string from which we are going to generate a QUuid
Returns
A QUuid generated from the specified string.

Returns a QUuid from the contents of the specified string. There are several scenarios that are catered for here:

1) There is no "active" id registry (i.e. there is no OperationIdRegistry in existence). In this scenario, the function will return a QUuid directly from the string, which is expected to be of the format:

"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"

Where 'x' is a hex digit. If the string is not in this format, a null Quuid will be returned.

2) There is an "active" id registry, and the string can be converted directly to an integer. In this case, the function will assume that the string represents a "legacy" id (i.e. from the time when all operations had integers as ids). The function will then:

  • Look in the active registry to see if this legacy id has been requested before. If it has, it will get the associated QUuid and return it. This makes sure the same QUuid is used in every place the legacy id was previously used.
  • If it can't find the legacy id in the active registry, it will generate a new QUuid using generateId(), insert it into the registry as the value for the legacy id, then return the new QUuid.

3) There is an "active" id registry and the string can not be converted into an int. In this scenario, the function will return a QUuid directly from the string, which is expected to be of the format:

"{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"

Where 'x' is a hex digit. If the string is not in this format, a null Quuid will be returned.

◆ getRegeneratedIdMap()

const QHash< QUuid, QUuid > & getRegeneratedIdMap ( ) const

◆ idToString()

QString idToString ( const QUuid &  id)
static

◆ isRegistryActive()

bool isRegistryActive ( )
static
Returns
true if a registry is currently active. If not, returns false.

◆ setRegeneratedIdMap()

void setRegeneratedIdMap ( const QHash< QUuid, QUuid > &  map)