*** empty log message ***

This commit is contained in:
David Rose 2001-05-15 19:23:32 +00:00
parent 73be73e742
commit 42f0d671e0
4 changed files with 89 additions and 12 deletions

View File

@ -6,14 +6,15 @@
#define TARGET event
#define SOURCES \
config_event.cxx config_event.h event.cxx event.h eventHandler.cxx \
config_event.cxx config_event.h \
event.I event.cxx event.h eventHandler.cxx \
eventHandler.h eventParameter.I eventParameter.cxx \
eventParameter.h eventQueue.I eventQueue.cxx eventQueue.h \
eventReceiver.cxx eventReceiver.h pt_Event.cxx pt_Event.h \
throw_event.I throw_event.h
#define INSTALL_HEADERS \
event.h eventHandler.h eventParameter.I eventParameter.h \
event.I event.h eventHandler.h eventParameter.I eventParameter.h \
eventQueue.h eventQueue.I throw_event.h throw_event.I \
eventReceiver.h \
pt_Event.h

52
panda/src/event/event.I Normal file
View File

@ -0,0 +1,52 @@
// Filename: event.I
// Created by: drose (15May01)
//
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Function: Event::set_name
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void Event::
set_name(const string &name) {
_name = name;
}
////////////////////////////////////////////////////////////////////
// Function: Event::clear_name
// Access: Public
// Description: Resets the Event's name to empty.
////////////////////////////////////////////////////////////////////
INLINE void Event::
clear_name() {
_name = "";
}
////////////////////////////////////////////////////////////////////
// Function: Event::has_name
// Access: Public
// Description: Returns true if the Event has a nonempty name set,
// false if the name is empty.
////////////////////////////////////////////////////////////////////
INLINE bool Event::
has_name() const {
return !_name.empty();
}
////////////////////////////////////////////////////////////////////
// Function: Event::get_name
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE const string &Event::
get_name() const {
return _name;
}
INLINE ostream &operator << (ostream &out, const Event &n) {
n.output(out);
return out;
}

View File

@ -15,7 +15,7 @@ TypeHandle Event::_type_handle;
////////////////////////////////////////////////////////////////////
Event::
Event(const string &event_name, EventReceiver *receiver) :
Namable(event_name)
_name(event_name)
{
_receiver = receiver;
}
@ -27,9 +27,9 @@ Event(const string &event_name, EventReceiver *receiver) :
////////////////////////////////////////////////////////////////////
Event::
Event(const Event &copy) :
Namable(copy),
_parameters(copy._parameters),
_receiver(copy._receiver)
_receiver(copy._receiver),
_name(copy._name)
{
}
@ -40,9 +40,9 @@ Event(const Event &copy) :
////////////////////////////////////////////////////////////////////
void Event::
operator = (const Event &copy) {
Namable::operator = (copy);
_parameters = copy._parameters;
_receiver = copy._receiver;
_name = copy._name;
}
////////////////////////////////////////////////////////////////////
@ -126,3 +126,13 @@ void Event::
clear_receiver() {
_receiver = (EventReceiver *)NULL;
}
////////////////////////////////////////////////////////////////////
// Function: Event::output
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void Event::
output(ostream &out) const {
out << get_name();
}

View File

@ -10,9 +10,7 @@
#include "eventParameter.h"
#include <typedReferenceCount.h>
#include <namable.h>
class EventReceiver;
@ -22,14 +20,23 @@ class EventReceiver;
// any thread may throw an event at any time; there will
// be one process responsible for reading and dispacting
// on the events (but not necessarily immediately).
//
// This function use to inherit from Namable, but that
// makes it too expensive to get its name the Python
// code. Now it just copies the Namable interface in.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEXPRESS Event : public TypedReferenceCount, public Namable {
class EXPCL_PANDAEXPRESS Event : public TypedReferenceCount {
PUBLISHED:
Event(const string &event_name, EventReceiver *receiver = NULL);
Event(const Event &copy);
void operator = (const Event &copy);
~Event();
INLINE void set_name(const string &name);
INLINE void clear_name();
INLINE bool has_name() const;
INLINE const string &get_name() const;
void add_parameter(const EventParameter &obj);
int get_num_parameters() const;
@ -40,21 +47,24 @@ PUBLISHED:
void set_receiver(EventReceiver *receiver);
void clear_receiver();
void output(ostream &out) const;
protected:
typedef vector<EventParameter> ParameterList;
ParameterList _parameters;
EventReceiver *_receiver;
private:
string _name;
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
TypedReferenceCount::init_type();
Namable::init_type();
register_type(_type_handle, "Event",
TypedReferenceCount::get_class_type(),
Namable::get_class_type());
TypedReferenceCount::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
@ -65,4 +75,8 @@ private:
static TypeHandle _type_handle;
};
INLINE ostream &operator << (ostream &out, const Event &n);
#include "event.I"
#endif