Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 923a327eb3534357192bf552237770966c51f859 (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
/*******************************************************************************
 * Copyright (c) 2016 protos software gmbh (http://www.protos.de).
 * 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:
 * 		Jan Belle (initial contribution)
 *
 *******************************************************************************/

#include "ReplicatedActorClassBase.h"

namespace etRuntime {

ReplicatedActorClassBase::ReplicatedActorClassBase(IRTObject* parent, const String& name) :
		RTObject(parent, name), m_items() {
}

ReplicatedActorClassBase::~ReplicatedActorClassBase() {
	for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
		delete *it;
	}
}

void ReplicatedActorClassBase::createSubActors(int number) {
	m_items.reserve(m_items.size() + number);

	for (int i = 0; i < number; i++) {
		char buffer[64];
		sprintf(buffer, "%s%c%d", getName().c_str(), SEP, i);
		ActorClassBase* item = createActor(getParent(), buffer);
		m_items.push_back(item);
	}
}

void ReplicatedActorClassBase::initialize() {
	for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it) {
		(*it)->initialize();
	}
}

void ReplicatedActorClassBase::setProbesActive(bool recursive, bool active) {
	for(Vector<ActorClassBase*>::iterator it = m_items.begin(); it != m_items.end(); ++it)
			(*it)->setProbesActive(recursive, active);
}

} // namespace etRuntime

Back to the top