ADTF  3.18.3
ddlimporter.h
Go to the documentation of this file.
1 
7 #ifndef _DDL_IMPORTER_H_INCLUDED_
8 #define _DDL_IMPORTER_H_INCLUDED_
9 
10 namespace adtf_ddl
11 {
12  class cDDLDescription;
13 
18  typedef enum eImporterMsgSeverity
19  {
20  eImporterInfo,
21  eImporterWarning,
22  eImporterError
24 
29  typedef struct sImporterMsg
30  {
33  } tImporterMsg;
34 
38  typedef std::list<tImporterMsg> tImporterMsgList;
39 
40 
45  {
46  public:
53  cDDLImporter(bool bBasicCheck = true, bool bSorted = true);
54 
63  bool bBasicCheck = true,
64  bool bSorted = true);
65 
73  cDDLImporter(const char* strFile, bool bBasicCheck = true, bool bSorted = true);
74 
82  cDDLImporter(int nCreationLevel, bool bBasicCheck = true, bool bSorted = true);
83 
84  public: // implements IDDLFactoryMethod
85 
86  virtual ~cDDLImporter();
87 
89 
95  tResult CreateNew(double fVersion = 0);
96 
97  void DestroyDDL();
98 
100 
102 
104 
106 
108 
110 
112 
113  public:
120  static void DestroyDDL(cDDLDescription *poDDL);
121 
128  void SetCreationLevel(int const nLevel = 1);
129 
138  void SetFullCheckDescriptionMode(bool bFullCheck = false);
139 
145  void SetMergeDefaults(bool bMergeDefaults = true);
146 
155  void SetPreferReferenceEntities(bool bPrefereReference = true);
156 
170  tResult CreatePartial(const cDDLDescription* poRefDDL, double fVersion);
171 
179 
186 
193 
199 
207 
213 
221  void PrintAllMessages(tImporterMsgSeverity eLeastSeverity = eImporterInfo);
222 
223  private: // methods
234  A_UTILS_NS::cDOMElementRef poBUElement);
235 
246  A_UTILS_NS::cDOMElementRef poPrefixElement);
247 
258  A_UTILS_NS::cDOMElementRef poUnitElement);
259 
270  A_UTILS_NS::cDOMElement * poDTElement);
271 
282  A_UTILS_NS::cDOMElement* poEnumElement);
283 
296  A_UTILS_NS::cDOMElement * poStructElement);
297 
308  A_UTILS_NS::cDOMElement * poStreamElement);
309 
318  tDDLStreamMetaTypeVec& vecStreamMetaTypes);
319 
320  private: // members
321  A_UTILS_NS::cDOM m_oDOM;
322  cDDLDescription *m_poDDL;
323  const cDDLDescription *m_poCurrentRefDDL;
324 
325  tDDLUnitVec m_vecUnknownUnits;
326  tDDLComplexVec m_vecUnknownStructs;
327  tDDLStreamMetaTypeVec m_vecUnknownStreamMetaTypes;
328  bool m_bInitFlag;
329  int m_nCreationLevel;
330 
338  void PushMessage(const A_UTILS_NS::cString& strMsg, tImporterMsgSeverity eSeverity);
339 
351  template<typename T>
352  T* TryToFind(const A_UTILS_NS::cString& strName,
353  cDDLContainer<T>& vecFirstData,
354  cDDLContainer<T>& vecSecondData);
355 
356  bool m_bFullCheck;
357  tImporterMsgList m_lstErrors;
358  bool m_bBasicCheck;
359  bool m_bMergeDefaults;
360  bool m_bSorted;
361  bool m_bPrefereReference;
362  };
363 
364 } // namespace adtf_ddl
365 
366 #endif // _DDL_IMPORTER_H_INCLUDED_
cDOM implements a XML parser which can be used to read in XML files and perform simple (!...
File name class.
Definition: filename.h:59
Abstract base class/interface for Factory Method design-pattern.
Representation of a base unit inside a DDL description.
Definition: ddlbaseunit.h:16
Representation for a complex datatype inside a DDL specification.
Definition: ddlcomplex.h:35
Representation for a (simple) data type inside a DDL description.
Definition: ddldatatype.h:19
Main class representing a whole DDL description.
Representation for an enum inside a DDL description.
Definition: ddlenum.h:20
Concrete Factory Method for building up a DDL from a XML file.
Definition: ddlimporter.h:45
tResult BuildStreams()
Method to build a streams object hierarchy.
tResult BuildSingleBaseunit(cDDLBaseunit **ppoNewBU, A_UTILS_NS::cDOMElementRef poBUElement)
Creates a baseunit object from the given DOMElement.
cDDLImporter(bool bBasicCheck=true, bool bSorted=true)
Default CTOR.
void SetMergeDefaults(bool bMergeDefaults=true)
Setter to enable disable the merge of DDL defaults (units, datattypes, etc.)
tResult SetFile(A_UTILS_NS::cFilename const strFile)
Setter for the source file.
tResult BuildSingleStruct(cDDLComplex **ppoNewStruct, A_UTILS_NS::cDOMElement *poStructElement)
Creates a struct object from the given DOMElement.
tResult SetXML(const A_UTILS_NS::cString &strXML)
Setter for a XML string containing the DDL to import.
tResult BuildStructs()
Method to build a structs object hierarchy.
tResult BuildSingleUnit(cDDLUnit **ppoNewUnit, A_UTILS_NS::cDOMElementRef poUnitElement)
Creates a unit object from the given DOMElement.
static void DestroyDDL(cDDLDescription *poDDL)
Static method to destroy the given DDL hierarchy.
void SetPreferReferenceEntities(bool bPrefereReference=true)
Setter to switch from prefereing entities from the reference DDL, to using the reference enties only ...
cDDLImporter(int nCreationLevel, bool bBasicCheck=true, bool bSorted=true)
CTOR with creation level.
A_UTILS_NS::cString GetLastErrorDesc() const
Getter for the most recent error description.
void DestroyDDL()
Method to destroy the DDL object and all contained objects.
tResult BuildSinglePrefix(cDDLPrefix **ppoNewPrefix, A_UTILS_NS::cDOMElementRef poPrefixElement)
Creates a prefix object from the given DOMElement.
tResult BuildSingleStream(cDDLStream **ppoNewStream, A_UTILS_NS::cDOMElement *poStreamElement)
Creates a DDL stream object from the given DOMElement.
void SetCreationLevel(int const nLevel=1)
Setter for the creation level.
tResult BuildHeader()
Method to build a header object.
tImporterMsgList GetAllMessages() const
Getter for all detected errors.
tResult BuildSingleDatatype(cDDLDataType **ppoNewDatatype, A_UTILS_NS::cDOMElement *poDTElement)
Creates a datatype object from the given DOMElement.
tResult CreatePartial(const cDDLDescription *poRefDDL, double fVersion)
Method to create a partial DDL (e.g.
cDDLDescription * GetDDL() const
Getter for the DDL object.
cDDLImporter(const A_UTILS_NS::cFilename &strFile, bool bBasicCheck=true, bool bSorted=true)
CTOR with file name/path.
tResult CreateNew(double fVersion=0)
Method to build up a new DDL hierarchy.
tResult SetDOM(A_UTILS_NS::cDOM *poDOM)
Setter for a DOM.
tResult BuildStreamMetaTypes()
Method to build a streams object hierarchy.
tResult BuildEnums()
Method to build a enums object hierarchy.
void PrintAllMessages(tImporterMsgSeverity eLeastSeverity=eImporterInfo)
Method to log all messages which have at least the given severity to console.
A_UTILS_NS::cString GetErrorDesc() const
Getter for the description of the last error.
tResult BuildSingleStreamMetaType(A_UTILS_NS::cDOMElement *poStreamMetaTypeElement, tDDLStreamMetaTypeVec &vecStreamMetaTypes)
Creates a DDL stream object from the given DOMElement.
cDDLImporter(const char *strFile, bool bBasicCheck=true, bool bSorted=true)
CTOR with file name/path.
void PushMessage(const A_UTILS_NS::cString &strMsg, tImporterMsgSeverity eSeverity)
Helper method to create a message and save it in the appropriate container.
tResult BuildDatatypes()
Method to build a datatypes object hierarchy.
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.
tResult BuildUnits()
Method to build a units object hierarchy.
tResult BuildSingleEnum(cDDLEnum **ppoNewEnum, A_UTILS_NS::cDOMElement *poEnumElement)
Creates an enum object from the given DOMElement.
void SetFullCheckDescriptionMode(bool bFullCheck=false)
Setter for the validation mode.
Representation of a prefix in a DDL description.
Definition: ddlprefix.h:17
Representation of a stream inside a DDL description.
Definition: ddlstream.h:28
Representation object of a unit.
Definition: ddlunit.h:28
Namespace for the mainpage_pkg_ddl.
std::list< tImporterMsg > tImporterMsgList
Container for error descriptions.
Definition: ddlimporter.h:38
tImporterMsgSeverity
enumeration type for message severity
Definition: ddlimporter.h:19
error description structure type
A_UTILS_NS::cString strDesc
string of the message
Definition: ddlimporter.h:31
tImporterMsgSeverity eSeverity
enumeration type for message severity
Definition: ddlimporter.h:32