Loading...
Searching...
No Matches
DataProvider::DataProviderTypeCache Class Reference

Data provider type cache class. More...

`#include <DataProviderTypeCache.qc.dox.h>`

## Public Member Functions

| clear ()
| Clears the type hierarchy of all non-locked types.
bool | empty ()
| Returns True if the cache is empty, False if not.
RWLock | getLock ()
| Returns the RWLock to allow for external serialization.
DataProviderTypeEntry | getRoot ()
| Returns the root type entry.
*AbstractDataProviderType | getType (string path)
| Returns the given data provider type or nothing if not present.
AbstractDataProviderType | getTypeEx (string path)
| Returns the given data provider type or throws an exception if not present.
*AbstractDataProviderType | getTypeImpl (string path, bool throw_exception, *code type_loader)
| Returns the given data provider type and either throws an exception if not present or returns NOTHING.
*hash< DataProviderTypeEntryInfo > | getTypeInfo (string path, *bool rec_children_only)
| Returns the given data provider type or nothing if not present.
hash< DataProviderTypeEntryInfo > | getTypeInfoEx (string path, *bool rec_children_only)
| Returns the given data provider type or throws an exception if not present.
*hash< DataProviderTypeEntryInfo > | getTypeInfoImpl (string path, bool throw_exception, *bool rec_children_only)
| Returns information for the given data provider type and either throws an exception if not present or returns NOTHING.
*list< string > | listParentTypes ()
| Returns a list of registered data provider type paths where the types are "parent" types.
*list< hash< DataProviderTypeEntryInfo > > | listRegisteredTypeEntries ()
| Returns a list of information for all registered data provider type entries.
*list< string > | listRegisteredTypes ()
| Returns a list of registered data provider type paths.
*list< string > | listTypes ()
| Returns a list of registered data provider type paths.
| lockAll ()
| Locks all types.
*DataProviderTypeEntry | lookupTypeEntryFromId (int id)
| Returns a type from its epheremal ID.
DataProviderTypeEntry | lookupTypeEntryFromIdEx (int id)
| Returns a type from its epheremal ID; throws an exception if the ID is unknown.
*DataProviderTypeEntry | lookupTypeEntryFromPath (string path)
| Returns a type from its path.
DataProviderTypeEntry | lookupTypeEntryFromPathEx (string path)
| Returns a type from its path; throws an exception if the path is unknown.
*AbstractDataProviderType | lookupTypeFromId (int id)
| Returns a type from its epheremal ID.
AbstractDataProviderType | lookupTypeFromIdEx (int id)
| Returns a type from its epheremal ID; throws an exception if the ID is unknown.
*AbstractDataProviderType | lookupTypeFromPath (string path)
| Returns a type from its path.
AbstractDataProviderType | lookupTypeFromPathEx (string path)
| Returns a type from its path; throws an exception if the path is unknown.
bool | registerOrReplaceType (string path, AbstractDataProviderType type, *int id)
| Register or replaces a data provider type in the cache.
| registerType (string path, AbstractDataProviderType type, bool locked=False, *bool set_rollback)
| Register a new data provider type in the cache.
*AbstractDataProviderType | removeType (string path)
| Removes a type from the type cache.
int | size ()
| Returns the number of types in the cache.

## Protected Member Functions

| deregisterType (string path)
| Deregisters the type at the given path.
DataProviderTypeEntry | root ()
| Data provider data type cache.
transient RWLock | rwlock ()
| Data provider type cache lock.

## Static Protected Member Functions

static *AbstractDataProviderType | getTypeFromFields (string path, AbstractDataProviderType type, list< string > type_path, bool throw_exception)
| Returns the given data provider type and either throws an exception if not present or returns NOTHING.

## Protected Attributes

int | size = 0
| The size of the cache.
hash< string, DataProviderTypeEntry > | tmap
| Map of epheremal type IDs to types.
hash< string, DataProviderTypeEntry > | trmap
| Map of path names to types.

## Detailed Description

Data provider type cache class.

## Member Function Documentation

## deregisterType()

DataProvider::DataProviderTypeCache::deregisterType | ( | string | path | ) |

protected

Deregisters the type at the given path.

Parameters

  path | a `"/"` separated path for the type; this is the lookup index

## getType()

*AbstractDataProviderType DataProvider::DataProviderTypeCache::getType | ( | string | path | ) |

Returns the given data provider type or nothing if not present.

Parameters

  path | a `"/"` separated path for the type; trailing path elements can be a path into fields

Returns
  the given data provider type; NOTHING is returned if the type cannot be resolved

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeEx()

AbstractDataProviderType DataProvider::DataProviderTypeCache::getTypeEx | ( | string | path | ) |

Returns the given data provider type or throws an exception if not present.

Parameters

  path | a `"/"` separated path for the type; trailing path elements can be a path into fields

Returns
  the given data provider type; an exception is thrown if the data provider is unknown

Exceptions

  PROVIDER-ERROR | the given data provider type path is unknown

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeFromFields()

static *AbstractDataProviderType DataProvider::DataProviderTypeCache::getTypeFromFields | ( | string | path,
|  | AbstractDataProviderType | type,
|  | list< string > | type_path,
|  | bool | throw_exception )

staticprotected

Returns the given data provider type and either throws an exception if not present or returns NOTHING.

Parameters

  path | a `"/"` separated path for the type
  type | the base type for the search
  type_path | the path in the type for fields leading to the final return type
  throw_exception | if True then an exception is thrown if the path cannot be resolved, otherwise NOTHING is returned

Returns
  the given data provider type or NOTHING is returned if the path cannot be resolved and the throw_exception argument is False

Exceptions

  PROVIDER-ERROR | the given data provider type path is unknown; only thrown if the throw_exception argument is True

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeImpl()

*AbstractDataProviderType DataProvider::DataProviderTypeCache::getTypeImpl | ( | string | path,
|  | bool | throw_exception,
|  | *code | type_loader )

Returns the given data provider type and either throws an exception if not present or returns NOTHING.

Parameters

  path | a `"/"` separated path for the type
  throw_exception | if True then an exception is thrown if the path cannot be resolved, otherwise NOTHING is returned
  type_loader | a closure taking a list of strings giving the full path to the type and returning `*AbstractDataProviderType`

Returns
  the given data provider type or NOTHING is returned if the path cannot be resolved and the throw_exception argument is False

Exceptions

  PROVIDER-ERROR | the given data provider type path is unknown; only thrown if the throw_exception argument is True

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeInfo()

*hash< DataProviderTypeEntryInfo > DataProvider::DataProviderTypeCache::getTypeInfo | ( | string | path,
|  | *bool | rec_children_only )

Returns the given data provider type or nothing if not present.

Parameters

  path | a `"/"` separated path for the type; trailing path elements can be a path into fields
  rec_children_only | if True, then only children with fields are returned

Returns
  the given data provider type; NOTHING is returned if the type cannot be resolved

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeInfoEx()

hash< DataProviderTypeEntryInfo > DataProvider::DataProviderTypeCache::getTypeInfoEx | ( | string | path,
|  | *bool | rec_children_only )

Returns the given data provider type or throws an exception if not present.

Parameters

  path | a `"/"` separated path for the type; trailing path elements can be a path into fields
  rec_children_only | if True, then only children with fields are returned

Returns
  the given data provider type; an exception is thrown if the data provider is unknown

Exceptions

  PROVIDER-ERROR | the given data provider type path is unknown

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## getTypeInfoImpl()

*hash< DataProviderTypeEntryInfo > DataProvider::DataProviderTypeCache::getTypeInfoImpl | ( | string | path,
|  | bool | throw_exception,
|  | *bool | rec_children_only )

Returns information for the given data provider type and either throws an exception if not present or returns NOTHING.

Parameters

  path | a `"/"` separated path for the type
  throw_exception | if True then an exception is thrown if the path cannot be resolved, otherwise NOTHING is returned
  rec_children_only | if True, then only children with fields are returned

Returns
  information for the given data provider type or NOTHING is returned if the path cannot be resolved and the throw_exception argument is False

Exceptions

  PROVIDER-ERROR | the given data provider type path is unknown; only thrown if the throw_exception argument is True

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## listParentTypes()

*list< string > DataProvider::DataProviderTypeCache::listParentTypes | ( |  | ) |

Returns a list of registered data provider type paths where the types are "parent" types.

"Parent" types are types where children were added with the parent

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## listRegisteredTypeEntries()

*list< hash< DataProviderTypeEntryInfo > > DataProvider::DataProviderTypeCache::listRegisteredTypeEntries | ( |  | ) |

Returns a list of information for all registered data provider type entries.

Returns
  a list of information for all registered data provider type entries

Note
  - Types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

Since
  DataProvider 3.0

## listRegisteredTypes()

*list< string > DataProvider::DataProviderTypeCache::listRegisteredTypes | ( |  | ) |

Returns a list of registered data provider type paths.

Returns
  a list of registered type paths

Note
  - Types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)
  - This method returns the registered type list immediately from a top-level map

Since
  DataProvider 3.0

## listTypes()

*list< string > DataProvider::DataProviderTypeCache::listTypes | ( |  | ) |

Returns a list of registered data provider type paths.

Returns
  a list of type paths for all registered types and all type members

This method traverses the entire type hierarchy to return all possible types stored in it

Note
  - Types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

See also
  listRegisteredTypes() for a similar method that returns only registered types

## lookupTypeEntryFromId()

*DataProviderTypeEntry DataProvider::DataProviderTypeCache::lookupTypeEntryFromId | ( | int | id | ) |

Returns a type from its epheremal ID.

Parameters

  id | the epheremal type ID for the type

Returns
  the type or NOTHING if the ID is unknown

Since
  DataProvider 3.0

## lookupTypeEntryFromIdEx()

DataProviderTypeEntry DataProvider::DataProviderTypeCache::lookupTypeEntryFromIdEx | ( | int | id | ) |

Returns a type from its epheremal ID; throws an exception if the ID is unknown.

Parameters

  id | the epheremal type ID for the type

Returns
  the type

Exceptions

  TYPE-ARG-ERROR | Unknown type ID

Since
  DataProvider 3.0

## lookupTypeEntryFromPath()

*DataProviderTypeEntry DataProvider::DataProviderTypeCache::lookupTypeEntryFromPath | ( | string | path | ) |

Returns a type from its path.

Parameters

  path | the full path for the type

Returns
  the type or NOTHING if the path is unknown

Since
  DataProvider 3.0

## lookupTypeEntryFromPathEx()

DataProviderTypeEntry DataProvider::DataProviderTypeCache::lookupTypeEntryFromPathEx | ( | string | path | ) |

Returns a type from its path; throws an exception if the path is unknown.

Parameters

  path | the full path for the type

Returns
  the type

Exceptions

  TYPE-ARG-ERROR | Unknown type path

Since
  DataProvider 3.0

## lookupTypeFromId()

*AbstractDataProviderType DataProvider::DataProviderTypeCache::lookupTypeFromId | ( | int | id | ) |

Returns a type from its epheremal ID.

Parameters

  id | the epheremal type ID for the type

Returns
  the type or NOTHING if the ID is unknown

Since
  DataProvider 3.0

## lookupTypeFromIdEx()

AbstractDataProviderType DataProvider::DataProviderTypeCache::lookupTypeFromIdEx | ( | int | id | ) |

Returns a type from its epheremal ID; throws an exception if the ID is unknown.

Parameters

  id | the epheremal type ID for the type

Returns
  the type

Exceptions

  TYPE-ARG-ERROR | Unknown type ID

Since
  DataProvider 3.0

## lookupTypeFromPath()

*AbstractDataProviderType DataProvider::DataProviderTypeCache::lookupTypeFromPath | ( | string | path | ) |

Returns a type from its path.

Parameters

  path | the full path for the type

Returns
  the type or NOTHING if the path is unknown

Since
  DataProvider 3.0

## lookupTypeFromPathEx()

AbstractDataProviderType DataProvider::DataProviderTypeCache::lookupTypeFromPathEx | ( | string | path | ) |

Returns a type from its path; throws an exception if the path is unknown.

Parameters

  path | the full path for the type

Returns
  the type

Exceptions

  TYPE-ARG-ERROR | Unknown type path

Since
  DataProvider 3.0

## registerOrReplaceType()

bool DataProvider::DataProviderTypeCache::registerOrReplaceType | ( | string | path,
|  | AbstractDataProviderType | type,
|  | *int | id )

Register or replaces a data provider type in the cache.

Parameters

  path | a `"/"` separated path for the type; this is the lookup index
  type | the new data provider type
  id | optional epheremal type ID

Returns
  True if the type was replaced or added

Exceptions

  TYPE-LOCK-ERROR | type entry cannot be replaced, because it is locked
  TYPE-ARG-ERROR | the type is already registered under a different path

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## registerType()

DataProvider::DataProviderTypeCache::registerType | ( | string | path,
|  | AbstractDataProviderType | type,
|  | bool | locked = False,
|  | *bool | set_rollback )

Register a new data provider type in the cache.

Parameters

  path | a `"/"` separated path for the type; this is the lookup index
  type | the new data provider type
  locked | if the data type should be locked, prohibiting updates and deletions
  set_rollback | set rollback code; for use in module registration

Exceptions

  PROVIDER-ERROR | the given provider has already been registered
  TYPE-ARG-ERROR | the type is already registered under a different path

Note
  types are stored based on the path provided which may differ from their type names (which may be generic and therefore not suitable for indexing)

## removeType()

*AbstractDataProviderType DataProvider::DataProviderTypeCache::removeType | ( | string | path | ) |

Removes a type from the type cache.

Parameters

  path | a `"/"` separated path for the type; this is the lookup index

Returns
  the type removed or NOTHING if the type was not present

Exceptions

  TYPE-LOCK-ERROR | the given type cannot be removed, because it is locked