00001 #ifndef MNT_COMPONENT_H 00002 #define MNT_COMPONENT_H 00003 00004 #include "mnt_core.h" 00005 #include "mnt_data.h" 00006 00026 class MntComponent : public TclObject 00027 { 00028 public: 00029 MntComponent *down_stream_; 00030 MntComponent *up_stream_; 00031 MntComponent *next_; 00039 inline virtual void recv(MntData *) 00040 { } 00041 00047 inline virtual void flush() 00048 { } 00049 00056 inline virtual void push(MntComponent *component, MntData *data) 00057 { 00058 component->recv(data); 00059 } 00060 00066 inline virtual void push(MntData *data) 00067 { 00068 MntComponent *curr; 00069 for (curr = down_stream_; curr != NULL; curr = curr->next_) 00070 { 00071 curr->recv(data); 00072 } 00073 } 00074 00078 inline virtual void flush_next() 00079 { 00080 MntComponent *curr; 00081 for (curr = down_stream_; curr != NULL; curr = curr->next_) 00082 { 00083 curr->flush(); 00084 } 00085 } 00086 00090 inline virtual void push(MntComponent *component, MntClientData data) 00091 { 00092 // subclass should implement this. 00093 } 00094 00099 inline virtual void pull(MntClientData param) 00100 { 00101 MntComponent *curr; 00102 for (curr = up_stream_; curr != NULL; curr = curr->next_) 00103 { 00104 curr->push(this, param); 00105 } 00106 } 00107 00115 inline char *eval_instproc(const char *method) 00116 { 00117 Tcl::instance().evalf("%s %s", TclObject::name(), method); 00118 return Tcl::instance().result(); 00119 } 00120 00127 inline MntComponent *lookup_tcl_object(const char *name) 00128 { 00129 return (MntComponent *)Tcl::instance().lookup(name); 00130 } 00131 00132 MntComponent(); 00133 void add_link_to(MntComponent *c); 00134 void del_link_to(MntComponent *c); 00135 int command(int, const char*const *); 00136 }; 00137 00138 #endif