Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bf1447154e15db466617560314e2d4753b5615d0 (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
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2013 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:
 * 		Juergen Haug (initial contribution)
 *
 *******************************************************************************/
#ifndef SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_
#define SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_

#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/InterfaceItemBase.h"
#include "common/modelbase/IReplicatedInterfaceItem.h"
#include "common/containers/String.h"
#include "common/containers/Vector.h"

namespace etRuntime {

class ReplicatedInterfaceItemBase: public RTObject,
		public virtual IReplicatedInterfaceItem,
		public virtual IInterfaceItemOwner {

public:
	static const char SEP = ':';

	virtual ~ReplicatedInterfaceItemBase();

	virtual InterfaceItemBase* createSubInterfaceItem();
	virtual void removeItem(InterfaceItemBase& item);

	InterfaceItemBase* getInterfaceItem(int idx) const;
	int getNInterfaceItems() const {
		return m_items.size();
	}

	int getLocalId() const {
		return m_localId;
	}

	virtual IEventReceiver* getEventReceiver() const;
	virtual IReplicatedInterfaceItem* getSystemPort() const;

	String toString() const;

	virtual IInterfaceItem* connectWith(IInterfaceItem* peer);

protected:

	ReplicatedInterfaceItemBase(IInterfaceItemOwner* owner, const String& name, int localId);

	Vector<InterfaceItemBase*>& getItems() {
		return m_items;
	}

	virtual InterfaceItemBase* createInterfaceItem(IInterfaceItemOwner* rcv, const String& name, int lid, int idx) = 0;
private:
	int m_localId;
	Vector<InterfaceItemBase*> m_items;
	Vector<int> m_releasedIndices;

	int getFreeIndex();

	ReplicatedInterfaceItemBase();
	ReplicatedInterfaceItemBase(ReplicatedInterfaceItemBase const&);
	ReplicatedInterfaceItemBase& operator=(ReplicatedInterfaceItemBase const&);
};

}  // namespace etRuntime

#endif /* SRC_COMMON_MODELBASE_REPLICATEDINTERFACEITEMBASE_H_ */

Back to the top