ADTF
|
Concrete Factory Method for building up a DDL from a XML file. More...
Public Member Functions | |
cDDLImporter (bool bBasicCheck=true, bool bSorted=true) | |
Default CTOR. More... | |
cDDLImporter (const A_UTILS_NS::cFilename &strFile, bool bBasicCheck=true, bool bSorted=true) | |
CTOR with file name/path. More... | |
cDDLImporter (const char *strFile, bool bBasicCheck=true, bool bSorted=true) | |
CTOR with file name/path. More... | |
cDDLImporter (int nCreationLevel, bool bBasicCheck=true, bool bSorted=true) | |
CTOR with creation level. More... | |
cDDLDescription * | GetDDL () const |
Getter for the DDL object. More... | |
tResult | CreateNew (double fVersion=0) |
Method to build up a new DDL hierarchy. More... | |
void | DestroyDDL () |
Method to destroy the DDL object and all contained objects. | |
tResult | BuildHeader () |
Method to build a header object. More... | |
tResult | BuildUnits () |
Method to build a units object hierarchy. More... | |
tResult | BuildDatatypes () |
Method to build a datatypes object hierarchy. More... | |
tResult | BuildStructs () |
Method to build a structs object hierarchy. More... | |
tResult | BuildStreams () |
Method to build a streams object hierarchy. More... | |
tResult | BuildEnums () |
Method to build a enums object hierarchy. More... | |
tResult | BuildStreamMetaTypes () |
Method to build a streams object hierarchy. More... | |
void | SetCreationLevel (int const nLevel=1) |
Setter for the creation level. More... | |
void | SetFullCheckDescriptionMode (bool bFullCheck=false) |
Setter for the validation mode. More... | |
void | SetMergeDefaults (bool bMergeDefaults=true) |
Setter to enable disable the merge of DDL defaults (units, datattypes, etc.) More... | |
void | SetPreferReferenceEntities (bool bPrefereReference=true) |
Setter to switch from prefereing entities from the reference DDL, to using the reference enties only when there is no "local" aquivalent. More... | |
tResult | CreatePartial (const cDDLDescription *poRefDDL, double fVersion) |
Method to create a partial DDL (e.g. More... | |
tResult | SetFile (A_UTILS_NS::cFilename const strFile) |
Setter for the source file. More... | |
tResult | SetDOM (A_UTILS_NS::cDOM *poDOM) |
Setter for a DOM. More... | |
tResult | SetXML (const A_UTILS_NS::cString &strXML) |
Setter for a XML string containing the DDL to import. More... | |
A_UTILS_NS::cString | GetErrorDesc () const |
Getter for the description of the last error. More... | |
A_UTILS_NS::cString | GetLastErrorDesc () const |
Getter for the most recent error description. More... | |
tImporterMsgList | GetAllMessages () const |
Getter for all detected errors. More... | |
void | PrintAllMessages (tImporterMsgSeverity eLeastSeverity=eImporterInfo) |
Method to log all messages which have at least the given severity to console. More... | |
![]() | |
virtual | ~IDDLFactoryMethod () |
DTOR. | |
Static Public Member Functions | |
static void | DestroyDDL (cDDLDescription *poDDL) |
Static method to destroy the given DDL hierarchy. More... | |
Private Member Functions | |
tResult | BuildSingleBaseunit (cDDLBaseunit **ppoNewBU, A_UTILS_NS::cDOMElementRef poBUElement) |
Creates a baseunit object from the given DOMElement. More... | |
tResult | BuildSinglePrefix (cDDLPrefix **ppoNewPrefix, A_UTILS_NS::cDOMElementRef poPrefixElement) |
Creates a prefix object from the given DOMElement. More... | |
tResult | BuildSingleUnit (cDDLUnit **ppoNewUnit, A_UTILS_NS::cDOMElementRef poUnitElement) |
Creates a unit object from the given DOMElement. More... | |
tResult | BuildSingleDatatype (cDDLDataType **ppoNewDatatype, A_UTILS_NS::cDOMElement *poDTElement) |
Creates a datatype object from the given DOMElement. More... | |
tResult | BuildSingleEnum (cDDLEnum **ppoNewEnum, A_UTILS_NS::cDOMElement *poEnumElement) |
Creates an enum object from the given DOMElement. More... | |
tResult | BuildSingleStruct (cDDLComplex **ppoNewStruct, A_UTILS_NS::cDOMElement *poStructElement) |
Creates a struct object from the given DOMElement. More... | |
tResult | BuildSingleStream (cDDLStream **ppoNewStream, A_UTILS_NS::cDOMElement *poStreamElement) |
Creates a DDL stream object from the given DOMElement. More... | |
tResult | BuildSingleStreamMetaType (A_UTILS_NS::cDOMElement *poStreamMetaTypeElement, tDDLStreamMetaTypeVec &vecStreamMetaTypes) |
Creates a DDL stream object from the given DOMElement. More... | |
void | PushMessage (const A_UTILS_NS::cString &strMsg, tImporterMsgSeverity eSeverity) |
Helper method to create a message and save it in the appropriate container. More... | |
template<typename T > | |
T * | TryToFind (const A_UTILS_NS::cString &strName, cDDLContainer< T > &vecFirstData, cDDLContainer< T > &vecSecondData) |
Helper method to find specific elements inside the given vecFirstData by Name. More... | |
Private Attributes | |
A_UTILS_NS::cDOM | m_oDOM |
cDDLDescription * | m_poDDL |
const cDDLDescription * | m_poCurrentRefDDL |
tDDLUnitVec | m_vecUnknownUnits |
tDDLComplexVec | m_vecUnknownStructs |
tDDLStreamMetaTypeVec | m_vecUnknownStreamMetaTypes |
bool | m_bInitFlag |
int | m_nCreationLevel |
bool | m_bFullCheck |
tImporterMsgList | m_lstErrors |
bool | m_bBasicCheck |
bool | m_bMergeDefaults |
bool | m_bSorted |
bool | m_bPrefereReference |
Concrete Factory Method for building up a DDL from a XML file.
Definition at line 44 of file ddlimporter.h.
cDDLImporter | ( | bool | bBasicCheck = true , |
bool | bSorted = true |
||
) |
Default CTOR.
[in] | bBasicCheck | Perform basic checks during Create* (unique element names etc.). For a full check use cDDLInspector. |
[in] | bSorted | Sorts all DDL items by name for better performance. |
cDDLImporter | ( | const A_UTILS_NS::cFilename & | strFile, |
bool | bBasicCheck = true , |
||
bool | bSorted = true |
||
) |
CTOR with file name/path.
[in] | strFile | - Path to file to use |
[in] | bBasicCheck | Perform basic checks during Create* (unique element names etc.). For a full check use cDDLInspector. |
[in] | bSorted | Sorts all DDL items by name for better performance. |
cDDLImporter | ( | const char * | strFile, |
bool | bBasicCheck = true , |
||
bool | bSorted = true |
||
) |
CTOR with file name/path.
[in] | strFile | - Path to file to use |
[in] | bBasicCheck | Perform basic checks during Create* (unique element names etc.). For a full check use cDDLInspector. |
[in] | bSorted | Sorts all DDL items by name for better performance. |
cDDLImporter | ( | int | nCreationLevel, |
bool | bBasicCheck = true , |
||
bool | bSorted = true |
||
) |
CTOR with creation level.
[in] | nCreationLevel | - Creation level |
[in] | bBasicCheck | Perform basic checks during Create* (unique element names etc.). For a full check use cDDLInspector. |
[in] | bSorted | Sorts all DDL items by name for better performance. |
|
virtual |
Method to build a datatypes object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. unit) |
Implements IDDLFactoryMethod.
|
virtual |
Method to build a enums object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. RefEnums) |
ERR_UNKNOWN | Not all firstly unknown structs have been resolved |
Implements IDDLFactoryMethod.
|
virtual |
Method to build a header object.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
Implements IDDLFactoryMethod.
|
private |
Creates a baseunit object from the given DOMElement.
[out] | ppoNewBU | - Pointer to pointer to the newly created baseunit object |
[in] | poBUElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable |
|
private |
Creates a datatype object from the given DOMElement.
[out] | ppoNewDatatype | - Pointer to pointer to the newly created datatype object |
[in] | poDTElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. unit) |
|
private |
Creates an enum object from the given DOMElement.
[out] | ppoNewEnum | - Pointer to pointer to the newly created enum object |
[in] | poEnumElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. unit) |
|
private |
Creates a prefix object from the given DOMElement.
[out] | ppoNewPrefix | - Pointer to pointer to the newly created prefix object |
[in] | poPrefixElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable |
|
private |
Creates a DDL stream object from the given DOMElement.
[out] | ppoNewStream | - Pointer to pointer to the newly created stream object |
[in] | poStreamElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. struct) |
|
private |
Creates a DDL stream object from the given DOMElement.
[out] | poStreamMetaTypeElement | |
[in] | vecStreamMetaTypes |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. struct) |
|
private |
Creates a struct object from the given DOMElement.
[out] | ppoNewStruct | - Pointer to pointer to the newly created struct object |
[in] | poStructElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. datatype) |
ERR_UNKNOWN | Not all firstly unknown structs have been resolved |
|
private |
Creates a unit object from the given DOMElement.
[out] | ppoNewUnit | - Pointer to pointer to the newly created unit object |
[in] | poUnitElement | - Pointer to the DOMElement with the information |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable |
|
virtual |
Method to build a streams object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. struct) |
Implements IDDLFactoryMethod.
|
virtual |
Method to build a streams object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. struct) |
Implements IDDLFactoryMethod.
|
virtual |
Method to build a structs object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. datatype) |
ERR_UNKNOWN | Not all firstly unknown structs have been resolved |
Implements IDDLFactoryMethod.
|
virtual |
Method to build a units object hierarchy.
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. refUnit) |
ERR_UNKNOWN | Not all firstly unknown units have been resolved |
Implements IDDLFactoryMethod.
|
virtual |
Method to build up a new DDL hierarchy.
[in] | fVersion | The version of the DDL hierarchy to be created. 0 Means newest version. |
ERR_NOT_INITIALIZED | Not yet initialized (see setter methods in concrete classes, e.g. cDDLImporter::SetFile() ) |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. refUnit) |
ERR_UNKNOWN | Cross reference has not been resolved |
ERR_NOT_FOUND | At least one mandatory element (e.g. header) was not found. |
GetAllErrors()
. Implements IDDLFactoryMethod.
tResult CreatePartial | ( | const cDDLDescription * | poRefDDL, |
double | fVersion | ||
) |
Method to create a partial DDL (e.g.
streams only).
[in] | poRefDDL | - Reference DDL object to be used for resolving matters |
[in] | fVersion | The version the newly created description will have. Set 0 for newst version. |
ERR_POINTER | Null-pointer committed |
ERR_NOT_INITIALIZED | Not yet initialized (see setter methods in concrete classes, e.g. cDDLImporter::SetFile() ) |
ERR_UNKNOWN_FORMAT | Expected XML hierarchy not found |
ERR_NO_CLASS | Cross reference not resolvable (e.g. refUnit) |
ERR_UNKNOWN | Cross reference has not been resolved |
|
static |
Static method to destroy the given DDL hierarchy.
[in] | poDDL | - Pointer to the DDL hierarchy which should be destroyed. |
tImporterMsgList GetAllMessages | ( | ) | const |
Getter for all detected errors.
|
virtual |
Getter for the DDL object.
Implements IDDLFactoryMethod.
A_UTILS_NS::cString GetErrorDesc | ( | ) | const |
Getter for the description of the last error.
A_UTILS_NS::cString GetLastErrorDesc | ( | ) | const |
Getter for the most recent error description.
A_UTILS_NS::cString::Empty
if there was none. eImporterError
). void PrintAllMessages | ( | tImporterMsgSeverity | eLeastSeverity = eImporterInfo | ) |
Method to log all messages which have at least the given severity to console.
[in] | eLeastSeverity | - Minimum severity level (optional) |
|
private |
Helper method to create a message and save it in the appropriate container.
[in] | strMsg | - Message text |
[in] | eSeverity | - Message severity |
void SetCreationLevel | ( | int const | nLevel = 1 | ) |
Setter for the creation level.
[in] | nLevel | - Creation level to use |
tResult SetDOM | ( | A_UTILS_NS::cDOM * | poDOM | ) |
Setter for a DOM.
[in] | poDOM | - Pointer to DOM |
ERR_POINTER | Null-pointer committed |
tResult SetFile | ( | A_UTILS_NS::cFilename const | strFile | ) |
Setter for the source file.
[in] | strFile | - Path to file to use |
ERR_OPEN_FAILED | Reading process failed |
ERR_UNEXPECTED | Invalid XML tag |
void SetFullCheckDescriptionMode | ( | bool | bFullCheck = false | ) |
Setter for the validation mode.
[in] | bFullCheck | - Validation mode to use. Set true for full description check. Set false for description check until first error. |
void SetMergeDefaults | ( | bool | bMergeDefaults = true | ) |
Setter to enable disable the merge of DDL defaults (units, datattypes, etc.)
[in] | bMergeDefaults | See description |
void SetPreferReferenceEntities | ( | bool | bPrefereReference = true | ) |
Setter to switch from prefereing entities from the reference DDL, to using the reference enties only when there is no "local" aquivalent.
Mind that reference entities are not cloned but only referenced. They are also not included into the containers.
[in] | bPrefereReference | See description |
tResult SetXML | ( | const A_UTILS_NS::cString & | strXML | ) |
Setter for a XML string containing the DDL to import.
[in] | strXML | - String containing the DDL |
ERR_UNEXPECTED | Invalid XML tag |
|
private |
Helper method to find specific elements inside the given vecFirstData by Name.
If not found there have a look in vecSecondData.
T | - Representation object type (e.g. cDDLDataType) |
[in] | strName | - Name of the element to find |
[in] | vecFirstData | - Vector of representation objects to search through |
[in] | vecSecondData | - second Vector of representation objects to search through |
NULL
if not found