Statistics
| Branch: | Revision:

root / src / sim / ccompoundmodule.cc @ e1750c09

History | View | Annotate | Download (1.77 KB)

1
//======================================================================
2
//  CCOMPOUNDMODULE.CC - part of
3
//
4
//                 OMNeT++/OMNEST
5
//              Discrete System Simulation in C++
6
//
7
//  Author: Andras Varga
8
//
9
//======================================================================
10

    
11
/*--------------------------------------------------------------*
12
  Copyright (C) 1992-2008 Andras Varga
13
  Copyright (C) 2006-2008 OpenSim Ltd.
14

15
  This file is distributed WITHOUT ANY WARRANTY. See the file
16
  `license' for details on this and other legal matters.
17
*--------------------------------------------------------------*/
18

    
19
#include <stdio.h>
20
#include <string.h>
21
#include <sstream>
22
#include "ccompoundmodule.h"
23
#include "ccomponenttype.h"
24
#include "cmessage.h"
25

    
26
USING_NAMESPACE
27

    
28

    
29
Register_Class(cCompoundModule);
30

    
31

    
32
cCompoundModule::cCompoundModule()
33
{
34
}
35

    
36
cCompoundModule::~cCompoundModule()
37
{
38
}
39

    
40
std::string cCompoundModule::info() const
41
{
42
    std::stringstream out;
43
    out << "id=" << getId();
44
    return out.str();
45
}
46

    
47
void cCompoundModule::doBuildInside()
48
{
49
    // ask module type to create submodules and internal connections
50
    getModuleType()->buildInside(this);
51
}
52

    
53
void cCompoundModule::arrived(cMessage *msg, cGate *ongate, simtime_t)
54
{
55
    throw cRuntimeError("Gate `%s' of compound module (%s)%s is not connected on the %s, "
56
                        "upon arrival of message (%s)%s",
57
                        ongate->getFullName(),
58
                        getClassName(), getFullPath().c_str(),
59
                        (ongate->isConnectedOutside() ? "inside" : "outside"),
60
                        msg->getClassName(), msg->getName());
61
}
62

    
63
void cCompoundModule::scheduleStart(simtime_t t)
64
{
65
    for (SubmoduleIterator submod(this); !submod.end(); submod++)
66
        submod()->scheduleStart(t);
67
}
68

    
69