Project

General

Profile

Statistics
| Branch: | Revision:

root / src / scave / commonnodes.cc @ cbd2c699

History | View | Annotate | Download (1.56 KB)

1
//=========================================================================
2
//  COMMONNODES.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 <string.h>
19
#include "commonnodes.h"
20
#include "channel.h"
21

    
22
USING_NAMESPACE
23

    
24

    
25
Port *SingleSourceNodeType::getPort(Node *node, const char *name) const
26
{
27
    SingleSourceNode *node1 = dynamic_cast<SingleSourceNode *>(node);
28
    if (!strcmp(name,"out"))
29
        return &(node1->out);
30
    throw opp_runtime_error("no such port `%s'", name);
31
}
32

    
33
Port *SingleSinkNodeType::getPort(Node *node, const char *name) const
34
{
35
    SingleSinkNode *node1 = dynamic_cast<SingleSinkNode *>(node);
36
    if (!strcmp(name,"in"))
37
        return &(node1->in);
38
    throw opp_runtime_error("no such port `%s'", name);
39
}
40

    
41
bool FilterNode::isFinished() const
42
{
43
    return in()->eof();
44
}
45

    
46
Port *FilterNodeType::getPort(Node *node, const char *name) const
47
{
48
    FilterNode *node1 = dynamic_cast<FilterNode *>(node);
49
    if (!strcmp(name,"in"))
50
        return &(node1->in);
51
    else if (!strcmp(name,"out"))
52
        return &(node1->out);
53
    throw opp_runtime_error("no such port `%s'", name);
54
}
55

    
56

    
57

    
58