Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/event/event.cxx

Go to the documentation of this file.
00001 // Filename: event.cxx
00002 // Created by:  drose (08Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "event.h"
00020 #include "config_event.h"
00021 
00022 TypeHandle Event::_type_handle;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //     Function: Event::Constructor
00026 //       Access: Public
00027 //  Description:
00028 ////////////////////////////////////////////////////////////////////
00029 Event::
00030 Event(const string &event_name, EventReceiver *receiver) :
00031   _name(event_name)
00032 {
00033   _receiver = receiver;
00034 }
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //     Function: Event::Copy constructor
00038 //       Access: Public
00039 //  Description:
00040 ////////////////////////////////////////////////////////////////////
00041 Event::
00042 Event(const Event &copy) :
00043   _parameters(copy._parameters),
00044   _receiver(copy._receiver),
00045   _name(copy._name)
00046 {
00047 }
00048 
00049 ////////////////////////////////////////////////////////////////////
00050 //     Function: Event::Copy Assignment Operator
00051 //       Access: Public
00052 //  Description:
00053 ////////////////////////////////////////////////////////////////////
00054 void Event::
00055 operator = (const Event &copy) {
00056   _parameters = copy._parameters;
00057   _receiver = copy._receiver;
00058   _name = copy._name;
00059 }
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //     Function: Event::Destructor
00063 //       Access: Public
00064 //  Description:
00065 ////////////////////////////////////////////////////////////////////
00066 Event::
00067 ~Event() {
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: Event::add_parameter
00072 //       Access: Public
00073 //  Description:
00074 ////////////////////////////////////////////////////////////////////
00075 void Event::
00076 add_parameter(const EventParameter &obj) {
00077   _parameters.push_back(obj);
00078 }
00079 
00080 
00081 ////////////////////////////////////////////////////////////////////
00082 //     Function: Event::get_num_parameters
00083 //       Access: Public
00084 //  Description:
00085 ////////////////////////////////////////////////////////////////////
00086 int Event::
00087 get_num_parameters() const {
00088   return _parameters.size();
00089 }
00090 
00091 ////////////////////////////////////////////////////////////////////
00092 //     Function: Event::get_parameter
00093 //       Access: Public
00094 //  Description:
00095 ////////////////////////////////////////////////////////////////////
00096 EventParameter Event::
00097 get_parameter(int n) const {
00098   nassertr(n >= 0 && n < (int)_parameters.size(), EventParameter(0));
00099   return _parameters[n];
00100 }
00101 
00102 
00103 ////////////////////////////////////////////////////////////////////
00104 //     Function: Event::has_receiver
00105 //       Access: Public
00106 //  Description:
00107 ////////////////////////////////////////////////////////////////////
00108 bool Event::
00109 has_receiver() const {
00110   return _receiver != (EventReceiver *)NULL;
00111 }
00112 
00113 ////////////////////////////////////////////////////////////////////
00114 //     Function: Event::get_receiver
00115 //       Access: Public
00116 //  Description:
00117 ////////////////////////////////////////////////////////////////////
00118 EventReceiver *Event::
00119 get_receiver() const {
00120   return _receiver;
00121 }
00122 
00123 ////////////////////////////////////////////////////////////////////
00124 //     Function: Event::set_receiver
00125 //       Access: Public
00126 //  Description:
00127 ////////////////////////////////////////////////////////////////////
00128 void Event::
00129 set_receiver(EventReceiver *receiver) {
00130   _receiver = receiver;
00131 }
00132 
00133 ////////////////////////////////////////////////////////////////////
00134 //     Function: Event::clear_receiver
00135 //       Access: Public
00136 //  Description:
00137 ////////////////////////////////////////////////////////////////////
00138 void Event::
00139 clear_receiver() {
00140   _receiver = (EventReceiver *)NULL;
00141 }
00142 
00143 ////////////////////////////////////////////////////////////////////
00144 //     Function: Event::output
00145 //       Access: Public
00146 //  Description:
00147 ////////////////////////////////////////////////////////////////////
00148 void Event::
00149 output(ostream &out) const {
00150   out << get_name();
00151 }

Generated on Fri May 2 00:38:13 2003 for Panda by doxygen1.3