00001 00015 #ifndef ELEMENTS_H 00016 #define ELEMENTS_H 00017 00018 #include <vector> 00019 #include <map> 00020 #include <list> 00021 #include <string> 00022 #include "kernel.h" 00023 #include "buffer.h" 00024 00025 using namespace std; 00026 00027 namespace SMP{ 00028 00034 class _buffer 00035 { 00036 private: 00042 static uint gen_uid() { 00043 static uint buid_count = 0; 00044 return buid_count++; 00045 } 00046 public: 00047 /*------------------------------------------------------------------ 00048 * Port Connectivities 00049 */ 00051 uint buid; // mobo - 2006/7/9 00053 int src; 00055 int src_port; 00057 vector<int> dest; 00059 vector<int> dest_port; 00061 int size; 00063 int type; 00064 00070 _buffer(int _src = -1, int _src_port = -1, int _size = BUF_MAX) 00071 { 00072 src = _src; 00073 src_port = _src_port; 00074 size = _size; 00075 buid = _buffer::gen_uid(); 00076 } 00077 }; 00078 00079 00085 class _filter 00086 { 00087 private: 00093 static uint gen_uid() { 00094 static uint f_uid_count = 0; 00095 return f_uid_count++; 00096 } 00097 public: 00098 /*------------------------------- 00099 * From <filter> tag 00100 */ 00102 string name; 00103 00105 string alias; // mobo - 2006/7/4 00106 00110 uint fuid; // mobo - 2006/7/9 00111 00116 char version[6]; 00117 00118 /*------------------------------- 00119 * From <InputPort> and <OutputPort> tag 00120 */ 00122 vector<string> inport; 00124 vector<string> outport; 00125 #ifdef USE_PTHREAD 00126 00127 vector<string> sig_inport; 00129 vector<string> sig_outport; 00130 #endif 00131 00133 map<string, property_item> default_property; 00135 map<string, property_item> property; 00136 00138 _filter(){ 00139 name = "unknown"; 00140 alias = "none"; 00141 strcpy(version, "0.0"); 00142 fuid = _filter::gen_uid(); 00143 } 00145 _filter(const _filter *f){ 00146 name = f->name; 00147 alias = f->alias; 00148 strcpy(version, f->version); 00149 inport = f->inport; 00150 outport = f->outport; 00151 sig_inport = f->sig_inport; 00152 sig_outport = f->sig_outport; 00153 default_property = f->default_property; 00154 property = f->property; 00155 fuid = _filter::gen_uid(); 00156 } 00157 }; 00158 00159 00160 } //end-namespace 00161 #endif