Embedded Multicore Building Blocks V1.0.0
network.h
1 /*
2  * Copyright (c) 2014-2017, Siemens AG. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  * POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #ifndef EMBB_DATAFLOW_NETWORK_H_
28 #define EMBB_DATAFLOW_NETWORK_H_
29 
30 #if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
31 #include <vector>
32 #endif
33 
34 #include <embb/base/atomic.h>
35 #include <embb/base/thread.h>
36 
37 #include <embb/dataflow/internal/select.h>
38 #include <embb/dataflow/internal/switch.h>
39 #include <embb/dataflow/internal/constant_source.h>
40 #include <embb/dataflow/internal/source.h>
41 #include <embb/dataflow/internal/process.h>
42 #include <embb/dataflow/internal/sink.h>
43 
44 #include <embb/dataflow/internal/scheduler_sequential.h>
45 #include <embb/dataflow/internal/scheduler_mtapi.h>
46 
47 namespace embb {
48 namespace dataflow {
49 
50 #ifdef DOXYGEN
51 
57 class Network {
58  public:
68  Network() {}
69 
79  explicit Network(int slices) {}
80 
91  explicit Network(embb::mtapi::ExecutionPolicy const & policy) {}
92 
103  Network(int slices, embb::mtapi::ExecutionPolicy const & policy) {}
104 
108  template <typename Type>
109  class In {
110  };
111 
115  template <typename Type>
116  class Out {
117  public:
121  typedef In<Type> InType;
122 
129  void Connect(InType & input);
130 
137  void operator >> (InType & input);
138  };
139 
148  template <typename T1, typename T2 = embb::base::internal::Nil,
149  typename T3 = embb::base::internal::Nil,
150  typename T4 = embb::base::internal::Nil,
151  typename T5 = embb::base::internal::Nil>
152  struct Inputs {
157  template <int Index>
158  struct Types {
164  };
165 
169  template <int Index>
170  typename Types<Index>::Result & Get();
171  };
172 
181  template <typename T1, typename T2 = embb::base::internal::Nil,
182  typename T3 = embb::base::internal::Nil,
183  typename T4 = embb::base::internal::Nil,
184  typename T5 = embb::base::internal::Nil>
185  struct Outputs {
190  template <int Index>
191  struct Types {
197  };
198 
202  template <int Index>
203  typename Types<Index>::Result & Get();
204  };
205 
219  template <class Inputs, class Outputs>
221  public:
227 
232 
237 
243  SerialProcess(Network & network, FunctionType function);
244 
253  SerialProcess(Network & network, embb::mtapi::Job job);
254 
261  SerialProcess(Network & network, FunctionType function,
262  embb::mtapi::ExecutionPolicy const & policy);
263 
273  SerialProcess(Network & network, embb::mtapi::Job job,
274  embb::mtapi::ExecutionPolicy const & policy);
275 
280  virtual bool HasInputs() const;
281 
285  InputsType & GetInputs();
286 
290  template <int Index>
291  typename InputsType::Types<Index>::Result & GetInput();
292 
297  virtual bool HasOutputs() const;
298 
302  OutputsType & GetOutputs();
303 
307  template <int Index>
308  typename OutputsType::Types<Index>::Result & GetOutput();
309 
315  template <typename T>
316  void operator >> (T & target);
317  };
318 
332  template <class Inputs, class Outputs>
334  public:
340 
345 
350 
356  ParallelProcess(Network & network, FunctionType function);
357 
366  ParallelProcess(Network & network, embb::mtapi::Job job);
367 
374  ParallelProcess(Network & network, FunctionType function,
375  embb::mtapi::ExecutionPolicy const & policy);
376 
387  embb::mtapi::ExecutionPolicy const & policy);
388 
393  virtual bool HasInputs() const;
394 
398  InputsType & GetInputs();
399 
403  template <int Index>
404  typename InputsType::Types<Index>::Result & GetInput();
405 
410  virtual bool HasOutputs() const;
411 
415  OutputsType & GetOutputs();
416 
420  template <int Index>
421  typename OutputsType::Types<Index>::Result & GetOutput();
422 
428  template <typename T>
429  void operator >> (T & target);
430  };
431 
445  template<typename Type>
446  class Switch {
447  public:
452 
457 
462 
467  explicit Select(Network & network);
468 
474  Select(Network & network, embb::mtapi::ExecutionPolicy const & policy);
475 
479  virtual bool HasInputs() const;
480 
484  InputsType & GetInputs();
485 
489  template <int Index>
490  typename InputsType::Types<Index>::Result & GetInput();
491 
495  virtual bool HasOutputs() const;
496 
500  OutputsType & GetOutputs();
501 
505  template <int Index>
506  typename OutputsType::Types<Index>::Result & GetOutput();
507 
513  template <typename T>
514  void operator >> (T & target);
515  };
516 
530  template<typename Type>
531  class Select {
532  public:
537 
542 
547 
552  explicit Select(Network & network);
553 
559  Select(Network & network, embb::mtapi::ExecutionPolicy const & policy);
560 
564  virtual bool HasInputs() const;
565 
569  InputsType & GetInputs();
570 
574  template <int Index>
575  typename InputsType::Types<Index>::Result & GetInput();
576 
580  virtual bool HasOutputs() const;
581 
585  OutputsType & GetOutputs();
586 
590  template <int Index>
591  typename OutputsType::Types<Index>::Result & GetOutput();
592 
598  template <typename T>
599  void operator >> (T & target);
600  };
601 
618  template<typename I1, typename I2 = embb::base::internal::Nil,
619  typename I3 = embb::base::internal::Nil,
620  typename I4 = embb::base::internal::Nil,
621  typename I5 = embb::base::internal::Nil>
622  class Sink {
623  public:
628 
633 
639  Sink(Network & network, FunctionType function);
640 
649  Sink(Network & network, embb::mtapi::Job job);
650 
657  Sink(Network & network, FunctionType function,
658  embb::mtapi::ExecutionPolicy const & policy);
659 
669  Sink(Network & network, embb::mtapi::Job job,
670  embb::mtapi::ExecutionPolicy const & policy);
671 
675  virtual bool HasInputs() const;
676 
680  InputsType & GetInputs();
681 
685  template <int Index>
686  typename InputsType::Types<Index>::Result & GetInput();
687 
691  virtual bool HasOutputs() const;
692  };
693 
709  template<typename O1, typename O2 = embb::base::internal::Nil,
710  typename O3 = embb::base::internal::Nil,
711  typename O4 = embb::base::internal::Nil,
712  typename O5 = embb::base::internal::Nil>
713  class Source {
714  public:
719 
724 
730  Source(Network & network, FunctionType function);
731 
740  Source(Network & network, embb::mtapi::Job job);
741 
748  Source(Network & network, FunctionType function,
749  embb::mtapi::ExecutionPolicy const & policy);
750 
760  Source(Network & network, embb::mtapi::Job job,
761  embb::mtapi::ExecutionPolicy const & policy);
762 
766  virtual bool HasInputs() const;
767 
771  virtual bool HasOutputs() const;
772 
776  OutputsType & GetOutputs();
777 
781  template <int Index>
782  typename OutputsType::Types<Index>::Result & GetOutput();
783 
789  template <typename T>
790  void operator >> (T & target);
791  };
792 
801  template<typename Type>
803  public:
808 
814  ConstantSource(Network & network, Type value);
815 
822  ConstantSource(Network & network, Type value,
823  embb::mtapi::ExecutionPolicy const & policy);
824 
828  virtual bool HasInputs() const;
829 
833  virtual bool HasOutputs() const;
834 
838  OutputsType & GetOutputs();
839 
843  template <int Index>
844  typename OutputsType::Types<Index>::Result & GetOutput();
845 
851  template <typename T>
852  void operator >> (T & target);
853  };
854 
861  bool IsValid();
862 
872  void operator () ();
873 };
874 
875 #else
876 
877 class Network : public internal::ClockListener {
878  public:
879  Network()
880  : sink_counter_(NULL), sink_count_(0)
881  , slices_(0), sched_(NULL), policy_() {
882  // empty
883  }
884 
885  explicit Network(int slices)
886  : sink_counter_(NULL), sink_count_(0)
887  , slices_(slices), sched_(NULL), policy_() {
888  PrepareSlices();
889  }
890 
891  explicit Network(embb::mtapi::ExecutionPolicy const & policy)
892  : sink_counter_(NULL), sink_count_(0)
893  , slices_(0), sched_(NULL), policy_(policy) {
894  }
895 
896  Network(int slices, embb::mtapi::ExecutionPolicy const & policy)
897  : sink_counter_(NULL), sink_count_(0)
898  , slices_(slices), sched_(NULL), policy_(policy) {
899  PrepareSlices();
900  }
901 
902  ~Network() {
903  if (NULL != sched_) {
905  sched_ = NULL;
906  }
907  if (NULL != sink_counter_) {
908  for (int ii = 0; ii < slices_; ii++) {
909  sink_counter_[ii].~Atomic<int>();
910  }
911  embb::base::Allocation::Free(sink_counter_);
912  sink_counter_ = NULL;
913  }
914  }
915 
916  template <typename T1,
917  typename T2 = embb::base::internal::Nil,
918  typename T3 = embb::base::internal::Nil,
919  typename T4 = embb::base::internal::Nil,
920  typename T5 = embb::base::internal::Nil>
921  class Inputs {
922  // empty
923  };
924 
925  template <typename T1,
926  typename T2 = embb::base::internal::Nil,
927  typename T3 = embb::base::internal::Nil,
928  typename T4 = embb::base::internal::Nil,
929  typename T5 = embb::base::internal::Nil>
930  class Outputs {
931  // empty
932  };
933 
934  template <class Inputs, class Outputs> class SerialProcess;
935 
936  template <
937  typename I1, typename I2, typename I3, typename I4, typename I5,
938  typename O1, typename O2, typename O3, typename O4, typename O5>
939  class SerialProcess< Inputs<I1, I2, I3, I4, I5>,
940  Outputs<O1, O2, O3, O4, O5> >
941  : public internal::Process< true,
942  internal::Inputs<I1, I2, I3, I4, I5>,
943  internal::Outputs<O1, O2, O3, O4, O5> > {
944  public:
945  typedef typename internal::Process< true,
946  internal::Inputs<I1, I2, I3, I4, I5>,
947  internal::Outputs<O1, O2, O3, O4, O5> >::FunctionType
948  FunctionType;
949 
950  SerialProcess(Network & network, FunctionType function)
951  : internal::Process< true,
952  internal::Inputs<I1, I2, I3, I4, I5>,
953  internal::Outputs<O1, O2, O3, O4, O5> >(
954  network.sched_, function) {
955  this->SetPolicy(network.policy_);
956  network.processes_.push_back(this);
957  }
958 
959  SerialProcess(Network & network, FunctionType function,
960  embb::mtapi::ExecutionPolicy const & policy)
961  : internal::Process< true,
962  internal::Inputs<I1, I2, I3, I4, I5>,
963  internal::Outputs<O1, O2, O3, O4, O5> >(
964  network.sched_, function) {
965  this->SetPolicy(policy);
966  network.processes_.push_back(this);
967  }
968 
969  SerialProcess(Network & network, embb::mtapi::Job job)
970  : internal::Process< true,
971  internal::Inputs<I1, I2, I3, I4, I5>,
972  internal::Outputs<O1, O2, O3, O4, O5> >(
973  network.sched_, job) {
974  network.processes_.push_back(this);
975  }
976  };
977 
978  template <class Inputs, class Outputs> class ParallelProcess;
979 
980  template <
981  typename I1, typename I2, typename I3, typename I4, typename I5,
982  typename O1, typename O2, typename O3, typename O4, typename O5>
983  class ParallelProcess< Inputs<I1, I2, I3, I4, I5>,
984  Outputs<O1, O2, O3, O4, O5> >
985  : public internal::Process< false,
986  internal::Inputs<I1, I2, I3, I4, I5>,
987  internal::Outputs<O1, O2, O3, O4, O5> >{
988  public:
989  typedef typename internal::Process< false,
990  internal::Inputs<I1, I2, I3, I4, I5>,
991  internal::Outputs<O1, O2, O3, O4, O5> >::FunctionType
992  FunctionType;
993 
994  ParallelProcess(Network & network, FunctionType function)
995  : internal::Process< false,
996  internal::Inputs<I1, I2, I3, I4, I5>,
997  internal::Outputs<O1, O2, O3, O4, O5> >(
998  network.sched_, function) {
999  this->SetPolicy(network.policy_);
1000  network.processes_.push_back(this);
1001  }
1002 
1003  ParallelProcess(Network & network, FunctionType function,
1004  embb::mtapi::ExecutionPolicy const & policy)
1005  : internal::Process< false,
1006  internal::Inputs<I1, I2, I3, I4, I5>,
1007  internal::Outputs<O1, O2, O3, O4, O5> >(
1008  network.sched_, function) {
1009  this->SetPolicy(policy);
1010  network.processes_.push_back(this);
1011  }
1012 
1013  ParallelProcess(Network & network, embb::mtapi::Job job)
1014  : internal::Process< false,
1015  internal::Inputs<I1, I2, I3, I4, I5>,
1016  internal::Outputs<O1, O2, O3, O4, O5> >(
1017  network.sched_, job) {
1018  network.processes_.push_back(this);
1019  }
1020  };
1021 
1022  template<typename Type>
1023  class Switch : public internal::Switch<Type> {
1024  public:
1025  explicit Switch(Network & network)
1026  : internal::Switch<Type>(network.sched_) {
1027  this->SetPolicy(network.policy_);
1028  network.processes_.push_back(this);
1029  }
1030 
1031  Switch(Network & network, embb::mtapi::ExecutionPolicy const & policy)
1032  : internal::Switch<Type>(network.sched_) {
1033  this->SetPolicy(policy);
1034  network.processes_.push_back(this);
1035  }
1036  };
1037 
1038  template<typename Type>
1039  class Select : public internal::Select<Type> {
1040  public:
1041  explicit Select(Network & network)
1042  : internal::Select<Type>(network.sched_) {
1043  this->SetPolicy(network.policy_);
1044  network.processes_.push_back(this);
1045  }
1046 
1047  Select(Network & network, embb::mtapi::ExecutionPolicy const & policy)
1048  : internal::Select<Type>(network.sched_) {
1049  this->SetPolicy(policy);
1050  network.processes_.push_back(this);
1051  }
1052  };
1053 
1054  template<typename I1, typename I2 = embb::base::internal::Nil,
1055  typename I3 = embb::base::internal::Nil,
1056  typename I4 = embb::base::internal::Nil,
1057  typename I5 = embb::base::internal::Nil>
1058  class Sink : public internal::Sink<
1059  internal::Inputs<I1, I2, I3, I4, I5> > {
1060  public:
1061  typedef typename internal::Sink<
1062  internal::Inputs<I1, I2, I3, I4, I5> >::FunctionType FunctionType;
1063 
1064  Sink(Network & network, FunctionType function)
1065  : internal::Sink<
1066  internal::Inputs<I1, I2, I3, I4, I5> >(
1067  network.sched_, &network, function) {
1068  this->SetPolicy(network.policy_);
1069  network.sinks_.push_back(this);
1070  network.sink_count_++;
1071  }
1072 
1073  Sink(Network & network, FunctionType function,
1074  embb::mtapi::ExecutionPolicy const & policy)
1075  : internal::Sink<
1076  internal::Inputs<I1, I2, I3, I4, I5> >(
1077  network.sched_, &network, function) {
1078  this->SetPolicy(policy);
1079  network.sinks_.push_back(this);
1080  network.sink_count_++;
1081  }
1082 
1083  Sink(Network & network, embb::mtapi::Job job)
1084  : internal::Sink<
1085  internal::Inputs<I1, I2, I3, I4, I5> >(
1086  network.sched_, &network, job) {
1087  network.sinks_.push_back(this);
1088  network.sink_count_++;
1089  }
1090  };
1091 
1092  template<typename O1, typename O2 = embb::base::internal::Nil,
1093  typename O3 = embb::base::internal::Nil,
1094  typename O4 = embb::base::internal::Nil,
1095  typename O5 = embb::base::internal::Nil>
1096  class Source : public internal::Source<
1097  internal::Outputs<O1, O2, O3, O4, O5> > {
1098  public:
1099  typedef typename internal::Source<
1100  internal::Outputs<O1, O2, O3, O4, O5> >::FunctionType
1101  FunctionType;
1102 
1103  Source(Network & network, FunctionType function)
1104  : internal::Source<
1105  internal::Outputs<O1, O2, O3, O4, O5> >(network.sched_, function) {
1106  this->SetPolicy(network.policy_);
1107  network.sources_.push_back(this);
1108  }
1109 
1110  Source(Network & network, FunctionType function,
1111  embb::mtapi::ExecutionPolicy const & policy)
1112  : internal::Source<
1113  internal::Outputs<O1, O2, O3, O4, O5> >(network.sched_, function) {
1114  this->SetPolicy(policy);
1115  network.sources_.push_back(this);
1116  }
1117 
1118  Source(Network & network, embb::mtapi::Job job)
1119  : internal::Source<
1120  internal::Outputs< O1, O2, O3, O4, O5> >(network.sched_, job) {
1121  network.sources_.push_back(this);
1122  }
1123  };
1124 
1125  template<typename Type>
1126  class ConstantSource : public internal::ConstantSource<Type> {
1127  public:
1128  ConstantSource(Network & network, Type value)
1129  : internal::ConstantSource<Type>(network.sched_, value) {
1130  this->SetPolicy(network.policy_);
1131  network.sources_.push_back(this);
1132  }
1133 
1134  ConstantSource(Network & network, Type value,
1135  embb::mtapi::ExecutionPolicy const & policy)
1136  : internal::ConstantSource<Type>(network.sched_, value) {
1137  this->SetPolicy(policy);
1138  network.sources_.push_back(this);
1139  }
1140  };
1141 
1142  bool IsValid() {
1143  bool valid = true;
1144  // check connectivity
1145  for (size_t ii = 0; ii < sources_.size() && valid; ii++) {
1146  valid = valid && sources_[ii]->IsFullyConnected();
1147  }
1148  for (size_t ii = 0; ii < processes_.size() && valid; ii++) {
1149  valid = valid && processes_[ii]->IsFullyConnected();
1150  }
1151  for (size_t ii = 0; ii < sinks_.size() && valid; ii++) {
1152  valid = valid && sinks_[ii]->IsFullyConnected();
1153  }
1154  // check for cycles
1155  for (size_t ii = 0; ii < processes_.size() && valid; ii++) {
1156  valid = valid && !processes_[ii]->HasCycle();
1157  }
1158  return valid;
1159  }
1160 
1161  void operator () () {
1162  if (0 >= slices_) {
1163  slices_ = static_cast<int>(
1164  sources_.size() +
1165  sinks_.size());
1166  for (size_t ii = 0; ii < processes_.size(); ii++) {
1167  int tt = processes_[ii]->IsSequential() ? 1 :
1168  static_cast<int>(embb_core_count_available());
1169  slices_ += tt;
1170  }
1171  PrepareSlices();
1172  for (size_t ii = 0; ii < sources_.size(); ii++) {
1173  sources_[ii]->SetScheduler(sched_);
1174  }
1175  for (size_t ii = 0; ii < processes_.size(); ii++) {
1176  processes_[ii]->SetScheduler(sched_);
1177  }
1178  for (size_t ii = 0; ii < sinks_.size(); ii++) {
1179  sinks_[ii]->SetScheduler(sched_);
1180  }
1181  }
1182 
1183  int clock = 0;
1184  while (clock >= 0) {
1185  const int idx = clock % slices_;
1186  while (sink_counter_[idx] > 0) {
1187  sched_->YieldToScheduler();
1188  }
1189  if (!SpawnClock(clock))
1190  break;
1191  clock++;
1192  }
1193 
1194  int ii = clock - slices_ + 1;
1195  if (ii < 0) ii = 0;
1196  for (; ii < clock; ii++) {
1197  const int idx = ii % slices_;
1198  while (sink_counter_[idx] > 0) {
1199  sched_->YieldToScheduler();
1200  }
1201  }
1202  }
1203 
1210  virtual void OnClock(int clock) {
1211  const int idx = clock % slices_;
1212  assert(sink_counter_[idx] > 0);
1213  --sink_counter_[idx];
1214  }
1215 
1216  private:
1217  std::vector<internal::Node*> processes_;
1218  std::vector<internal::Node*> sources_;
1219  std::vector<internal::Node*> sinks_;
1220  embb::base::Atomic<int> * sink_counter_;
1221  int sink_count_;
1222  int slices_;
1223  internal::Scheduler * sched_;
1225 
1226 #if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
1227  std::vector<int> spawn_history_[Slices];
1228 #endif
1229 
1230  bool SpawnClock(int clock) {
1231  const int idx = clock % slices_;
1232 #if EMBB_DATAFLOW_TRACE_SIGNAL_HISTORY
1233  spawn_history_[idx].push_back(clock);
1234 #endif
1235  assert(sink_counter_[idx] == 0);
1236  sink_counter_[idx] = sink_count_;
1237  for (size_t kk = 0; kk < sources_.size(); kk++) {
1238  sources_[kk]->Start(clock);
1239  }
1240  bool result = true;
1241  for (size_t kk = 0; kk < sources_.size(); kk++) {
1242  result &= sources_[kk]->Wait(clock);
1243  }
1244  return result;
1245  }
1246 
1247  void PrepareSlices() {
1248  sched_ = embb::base::Allocation::New<internal::SchedulerMTAPI>(slices_);
1249  if (sched_->GetSlices() != slices_) {
1250  slices_ = sched_->GetSlices();
1251  }
1252  sink_counter_ = reinterpret_cast<embb::base::Atomic<int>*>(
1254  sizeof(embb::base::Atomic<int>)*slices_));
1255  for (int ii = 0; ii < slices_; ii++) {
1256  new(sink_counter_ + ii) embb::base::Atomic<int>(0);
1257  }
1258  }
1259 };
1260 
1261 #endif // DOXYGEN
1262 
1263 } // namespace dataflow
1264 } // namespace embb
1265 
1266 #endif // EMBB_DATAFLOW_NETWORK_H_
Definition: lock_free_mpmc_queue.h:40
Switch process template.
Definition: network.h:446
unsigned int embb_core_count_available()
Returns the number of available processor cores.
void operator()()
Executes the network until one of the the sources returns false.
static void Free(void *ptr)
Frees memory that has been allocated by Allocation::Allocate() for some pointer ptr.
Select process template.
Definition: network.h:531
Outputs< OUTPUT_TYPE_LIST > OutputsType
Output port type list.
Definition: network.h:723
Inputs< INPUT_TYPE_LIST > InputsType
Input port type list.
Definition: network.h:344
Outputs< Type > OutputsType
Output port type list.
Definition: network.h:461
embb::base::Function< void, INPUT_TYPE_LIST, OUTPUT_TYPE_LIST > FunctionType
Function type to use when processing tokens.
Definition: network.h:226
Outputs< OUTPUT_TYPE_LIST > OutputsType
Output port type list.
Definition: network.h:236
In< Type > InType
Input port class that can be connected to this output port.
Definition: network.h:121
Generic serial process template.
Definition: network.h:220
Input port class.
Definition: network.h:109
Inputs< INPUT_TYPE_LIST > InputsType
Input port type list.
Definition: network.h:632
Inputs< bool, Type > InputsType
Input port type list.
Definition: network.h:456
Network()
Constructs an empty network.
Definition: network.h:68
Outputs< Type > OutputsType
Output port type list.
Definition: network.h:546
Type list used to derive input port types from Index.
Definition: network.h:158
embb::base::Function< void, OUTPUT_TYPE_LIST > FunctionType
Function type to use when processing tokens.
Definition: network.h:718
Constant source process template.
Definition: network.h:802
Output port class.
Definition: network.h:116
Represents a collection of Actions.
Definition: job.h:41
Provides the output port types for a process.
Definition: network.h:185
Wraps function pointers, member function pointers, and functors with up to five arguments.
Definition: function.h:94
static void * Allocate(size_t size)
Allocates size bytes of memory (unaligned).
Outputs< OUTPUT_TYPE_LIST > OutputsType
Output port type list.
Definition: network.h:349
Outputs< OUTPUT_TYPE_LIST > OutputsType
Output port type list.
Definition: network.h:807
Source process template.
Definition: network.h:713
embb::base::Function< void, bool, Type, Type, Type & > FunctionType
Function type to use when processing tokens.
Definition: network.h:536
embb::base::Function< void, INPUT_TYPE_LIST, OUTPUT_TYPE_LIST > FunctionType
Function type to use when processing tokens.
Definition: network.h:339
embb::base::Function< void, bool, Type, Type & > FunctionType
Function type to use when processing tokens.
Definition: network.h:451
embb::base::Function< void, INPUT_TYPE_LIST > FunctionType
Function type to use when processing tokens.
Definition: network.h:627
Out< T_Index > Result
Result of an output port type query.
Definition: network.h:196
Sink process template.
Definition: network.h:622
Describes the execution policy of a parallel algorithm.
Definition: execution_policy.h:48
In< T_Index > Result
Result of an input port type query.
Definition: network.h:163
Inputs< INPUT_TYPE_LIST > InputsType
Input port type list.
Definition: network.h:231
Network(int slices, embb::mtapi::ExecutionPolicy const &policy)
Constructs an empty network.
Definition: network.h:103
Inputs< bool, Type, Type > InputsType
Input port type list.
Definition: network.h:541
bool IsValid()
Checks whether the network is completely connected and free of cycles.
Represents a set of processes that are connected by communication channels.
Definition: network.h:57
Network(int slices)
Constructs an empty network.
Definition: network.h:79
static void Delete(Type *to_delete)
Destructs an instance of type Type and frees the allocated memory.
Definition: memory_allocation.h:176
Network(embb::mtapi::ExecutionPolicy const &policy)
Constructs an empty network.
Definition: network.h:91
Generic parallel process template.
Definition: network.h:333
Type list used to derive output port types from Index.
Definition: network.h:191
Provides the input port types for a process.
Definition: network.h:152