Project

General

Profile

Statistics
| Branch: | Revision:

root / src / nedxml / nedcrossvalidator.h @ 79bb12dc

History | View | Annotate | Download (5.14 KB)

1 01873262 Georg Kunz
//==========================================================================
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-2008 Andras Varga
14
  Copyright (C) 2006-2008 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 __NEDCROSSVALIDATOR_H
22
#define __NEDCROSSVALIDATOR_H
23
24
#include <string.h>
25
#include "nedvalidator.h"
26
27
NAMESPACE_BEGIN
28
29
class NEDResourceCache;
30
31
// *** CURRENTLY NOT IN USE ***
32
33
/**
34
 * Performs cross validation. Should be called after tree passed
35
 * DTD validation and syntax validation.
36
 *
37
 * @ingroup Validation
38
 */
39
class NEDXML_API NEDCrossValidator : public NEDValidatorBase
40
{
41
  protected:
42
    bool parsedExpressions;
43
    NEDResourceCache *resolver;
44
45
    // temporary variables:
46
    NEDElement *moduletypedecl;
47
48
    NEDElement *findChildWithTagAndAttribute(NEDElement *node, int tag, const char *attr, const char *value);
49
    void checkGate(GateElement *gate, bool hasGateIndex, bool isInput, NEDElement *conn, bool isSrcGate);
50
    void validateConnGate(const char *submodName, bool hasSubmodIndex,
51
                          const char *gateName, bool hasGateIndex,
52
                          NEDElement *parent, NEDElement *conn, bool isSrc);
53
54
    // internal helper
55
    NEDElement *getXXXDeclaration(const char *name, int tagcode1, int tagcode2=-1);
56
57
    // these utility methods look up name in resolver, and add an error if the type doesn't match
58
    NEDElement *getModuleDeclaration(const char *name);
59
    NEDElement *getChannelDeclaration(const char *name);
60
    NEDElement *getModuleInterfaceDeclaration(const char *name);
61
    NEDElement *getChannelInterfaceDeclaration(const char *name);
62
63
    NEDElement *getEnumDeclaration(const char *name);
64
    NEDElement *getClassDeclaration(const char *name);
65
66
  public:
67
    /** Constructor */
68
    NEDCrossValidator(bool parsedExpr, NEDResourceCache *resolver, NEDErrorStore *e);
69
70
    /** Destructor */
71
    virtual ~NEDCrossValidator();
72
73
  protected:
74
    /** @name Validator methods */
75
    //@{
76
    virtual void validateElement(FilesElement *node);
77
    virtual void validateElement(NedFileElement *node);
78
    virtual void validateElement(CommentElement *node);
79
    virtual void validateElement(ImportElement *node);
80
    virtual void validateElement(PropertyDeclElement *node);
81
    virtual void validateElement(ExtendsElement *node);
82
    virtual void validateElement(InterfaceNameElement *node);
83
    virtual void validateElement(SimpleModuleElement *node);
84
    virtual void validateElement(ModuleInterfaceElement *node);
85
    virtual void validateElement(CompoundModuleElement *node);
86
    virtual void validateElement(ChannelInterfaceElement *node);
87
    virtual void validateElement(ChannelElement *node);
88
    virtual void validateElement(ParametersElement *node);
89
    virtual void validateElement(ParamElement *node);
90
    virtual void validateElement(PropertyElement *node);
91
    virtual void validateElement(PropertyKeyElement *node);
92
    virtual void validateElement(GatesElement *node);
93
    virtual void validateElement(GateElement *node);
94
    virtual void validateElement(TypesElement *node);
95
    virtual void validateElement(SubmodulesElement *node);
96
    virtual void validateElement(SubmoduleElement *node);
97
    virtual void validateElement(ConnectionsElement *node);
98
    virtual void validateElement(ConnectionElement *node);
99
    virtual void validateElement(ChannelSpecElement *node);
100
    virtual void validateElement(ConnectionGroupElement *node);
101
    virtual void validateElement(LoopElement *node);
102
    virtual void validateElement(ConditionElement *node);
103
    virtual void validateElement(ExpressionElement *node);
104
    virtual void validateElement(OperatorElement *node);
105
    virtual void validateElement(FunctionElement *node);
106
    virtual void validateElement(IdentElement *node);
107
    virtual void validateElement(LiteralElement *node);
108
    virtual void validateElement(MsgFileElement *node);
109
    virtual void validateElement(NamespaceElement *node);
110
    virtual void validateElement(CplusplusElement *node);
111
    virtual void validateElement(StructDeclElement *node);
112
    virtual void validateElement(ClassDeclElement *node);
113
    virtual void validateElement(MessageDeclElement *node);
114
    virtual void validateElement(PacketDeclElement *node);
115
    virtual void validateElement(EnumDeclElement *node);
116
    virtual void validateElement(EnumElement *node);
117
    virtual void validateElement(EnumFieldsElement *node);
118
    virtual void validateElement(EnumFieldElement *node);
119
    virtual void validateElement(MessageElement *node);
120
    virtual void validateElement(PacketElement *node);
121
    virtual void validateElement(ClassElement *node);
122
    virtual void validateElement(StructElement *node);
123
    virtual void validateElement(FieldElement *node);
124
    virtual void validateElement(UnknownElement *node);
125
    //@}
126
};
127
128
NAMESPACE_END
129
130
131
#endif