Statistics
| Branch: | Revision:

root / src / scave / nodetype.cc @ e1750c09

History | View | Annotate | Download (1.72 KB)

1 01873262 Georg Kunz
//=========================================================================
2
//  NODETYPE.CC - part of
3
//                  OMNeT++/OMNEST
4
//           Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga
7
//
8
//=========================================================================
9
10
/*--------------------------------------------------------------*
11
  Copyright (C) 1992-2008 Andras Varga
12
  Copyright (C) 2006-2008 OpenSim Ltd.
13

14
  This file is distributed WITHOUT ANY WARRANTY. See the file
15
  `license' for details on this and other legal matters.
16
*--------------------------------------------------------------*/
17
18
#include "commonutil.h"
19
#include "nodetype.h"
20
21
USING_NAMESPACE
22
23
24
void NodeType::checkAttrNames(const StringMap& attrs) const
25
{
26
    StringMap allowedAttrs;
27
    getAttributes(allowedAttrs);
28
29
    StringMap defaultAttrs;
30
    getAttrDefaults(defaultAttrs);
31
32
    // are there illegal attributes?
33
    for (StringMap::const_iterator it=attrs.begin(); it!=attrs.end(); ++it)
34
    {
35
        const char *attr = it->first.c_str();
36
        StringMap::iterator j = allowedAttrs.find(attr);
37
        if (j==allowedAttrs.end())
38
            throw opp_runtime_error("illegal attribute `%s'", attr);
39
    }
40
41
    // do we have all attributes?
42
    for (StringMap::const_iterator i=allowedAttrs.begin(); i!=allowedAttrs.end(); ++i)
43
    {
44
        const char *attr = i->first.c_str();
45
        StringMap::const_iterator it = attrs.find(attr);
46
        if (it==attrs.end())
47
        {
48
            if (defaultAttrs.find(attr) == defaultAttrs.end())
49
                throw opp_runtime_error("missing attribute `%s'", attr);
50
        }
51
    }
52
}
53
54
void NodeType::mapVectorAttributes(StringMap &attrs, /*out*/StringVector &warnings) const
55
{
56
    // identity map by default
57
}
58