diff options
Diffstat (limited to 'project2/common/sourceObject.h')
-rw-r--r-- | project2/common/sourceObject.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/project2/common/sourceObject.h b/project2/common/sourceObject.h index f8963ea..8529100 100644 --- a/project2/common/sourceObject.h +++ b/project2/common/sourceObject.h @@ -3,6 +3,7 @@ #include <boost/intrusive_ptr.hpp> #include <string> +#include <map> #include "intrusivePtrBase.h" #include "scriptLoader.h" #include "scripts_fwd.h" @@ -15,16 +16,30 @@ class CommonObjects; /// Base class for all Project2 components that can be placed in a Project2 script class SourceObject : public virtual IntrusivePtrBase { public: + typedef int EventID; + typedef boost::function<void()> Event; + typedef std::multimap<EventID, Event> Events; + SourceObject(ScriptNodePtr p); SourceObject(const std::string & name); virtual ~SourceObject() = 0; virtual void loadComplete(const CommonObjects *); + SourceObject * findComponent(const std::string & name) const; + + void registerFor(EventID eventID, const Event & event) const; + void send(EventID eventID) const; + const std::string name; const unsigned int order; + + private: static unsigned int loadOrder; + + mutable Events events; + const ScriptReader * const script; }; #endif |