OMNeT++ NEDXML  6.0.3
nedcrossvalidator.h
Go to the documentation of this file.
1 //==========================================================================
2 // nedcrossvalidator.h - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 // Contents:
8 // class NedCrossValidator
9 //
10 //==========================================================================
11 
12 /*--------------------------------------------------------------*
13  Copyright (C) 2002-2017 Andras Varga
14  Copyright (C) 2006-2017 OpenSim Ltd.
15 
16  This file is distributed WITHOUT ANY WARRANTY. See the file
17  `license' for details on this and other legal matters.
18 *--------------------------------------------------------------*/
19 
20 
21 #ifndef __OMNETPP_NEDXML_NEDCROSSVALIDATOR_H
22 #define __OMNETPP_NEDXML_NEDCROSSVALIDATOR_H
23 
24 #include <cstring>
25 #include "nedvalidator.h"
26 
27 namespace omnetpp {
28 namespace nedxml {
29 
30 class NedResourceCache;
31 
32 
33 // *** CURRENTLY NOT IN USE ***
34 
41 class NEDXML_API NedCrossValidator : public NedValidatorBase
42 {
43  protected:
45 
46  // temporary variables:
48 
49  ASTNode *findChildWithTagAndAttribute(ASTNode *node, int tag, const char *attr, const char *value);
50  void checkGate(GateElement *gate, bool hasGateIndex, bool isInput, ASTNode *conn, bool isSrcGate);
51  void validateConnGate(const char *submodName, bool hasSubmodIndex,
52  const char *gateName, bool hasGateIndex,
53  ASTNode *parent, ASTNode *conn, bool isSrc);
54 
55  // internal helper
56  ASTNode *getXXXDeclaration(const char *name, int tagcode1, int tagcode2=-1);
57 
58  // these utility methods look up name in resolver, and add an error if the type doesn't match
59  ASTNode *getModuleDeclaration(const char *name);
60  ASTNode *getChannelDeclaration(const char *name);
61  ASTNode *getModuleInterfaceDeclaration(const char *name);
62  ASTNode *getChannelInterfaceDeclaration(const char *name);
63 
64  public:
67 
69  virtual ~NedCrossValidator() {}
70 
71  protected:
74  virtual void validateElement(FilesElement *node) override;
75  virtual void validateElement(NedFileElement *node) override;
76  virtual void validateElement(CommentElement *node) override;
77  virtual void validateElement(ImportElement *node) override;
78  virtual void validateElement(PropertyDeclElement *node) override;
79  virtual void validateElement(ExtendsElement *node) override;
80  virtual void validateElement(InterfaceNameElement *node) override;
81  virtual void validateElement(SimpleModuleElement *node) override;
82  virtual void validateElement(ModuleInterfaceElement *node) override;
83  virtual void validateElement(CompoundModuleElement *node) override;
84  virtual void validateElement(ChannelInterfaceElement *node) override;
85  virtual void validateElement(ChannelElement *node) override;
86  virtual void validateElement(ParametersElement *node) override;
87  virtual void validateElement(ParamElement *node) override;
88  virtual void validateElement(PropertyElement *node) override;
89  virtual void validateElement(PropertyKeyElement *node) override;
90  virtual void validateElement(GatesElement *node) override;
91  virtual void validateElement(GateElement *node) override;
92  virtual void validateElement(TypesElement *node) override;
93  virtual void validateElement(SubmodulesElement *node) override;
94  virtual void validateElement(SubmoduleElement *node) override;
95  virtual void validateElement(ConnectionsElement *node) override;
96  virtual void validateElement(ConnectionElement *node) override;
97  virtual void validateElement(ConnectionGroupElement *node) override;
98  virtual void validateElement(LoopElement *node) override;
99  virtual void validateElement(ConditionElement *node) override;
100  virtual void validateElement(LiteralElement *node) override;
101  virtual void validateElement(UnknownElement *node) override;
103 };
104 
105 } // namespace nedxml
106 } // namespace omnetpp
107 
108 
109 #endif
110 
omnetpp::nedxml::NedResourceCache
Stores loaded NED files, and keeps track of components in them.
Definition: nedresourcecache.h:52
omnetpp::nedxml::NedCrossValidator::moduleTypeDecl
ASTNode * moduleTypeDecl
Definition: nedcrossvalidator.h:47
omnetpp::nedxml::NedCrossValidator
Performs cross validation. Should be called after tree passed DTD validation and syntax validation.
Definition: nedcrossvalidator.h:41
omnetpp::nedxml::NedCrossValidator::resolver
NedResourceCache * resolver
Definition: nedcrossvalidator.h:44
NEDXML_API
#define NEDXML_API
Definition: nedxmldefs.h:31
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
omnetpp::nedxml::NedCrossValidator::~NedCrossValidator
virtual ~NedCrossValidator()
Definition: nedcrossvalidator.h:69
omnetpp::nedxml::ErrorStore
Definition: errorstore.h:37