OMNeT++ NEDXML  5.4.1
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:
46 
47  // temporary variables:
49 
50  ASTNode *findChildWithTagAndAttribute(ASTNode *node, int tag, const char *attr, const char *value);
51  void checkGate(GateElement *gate, bool hasGateIndex, bool isInput, ASTNode *conn, bool isSrcGate);
52  void validateConnGate(const char *submodName, bool hasSubmodIndex,
53  const char *gateName, bool hasGateIndex,
54  ASTNode *parent, ASTNode *conn, bool isSrc);
55 
56  // internal helper
57  ASTNode *getXXXDeclaration(const char *name, int tagcode1, int tagcode2=-1);
58 
59  // these utility methods look up name in resolver, and add an error if the type doesn't match
60  ASTNode *getModuleDeclaration(const char *name);
61  ASTNode *getChannelDeclaration(const char *name);
62  ASTNode *getModuleInterfaceDeclaration(const char *name);
63  ASTNode *getChannelInterfaceDeclaration(const char *name);
64 
65  public:
67  NedCrossValidator(bool parsedExpr, NedResourceCache *resolver, ErrorStore *e);
68 
70  virtual ~NedCrossValidator();
71 
72  protected:
75  virtual void validateElement(FilesElement *node) override;
76  virtual void validateElement(NedFileElement *node) override;
77  virtual void validateElement(CommentElement *node) override;
78  virtual void validateElement(ImportElement *node) override;
79  virtual void validateElement(PropertyDeclElement *node) override;
80  virtual void validateElement(ExtendsElement *node) override;
81  virtual void validateElement(InterfaceNameElement *node) override;
82  virtual void validateElement(SimpleModuleElement *node) override;
83  virtual void validateElement(ModuleInterfaceElement *node) override;
84  virtual void validateElement(CompoundModuleElement *node) override;
85  virtual void validateElement(ChannelInterfaceElement *node) override;
86  virtual void validateElement(ChannelElement *node) override;
87  virtual void validateElement(ParametersElement *node) override;
88  virtual void validateElement(ParamElement *node) override;
89  virtual void validateElement(PropertyElement *node) override;
90  virtual void validateElement(PropertyKeyElement *node) override;
91  virtual void validateElement(GatesElement *node) override;
92  virtual void validateElement(GateElement *node) override;
93  virtual void validateElement(TypesElement *node) override;
94  virtual void validateElement(SubmodulesElement *node) override;
95  virtual void validateElement(SubmoduleElement *node) override;
96  virtual void validateElement(ConnectionsElement *node) override;
97  virtual void validateElement(ConnectionElement *node) override;
98  virtual void validateElement(ConnectionGroupElement *node) override;
99  virtual void validateElement(LoopElement *node) override;
100  virtual void validateElement(ConditionElement *node) override;
101  virtual void validateElement(ExpressionElement *node) override;
102  virtual void validateElement(OperatorElement *node) override;
103  virtual void validateElement(FunctionElement *node) override;
104  virtual void validateElement(IdentElement *node) override;
105  virtual void validateElement(LiteralElement *node) override;
106  virtual void validateElement(UnknownElement *node) override;
108 };
109 
110 } // namespace nedxml
111 } // namespace omnetpp
112 
113 
114 #endif
115 
Performs cross validation. Should be called after tree passed DTD validation and syntax validation...
Definition: nedcrossvalidator.h:41
#define NEDXML_API
Definition: nedxmldefs.h:31
NedResourceCache * resolver
Definition: nedcrossvalidator.h:45
ASTNode * moduleTypeDecl
Definition: nedcrossvalidator.h:48
Stores loaded NED files, and keeps track of components in them.
Definition: nedresourcecache.h:52
Definition: astbuilder.h:25
Definition: astnode.h:75
Definition: errorstore.h:37
bool parsedExpressions
Definition: nedcrossvalidator.h:44