EventBuffer.hpp 1.95 KB
Newer Older
Kai-Uwe Sattler's avatar
Kai-Uwe Sattler committed
1
/*
2
 * Copyright (C) 2014-2021 DBIS Group - TU Ilmenau, All Rights Reserved.
Kai-Uwe Sattler's avatar
Kai-Uwe Sattler committed
3
4
5
 *
 * This file is part of the PipeFabric package.
 *
6
7
8
 * PipeFabric is free software: you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
Kai-Uwe Sattler's avatar
Kai-Uwe Sattler committed
9
 *
10
11
12
 * PipeFabric is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
Kai-Uwe Sattler's avatar
Kai-Uwe Sattler committed
13
 *
14
15
 * You should have received a copy of the GNU General Public License along with PipeFabric. If not,
 * see <http://www.gnu.org/licenses/>.
Kai-Uwe Sattler's avatar
Kai-Uwe Sattler committed
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
 */

#ifndef EventBuffer_hpp_
#define EventBuffer_hpp_
#include "Instance.hpp"
#include "util/valueIDMap.hpp"
namespace pfabric {
/**
 * A container or an event buffer to store all matching events
 */
template<class Tin, class Tout>
class EventBuffer: public ValueIDMap<typename Instance<Tin>::InstancePtr> {

public:

	typedef boost::shared_ptr<EventBuffer<Tin, Tout>> EventBufferPtr;
	/**
	 * a default constructor
	 */
	EventBuffer() {}

	/**
	 * A virtual destructor
	 */

	virtual ~EventBuffer() {}
	/**
	 * Output the information  into ostream object
	 * @param out The output stream handle.
	 */
	void print(ostream& out = cout) const {
		/*
		 os << std::endl;
		 for (ValueIDMap<InstancePtr>::MapConstIterator it = this->valueID.begin();
		 it != this->valueID.end(); it++) {
		 os << " [" << it->first << ", ";
		 it->second->print(os);
		 os << "]";
		 }
		 os << std::endl;*/
	}

	/**
	 * Get the event of a given ID.
	 * @param id The ID given to find the event
	 * @return The event of the given ID
	 */
	typename Instance<Tin>::InstancePtr getEvent(const long id) const {
		ValueIDMap<typename Instance<Tin>::InstancePtr>::getValue(id);
		return typename Instance<Tin>::InstancePtr();
	}
};
}
#endif /* EventBuffer_hpp_ */