FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
MetaDataLoaderForFormat< RECORD_CLASS > Class Template Reference

Templated interface to static data that provides the description of a specific layout of meta data. It can also load/save such formats from/to a file. More...

#include <UniversalMetaData.hpp>

+ Inheritance diagram for MetaDataLoaderForFormat< RECORD_CLASS >:

Public Member Functions

const UniversalMetaData_FieldDescriptionfieldDescriptionTable
 
const uint16_t totalFields
 
const char magicNumber [sizeof(((UniversalMetaData_ReferenceFileHeader *)(nullptr)) ->magicNumber)+1]
 

Static Public Member Functions

static const UniversalMetaData_ReferenceFileHeaderloadMetaDataHeader (const char *fileName, const RECORD_CLASS **resultTable, unsigned char **retSegmentBase, size_t *retSegmentLen, size_t *retDataOffset)
 Loads meta data from a file into an array of RECORD_CLASS elements. More...
 
static int dumpMetaDataToFile (const char *fileName, const RECORD_CLASS **table, const uint32_t totalRecords, const uint32_t recordLength)
 Dump meta data description and product records to a file. More...
 

Static Public Attributes

static const UniversalMetaData_FieldDescriptionfieldDescriptionTable
 
static const uint16_t totalFields
 
static const char magicNumber [sizeof(((UniversalMetaData_ReferenceFileHeader *)(nullptr)) ->magicNumber)+1]
 

Detailed Description

template<typename RECORD_CLASS>
class MetaDataLoaderForFormat< RECORD_CLASS >

Templated interface to static data that provides the description of a specific layout of meta data. It can also load/save such formats from/to a file.

Parameters
RECORD_CLASSis the name of the class that represents a specific record of meta data.

Use of this class requires defining the implementation of the static members fileDescriptionTable, totalFields and magicNumber that will be associated with the RECORD_CLASS.

The loadMetaDataHeader() routine can then be used to load the table of meta data.

The writeMetaDataToFile() routine can be used to create a file of the appropriate format and is just a simple cover to the writeUniversalMetaDataMetaDataToFile() routine.

See also
loadAndConvertMetaData() - this facility is able to load meta data and and transform it into a different format.

Member Function Documentation

◆ dumpMetaDataToFile()

template<typename RECORD_CLASS >
static int MetaDataLoaderForFormat< RECORD_CLASS >::dumpMetaDataToFile ( const char *  fileName,
const RECORD_CLASS **  table,
const uint32_t  totalRecords,
const uint32_t  recordLength 
)
inlinestatic

Dump meta data description and product records to a file.

Parameters
fileNamespecifies the file into which the data will be written. The file will be created if needed.
tablepoints to the start of an array of pointers to Security Definition records.
totalRecordsspecifies the number of records in the table.
recordLengthspecifies the length of each record in the array. Normally this will be sizeof a pointer, but will be larger if the pointer is embedded in a larger structure.
Returns
The number of bytes written is returned.
Return values
-1indicates the file could not be opened or the entire contents of the table written successfully.

References writeUniversalMetaDataMetaDataToFile().

◆ fieldDescriptionTable()

◆ loadMetaDataHeader()

template<typename RECORD_CLASS >
static const UniversalMetaData_ReferenceFileHeader* MetaDataLoaderForFormat< RECORD_CLASS >::loadMetaDataHeader ( const char *  fileName,
const RECORD_CLASS **  resultTable,
unsigned char **  retSegmentBase,
size_t *  retSegmentLen,
size_t *  retDataOffset 
)
inlinestatic

Loads meta data from a file into an array of RECORD_CLASS elements.

Parameters
fileNamespecifies the source file that will be opened for read.
resultTablewill be set with a pointer to the loaded meta data table; If null, no data could be loaded. Note that these records are treated as read-only.
retSegmentBasepoints to a location into which the base of the mapped segment will be stored.
retSegmentLenpoints to a location into which the length of the segment will be stored.
retDataOffsetpoints to a location into which an offset from the base of the segment will be stored that represents the start of the reference data table.
Returns
a pointer to the meta data file's header is returned.
Return values
nullptrindicates the file could not be opened.

References app(), createMappedFile(), fd, UniversalMetaData_ReferenceFileHeader::fieldDescriptionLength, UniversalMetaData_ReferenceFileHeader::headerLength, LOG_COMPONENT_CERR, LOG_ENDLINE, UniversalMetaData_ReferenceFileHeader::magicNumber, MAP_FILE_READONLY, UniversalMetaData_ReferenceFileHeader::metaRecordLength, OS_HANDLE_TYPE, UniversalMetaData_ReferenceFileHeader::totalFields, MetaDataLoaderForFormat< RECORD_CLASS >::totalFields, and UniversalMetaData_ReferenceFileHeader::totalRecords.

Referenced by loadAndConvertMetaData().

◆ magicNumber()

const char MetaDataLoaderForFormat< GENERIC_META_RECORD >::magicNumber

◆ totalFields()

const uint16_t MetaDataLoaderForFormat< GENERIC_META_RECORD >::totalFields

Member Data Documentation

◆ fieldDescriptionTable

template<typename RECORD_CLASS >
const UniversalMetaData_FieldDescription* MetaDataLoaderForFormat< RECORD_CLASS >::fieldDescriptionTable
static

◆ magicNumber

template<typename RECORD_CLASS >
const char MetaDataLoaderForFormat< RECORD_CLASS >::magicNumber[sizeof(((UniversalMetaData_ReferenceFileHeader *)(nullptr)) ->magicNumber)+1]
static

◆ totalFields

template<typename RECORD_CLASS >
const uint16_t MetaDataLoaderForFormat< RECORD_CLASS >::totalFields
static

The documentation for this class was generated from the following file:
Generated: Tue Jul 28 2020 16:03:27
Support Information