Project

General

Profile

Statistics
| Branch: | Revision:

root / src / envir / matchablefield.h @ a3be1d55

History | View | Annotate | Download (1.41 KB)

1 01873262 Georg Kunz
//==========================================================================
2
//  MATCHABLEFIELD.H - 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
#ifndef __MATCHABLEFIELD_H
19
#define __MATCHABLEFIELD_H
20
21
#include "envirdefs.h"
22
#include "cobject.h"
23
#include "matchexpression.h"
24
25
NAMESPACE_BEGIN
26
27
class cClassDescriptor;
28
29
/**
30
 * Wrapper around a cObject field to make it matchable with MatchExpression.
31
 * The default attribute is the field name.
32
 */
33
class ENVIR_API MatchableFieldAdapter : public MatchExpression::Matchable
34
{
35
  protected:
36
    cObject *object;
37
    mutable cClassDescriptor *classDescriptor;
38
    int fieldIndex;
39
40
  public:
41
    MatchableFieldAdapter(cObject *object = NULL, int fieldIndex = -1);
42
    void setField(cObject *object, int fieldIndex);
43
    void setField(cObject *object, const char *fieldName);
44
    virtual const char *getDefaultAttribute() const;
45
    virtual const char *getAttribute(const char *name) const;
46
};
47
48
NAMESPACE_END
49
50
51
#endif