◆ FIFTYONE_DEGREES_DATASET_RELOAD
#define FIFTYONE_DEGREES_DATASET_RELOAD | ( | t | ) |
Reload functions are common across all data set implementations where the naming of the data set type and the init methods comform to the common pattern.
This macro requires the init methods to be static and of the form initDataFrom[Memory|File]. The data set name must be DataSet[Type].
- Parameters
-
- t - the name of the resource type to define reload methods for
Typedef Documentation
◆ fiftyoneDegreesDataSetInitFromFileMethod
typedef fiftyoneDegreesStatusCode(* fiftyoneDegreesDataSetInitFromFileMethod) (void *dataSet, const void *config, fiftyoneDegreesPropertiesRequired *properties, const char *fileName, fiftyoneDegreesException *exception) Initialses the data set from data stored on file.
This method should clean up the resource properly if the initialisation process fails. That means all allocated memory should be freed and pointers to these memorys should be set to NULL. The input dataSet should also be freed.
- Parameters
-
- dataSet - pointer to the data set to be initialised
- config - configuration for the operation of the data set, or NULL if default configuration is required
- properties - the properties that will be consumed from the data set, or NULL if all available properties in the hash data file should be available for consumption
- fileName - the full path to a file with read permission that contains the data set
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h
- Returns
- the status associated with the data set intialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not initialised correctly
◆ fiftyoneDegreesDataSetInitFromMemoryMethod
typedef fiftyoneDegreesStatusCode(* fiftyoneDegreesDataSetInitFromMemoryMethod) (void *dataSet, const void *config, fiftyoneDegreesPropertiesRequired *properties, void *memory, long size, fiftyoneDegreesException *exception) Initialses the data set from data stored in continuous memory.
- Parameters
-
- dataSet - pointer to the data set to be initialised
- config - configuration for the operation of the data set, or NULL if default configuration is required
- properties - the properties that will be consumed from the data set, or NULL if all available properties in the hash data file should be available for consumption
- memory - pointer to continuous memory containing the data set
- size - the number of bytes that make up the data set
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- the status associated with the data set intialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not initialised correctly
Function Documentation
◆ fiftyoneDegreesDataSetFree()
void fiftyoneDegreesDataSetFree ( fiftyoneDegreesDataSetBase * dataSet ) Closes the data set by freeing anything which has been initialised at creation.
This does not free the data set structure itself.
- Parameters
-
- dataSet - pointer to the data set to complete
◆ fiftyoneDegreesDataSetGet()
fiftyoneDegreesDataSetBase* fiftyoneDegreesDataSetGet ( fiftyoneDegreesResourceManager * manager ) Gets a pointer to the active data set from a resource manager.
Note that when this is finished with it must be released with the corresponding release method.
- Parameters
-
- manager - pointer to the manager which manages the data set resource
- Returns
- pointer to the data set resource
◆ fiftyoneDegreesDataSetInitFromFile()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetInitFromFile ( fiftyoneDegreesDataSetBase * dataSet, const char * fileName, long bytesToCompare ) Initialses the data set from data stored on file.
- Parameters
-
- dataSet - pointer to the pre allocated data set to be initialised
- fileName - the full path to a file with read permission that contains the data set
- bytesToCompare - the number of bytes to compare if the reuse temporary file option is enabled. If a temporary file is found and the first bytes are equal to the master file, then the file is used, if not then a new temporary file is created
- Returns
- the status associated with the data set intialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not initialised correctly
◆ fiftyoneDegreesDataSetInitHeaders()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetInitHeaders ( fiftyoneDegreesDataSetBase * dataSet, void * state, fiftyoneDegreesHeadersGetMethod getHeaderMethod ) Initialises the HTTP headers in the data set.
Usually this means constructing an array of pointers to the headers which are required for quick access.
- Parameters
-
- dataSet - pointer to a valid data set
- state - pointer to data which is needed by getPropertymethod
- getHeaderMethod - method used to retrieve the unique id and name of a header at a specified index from the data set
- Returns
- the status associated with the header initialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the headers were not initialised correctly
◆ fiftyoneDegreesDataSetInitInMemory()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetInitInMemory ( fiftyoneDegreesDataSetBase * dataSet, fiftyoneDegreesMemoryReader * reader ) Initialses the data set from data stored in continuous memory.
- Parameters
-
- dataSet - pointer to the pre allocated data set to be initialised
- reader - constructed to read the memory containing the data set
- Returns
- the status associated with the data set intialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not initialised correctly
◆ fiftyoneDegreesDataSetInitProperties()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetInitProperties ( fiftyoneDegreesDataSetBase * dataSet, fiftyoneDegreesPropertiesRequired * properties, void * state, fiftyoneDegreesPropertiesGetMethod getPropertyMethod, fiftyoneDegreesEvidencePropertiesGetMethod getEvidencePropertiesMethod ) Initialises the properties in the data set.
Usually this means constructing an array of pointers to the properties which are required for quick access.
- Parameters
-
- dataSet - pointer to a valid data set
- properties - the properties which should be initialised in the data set
- state - pointer to data which is needed by getPropertymethod
- getPropertyMethod - method used to retrieve the name of a property at a specified index from the data set
- getEvidencePropertiesMethod - method used to populate the list of evidence required for a property in the data set
- Returns
- the status associated with the property initialisation. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the properties were not initialised correctly
◆ fiftyoneDegreesDataSetRelease()
void fiftyoneDegreesDataSetRelease ( fiftyoneDegreesDataSetBase * dataSet ) Releases a reference to a data set which has been fetched via the DataSetGet method.
- Parameters
-
- dataSet - pointer to the data set to release
◆ fiftyoneDegreesDataSetReloadManagerFromFile()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetReloadManagerFromFile ( fiftyoneDegreesResourceManager * manager, const char * fileName, size_t dataSetSize, fiftyoneDegreesDataSetInitFromFileMethod initDataSet, fiftyoneDegreesException * exception ) Reload the data set being used by the resource manager using the data file location specified.
When initialising the data, the configuration that manager was first created with is used.
If the new data file is successfully initialised, the current data set is replaced The old data will remain in memory until the last reference to it is released.
- Parameters
-
- manager - pointer to the resource manager to reload the data set for
- fileName - path to the new data file
- dataSetSize - size of the data set structure to allocate for the new data set
- initDataSet - init method used to initialise the new data set from the file provided
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- the status associated with the data set reload. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not reloaded correctly
◆ fiftyoneDegreesDataSetReloadManagerFromMemory()
fiftyoneDegreesStatusCode fiftyoneDegreesDataSetReloadManagerFromMemory ( fiftyoneDegreesResourceManager * manager, void * source, long length, size_t dataSetSize, fiftyoneDegreesDataSetInitFromMemoryMethod initDataSet, fiftyoneDegreesException * exception ) Reload the data set being used by the resource manager using a data file loaded into contiguous memory.
When initialising the data, the configuration that manager was first created with is used.
If the data passed in is successfully initialised, the current data set is replaced The old data will remain in memory until the last reference to it is released.
- Parameters
-
- manager - pointer to the resource manager to reload the data set for
- source - pointer to the memory location where the new data file is stored
- length - of the data in memory
- dataSetSize - size of the data set structure to allocate for the new data set
- initDataSet - init method used to initialise the new data set from the memory pointer provided
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- the status associated with the data set reload. Any value other than FIFTYONE_DEGREES_STATUS_SUCCESS means the data set was not reloaded correctly
◆ fiftyoneDegreesDataSetReset()
void fiftyoneDegreesDataSetReset ( fiftyoneDegreesDataSetBase * dataSet ) Resets a newly allocated data set structure ready for initialisation.
- Parameters
-
- dataSet - pointer to the allocated data set