Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6cfc0cc923eac844efc6aab3aa3b65fab30f7322 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*******************************************************************************
 * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Peter Karlitschek (initial contribution)
 *
 *******************************************************************************/

#include "ActorClassBase.h"

namespace etRuntime {

ActorClassBase::ActorClassBase(IRTObject* parent, std::string name, Address ownAddr, Address systemPortPeerAddr)
	: 	EventReceiver(parent, name),
		IMessageReceiver(),
		m_state(0),
		history(0), //to be instantiated by derived class
		m_RTSystemPort(0),
		m_className("noname"),
		m_ownAddr(ownAddr),
		m_ownMsgsvc(RTServices::getInstance().getMsgSvcCtrl().getMsgSvc(ownAddr.m_threadID)) {

	// own ports
	m_RTSystemPort = new RTSystemServicesProtocolPort(*this, this, "RTSystemPort", 0, 0, ownAddr,
		systemPortPeerAddr);
}

ActorClassBase::~ActorClassBase() {
	delete m_RTSystemPort;
	m_RTSystemPort = 0;
	delete history;
	history = 0;
}

bool ActorClassBase::handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {
	if ((ifitem != 0) && (ifitem->getLocalId() != 0)) {
		return false;
	}

	switch (evt) {
	case RTSystemServicesProtocol::IN_executeInitialTransition:
		executeInitTransition();
		break;
	case RTSystemServicesProtocol::IN_startDebugging:
		break;
	case RTSystemServicesProtocol::IN_stopDebugging:
		break;
	default:
		return false;
	}
	return true;
}

std::string ActorClassBase::toString() {
	return "ActorClass(className=" + m_className + ", instancePath=" + getInstancePath() + ")";
}

} /* namespace etRuntime */

Back to the top