Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DataEvent.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_DataEvent_h_
00003 #define INCLUDED_DataEvent_h_
00004 
00005 #include "Events/EventBase.h"
00006 
00007 //! for passing around data (or pointers to data)
00008 template<class T>
00009 class DataEvent : public EventBase {
00010 public:
00011   //!@name Constructors
00012   //!
00013   DataEvent() : EventBase() {}
00014   DataEvent(const T& d, EventGeneratorID_t gid, unsigned int sid, EventTypeID_t tid, unsigned int dur=0) : EventBase(gid,sid,tid,dur), data(d) {}
00015   DataEvent(const T& d, EventGeneratorID_t gid, unsigned int sid, EventTypeID_t tid, unsigned int dur, const std::string& n, float mag) : EventBase(gid,sid,tid,dur,n,mag), data(d) {}
00016 
00017   //! copy constructor
00018   DataEvent(const DataEvent& evt) : EventBase(evt), data(evt.data) {}
00019   
00020   //! assignment
00021   const DataEvent& operator=(const DataEvent& evt) { EventBase::operator=(evt); data=evt.data; return *this; }
00022 
00023   virtual EventBase* clone() const { return new DataEvent<T>(*this); }
00024   //@}
00025 
00026   void setData(const T& d) { data=d; } //!< assigns @a d to the internal #data
00027   const T& getData() const { return data; } //!< returns #data
00028   T& getData() { return data; } //!< returns #data
00029 
00030 protected:
00031   T data; //!< the data being communicated
00032 };
00033 
00034 /*! @file
00035  * @brief Defines DataEvent, for passing around data (or pointers to data)
00036  * @author ejt (Creator)
00037  *
00038  * $Author: ejt $
00039  * $Name: tekkotsu-2_4_1 $
00040  * $Revision: 1.3 $
00041  * $State: Exp $
00042  * $Date: 2005/06/29 22:03:34 $
00043  */
00044 
00045 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4