RaftLib  0.3a
C++ Stream Processing Template Library
port_info.hpp
1 
20 #ifndef _PORT_INFO_HPP_
21 #define _PORT_INFO_HPP_ 1
22 #include <typeinfo>
23 #include <typeindex>
24 #include <string>
25 #include <map>
26 #include <functional>
27 #include <cstddef>
28 #include <memory>
29 #include <cassert>
30 
31 #include "ringbuffertypes.hpp"
32 #include "port_info_types.hpp"
33 #include "fifo.hpp"
34 
35 namespace raft{
36  class kernel;
37 }
38 
39 struct PortInfo
40 {
41  PortInfo() : type( typeid(*this) )
42  {
47  }
48 
49  PortInfo( const std::type_info &the_type ) : type( the_type )
50  {
51 
52  }
53 
54  PortInfo( const std::type_info &the_type,
55  void * const ptr,
56  const std::size_t nitems,
57  const std::size_t start_index ) : type( the_type ),
58  existing_buffer( ptr ),
59  nitems( nitems ),
60  start_index( start_index )
61  {
62 
63  }
64 
65 
66  PortInfo( const PortInfo &other ) : type( other.type )
67  {
68  fifo_a = other.fifo_a;
69  fifo_b = other.fifo_b;
70  const_map = other.const_map;
71  my_kernel = other.my_kernel;
72  my_name = other.my_name;
73  other_kernel = other.other_kernel;
74  other_name = other.other_name;
75  out_of_order = other.out_of_order;
76  existing_buffer= other.existing_buffer;
77  nitems = other.nitems;
78  start_index = other.start_index;
79  }
80 
81  virtual ~PortInfo()
82  {
84  }
94  {
95  struct{
96  FIFO *a;
97  FIFO *b;
98  }copy = { fifo_a, fifo_b };
99  while( copy.a != copy.b )
100  {
101  copy.a = fifo_a;
102  copy.b = fifo_b;
103  }
104  return( copy.a );
105  }
106 
112  void setFIFO( FIFO *in )
113  {
114  assert( in != nullptr );
115  fifo_a = in;
116  fifo_b = in;
117  }
118 
119  FIFO *fifo_a = nullptr;
120  FIFO *fifo_b = nullptr;
125  std::type_index type;
126 
135  std::map< Type::RingBufferType , instr_map_t* > const_map;
136 
137  raft::kernel *my_kernel = nullptr;
138  std::string my_name = "";
139 
140  raft::kernel *other_kernel = nullptr;
141  std::string other_name = "";
142  bool use_my_allocator= false;
143  bool out_of_order = false;
144  void *existing_buffer = nullptr;
145  std::size_t nitems = 0;
146  std::size_t start_index = 0;
147 };
148 #endif /* END _PORT_INFO_HPP_ */
std::map< Type::RingBufferType, instr_map_t * > const_map
Definition: port_info.hpp:135
virtual ~PortInfo()
Definition: port_info.hpp:81
PortInfo()
Definition: port_info.hpp:41
FIFO * getFIFO()
Definition: port_info.hpp:93
Definition: port_info.hpp:39
void setFIFO(FIFO *in)
Definition: port_info.hpp:112
std::type_index type
Definition: port_info.hpp:125
Definition: kernel.hpp:48
Definition: globalmap.cpp:3
Definition: fifo.hpp:41