CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Static Public Attributes | List of all members
ctkLocation Struct Referenceabstract

#include <Libs/PluginFramework/service/datalocation/ctkLocation.h>

Public Member Functions

virtual bool allowsDefault () const =0
 
virtual ctkLocationcreateLocation (ctkLocation *parent, const QUrl &defaultValue, bool readonly)=0
 
virtual QUrl getDataArea (const QString &path) const =0
 
virtual QUrl getDefault () const =0
 
virtual ctkLocationgetParentLocation () const =0
 
virtual QUrl getUrl () const =0
 
virtual bool isLocked () const =0
 
virtual bool isReadOnly () const =0
 
virtual bool isSet () const =0
 
virtual bool lock ()=0
 
virtual void release ()=0
 
virtual bool set (const QUrl &value, bool lock)=0
 
virtual bool set (const QUrl &value, bool lock, const QString &lockFilePath)=0
 
virtual ~ctkLocation ()
 

Static Public Attributes

static const QString CONFIGURATION_FILTER
 
static const QString CTK_HOME_FILTER
 
static const QString INSTALL_FILTER
 
static const QString INSTANCE_FILTER
 
static const QString USER_FILTER
 

Detailed Description

A ctkLocation represents a QUrl which may have a default value, may be read only, may or may not have a current value and may be cascaded on to a parent location.

Definition at line 35 of file ctkLocation.h.

Constructor & Destructor Documentation

◆ ~ctkLocation()

virtual ctkLocation::~ctkLocation ( )
inlinevirtual

Definition at line 69 of file ctkLocation.h.

Member Function Documentation

◆ allowsDefault()

virtual bool ctkLocation::allowsDefault ( ) const
pure virtual

Returns true if this location allows a default value to be assigned and false otherwise.

Returns
whether or not this location can have a default value assigned

◆ createLocation()

virtual ctkLocation* ctkLocation::createLocation ( ctkLocation parent,
const QUrl &  defaultValue,
bool  readonly 
)
pure virtual

Constructs a new location.

Parameters
parentthe parent location. A null value is allowed.
defaultValuethe default value of the location. A null value is allowed.
readonlytrue if the location is read-only.
Returns
a new location.

◆ getDataArea()

virtual QUrl ctkLocation::getDataArea ( const QString &  path) const
pure virtual

Returns a URL to the specified path within this location. The path of the returned URL may not exist yet. It is the responsibility of the client to create the content of the data area returned if it does not exist.

This method can be used to obtain a private area within the given location. For example use the symbolic name of a plugin to obtain a data area specific to that plugin.

Clients should check if the location is read only before writing anything to the returned data area. An ctkRuntimeException will be thrown if this method is called and the location URL has not been set and there is no default value for this location.

Parameters
paththe name of the path to get from this location
Returns
the URL to the data area with the specified path.
Exceptions
ctkRuntimeExceptionif the location URL is not already set

◆ getDefault()

virtual QUrl ctkLocation::getDefault ( ) const
pure virtual

Returns the default value of this location if any. If no default is available then null is returned. Note that even locations which allow defaults may still return null.

Returns
the default value for this location or null

◆ getParentLocation()

virtual ctkLocation* ctkLocation::getParentLocation ( ) const
pure virtual

Returns the parent of this location or null if none is available.

Returns
the parent of this location or null

◆ getUrl()

virtual QUrl ctkLocation::getUrl ( ) const
pure virtual

Returns the actual QUrl of this location. If the location's value has been set, that value is returned. If the value is not set and the location allows defaults, the value is set to the default and returned. In all other cases null is returned.

Returns
the URL for this location or null if none

◆ isLocked()

virtual bool ctkLocation::isLocked ( ) const
pure virtual

Returns true if this location is locked and false otherwise.

Returns
boolean value indicating whether or not this location is locked
Exceptions
ctkRuntimeExceptionif there was an unexpected problem reading the lock

◆ isReadOnly()

virtual bool ctkLocation::isReadOnly ( ) const
pure virtual

Returns true if this location represents a read only location and false otherwise. The read only character of a location is not in enforced in any way but rather expresses the intention of the location's creator.

Returns
boolean value indicating whether the location is read only

◆ isSet()

virtual bool ctkLocation::isSet ( ) const
pure virtual

Returns true if this location has a value and false otherwise.

Returns
boolean value indicating whether or not the value is set

◆ lock()

virtual bool ctkLocation::lock ( )
pure virtual

Attempts to lock this location with a canonical locking mechanism and return true if the lock could be acquired. Not all locations can be locked.

Locking a location is advisory only. That is, it does not prevent other applications from modifying the same location

Returns
true if the lock could be acquired; otherwise false is returned
Exceptions
ctkRuntimeExceptionif there was an unexpected problem while acquiring the lock

◆ release()

virtual void ctkLocation::release ( )
pure virtual

Releases the lock on this location. If the location is not already locked, no action is taken.

◆ set() [1/2]

virtual bool ctkLocation::set ( const QUrl &  value,
bool  lock 
)
pure virtual

Sets and optionally locks the location's value to the given QUrl. If the location already has a value an exception is thrown. If locking is requested and fails, false is returned and the QUrl of this location is not set.

Parameters
valuethe value of this location
lockwhether or not to lock this location
Returns
whether or not the location was successfully set and, if requested, locked.
Exceptions
ctkIllegalStateExceptionif the location's value is already set
ctkRuntimeExceptionif there was an unexpected problem while acquiring the lock

◆ set() [2/2]

virtual bool ctkLocation::set ( const QUrl &  value,
bool  lock,
const QString &  lockFilePath 
)
pure virtual

Sets and optionally locks the location's value to the given QUrl using the given lock file. If the location already has a value an exception is thrown. If locking is requested and fails, false is returned and the QUrl of this location is not set.

Parameters
valuethe value of this location
lockwhether or not to lock this location
lockFilePaththe path to the lock file. This path will be used to establish locks on this location. The path may be an absolute path or it may be relative to the given URL. If a null value is used then a default lock path will be used for this location.
Returns
whether or not the location was successfully set and, if requested, locked.
Exceptions
ctkIllegalStateExceptionif the location's value is already set
ctkRuntimeExceptionif there was an unexpected problem while acquiring the lock

Member Data Documentation

◆ CONFIGURATION_FILTER

const QString ctkLocation::CONFIGURATION_FILTER
static

Constant which defines the filter string for acquiring the service which specifies the configuration location.

Definition at line 54 of file ctkLocation.h.

◆ CTK_HOME_FILTER

const QString ctkLocation::CTK_HOME_FILTER
static

Constant which defines the filter string for acquiring the service which specifies the eclipse home location.

Definition at line 66 of file ctkLocation.h.

◆ INSTALL_FILTER

const QString ctkLocation::INSTALL_FILTER
static

Constant which defines the filter string for acquiring the service which specifies the install location.

Definition at line 48 of file ctkLocation.h.

◆ INSTANCE_FILTER

const QString ctkLocation::INSTANCE_FILTER
static

Constant which defines the filter string for acquiring the service which specifies the instance location.

Definition at line 42 of file ctkLocation.h.

◆ USER_FILTER

const QString ctkLocation::USER_FILTER
static

Constant which defines the filter string for acquiring the service which specifies the user location.

Definition at line 60 of file ctkLocation.h.


The documentation for this struct was generated from the following file: