The MAUVE Toolchain
MuxPriority.hpp
1 /*
2  * Copyright 2017 ONERA
3  *
4  * This file is part of the MAUVE Base Components project.
5  *
6  * MAUVE Base Components is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License version 3 as
8  * published by the Free Software Foundation.
9  *
10  * MAUVE Base Components is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with MAUVE. If not, see <https://www.gnu.org/licenses/lgpl-3.0>.
17  */
18 #ifndef MAUVE_BASE_MUX_PIORITY_HPP
19 #define MAUVE_BASE_MUX_PIORITY_HPP
20 
21 #include <array>
22 
23 #include <mauve/runtime.hpp>
24 
25 namespace mauve {
26  namespace base {
27 
33 template <typename T, int N>
36  runtime::Property< std::array<int, N> > & priorities = mk_property("priorities", std::array<int, N>{});
38  std::array< runtime::ReadPort<T>*, N> read_ports;
41 };
42 
48 template < typename T, int N >
49 struct MuxPriorityReadPortCore : public runtime::Core< MuxPriorityReadPortShell<T, N> > {
51  T read();
56  virtual bool accept(const T& t);
57 };
58 
64 template < typename T, int N >
65 struct MuxPriorityReadPortInterface : public runtime::Interface< MuxPriorityReadPortShell<T, N>,
66  MuxPriorityReadPortCore<T, N> >
67 {
70  runtime::ReadService<T> & read = this->template mk_read_service<T>("read", &C::read);
71 };
72 
73 template <typename T, int N>
76 
77  }
78 }
79 
80 #include "ipp/MuxPriority.ipp"
81 
82 #endif // MAUVE_BASE_MUX_PIORITY_HPP
Definition: Interface.hpp:34
Priority Multiplexer core with read ports.
Definition: MuxPriority.hpp:49
std::array< runtime::ReadPort< T > *, N > read_ports
Array of read ports.
Definition: MuxPriority.hpp:38
Definition: ReadPort.hpp:27
Priority Multiplexer interface with read ports.
Definition: MuxPriority.hpp:65
runtime::Property< std::array< int, N > > & priorities
Property to indicate the order of priority.
Definition: MuxPriority.hpp:36
The MAUVE namespace.
Definition: tracing.hpp:24
Definition: Architecture.hpp:38
A Shell is the interface of a component.
Definition: Shell.hpp:48
The Core defines the methods of the component.
Definition: Core.hpp:38
Property< T > & mk_property(std::string const &name, T init_value)
Create a new property.
Definition: HasProperty.ipp:28
Priority Multiplexer shell with read ports.
Definition: MuxPriority.hpp:34
MuxPriorityReadPortShell()
Constructor.
Definition: MuxPriority.ipp:27