00001 #ifndef ERIS_CLASS_DISPATCH_H
00002 #define ERIS_CLASS_DISPATCH_H
00003
00004 #include <sigc++/object.h>
00005 #include <Eris/Dispatcher.h>
00006
00007 namespace Eris
00008 {
00009
00010 class TypeInfo;
00011 class Connection;
00012
00013 class ClassDispatcher : public Dispatcher, virtual public SigC::Object
00014 {
00015 public:
00016 ClassDispatcher(const std::string &nm, Connection *conn);
00017 virtual ~ClassDispatcher();
00018
00019 virtual bool dispatch(DispatchContextDeque &dq);
00020
00021 virtual Dispatcher* addSubdispatch(Dispatcher *d, const std::string cl);
00022 virtual void rmvSubdispatch(Dispatcher *sub);
00023
00024 virtual Dispatcher* getSubdispatch(const std::string &nm);
00025
00026 virtual bool empty()
00027 { return _subs.empty(); }
00028
00029 static Dispatcher* newAnonymous(Connection *conn);
00030 protected:
00031 typedef struct {
00032 Dispatcher* sub;
00033 TypeInfo* type;
00034 } _Class;
00035
00036 virtual void purge() { throw InvalidOperation("called purge() on ClassDispatcher " + _name); }
00037
00038 void boundType(TypeInfo *tp);
00039 void boundInsert(const _Class &cl);
00040
00041 typedef std::list<_Class> ClassDispatcherList;
00042 ClassDispatcherList _subs;
00043 Connection* _conn;
00044 };
00045
00046 }
00047
00048 #endif