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

EventParameter Class Reference

An optional parameter associated with an event. More...

#include <eventParameter.h>

List of all members.

Public Member Functions

 EventParameter ()
 Defines an EventParameter that stores nothing: the "empty" parameter.

 EventParameter (const TypedReferenceCount *ptr)
 Defines an EventParameter that stores a pointer to any kind of TypedReferenceCount object.

 EventParameter (int value)
 Defines an EventParameter that stores an integer value.

 EventParameter (double value)
 Defines an EventParameter that stores a floating-point value.

 EventParameter (const string &value)
 Defines an EventParameter that stores a string value.

 EventParameter (const EventParameter &copy)
EventParameter & operator= (const EventParameter &copy)
bool is_empty () const
 Returns true if the EventParameter is the empty parameter, storing nothing, or false otherwise.

bool is_int () const
 Returns true if the EventParameter stores an integer value, false otherwise.

int get_int_value () const
 Retrieves the value stored in the EventParameter.

bool is_double () const
 Returns true if the EventParameter stores a double floating-point value, false otherwise.

double get_double_value () const
 Retrieves the value stored in the EventParameter.

bool is_string () const
 Returns true if the EventParameter stores a string value, false otherwise.

string get_string_value () const
 Retrieves the value stored in the EventParameter.

TypedReferenceCountget_ptr () const
 Retrieves a pointer to the actual value stored in the parameter.

void output (ostream &out) const

Private Attributes

PointerTo< TypedReferenceCount_ptr


Detailed Description

An optional parameter associated with an event.

Each event may have zero or more of these. Each parameter stores a pointer to a TypedReferenceCount object, which of course could be pretty much anything. To store a simple value like a double or a string, the EventParameter constructors transparently use the EventStoreValue template class, defined below.

Definition at line 51 of file eventParameter.h.


Constructor & Destructor Documentation

EventParameter::EventParameter  )  [inline]
 

Defines an EventParameter that stores nothing: the "empty" parameter.

Definition at line 38 of file eventParameter.I.

References INLINE.

EventParameter::EventParameter const TypedReferenceCount ptr  )  [inline]
 

Defines an EventParameter that stores a pointer to any kind of TypedReferenceCount object.

This is the most general constructor.

This accepts a const pointer, even though it stores (and eventually returns) a non-const pointer. This is just the simplest way to allow both const and non-const pointers to be stored, but it does lose the constness. Be careful.

Definition at line 66 of file eventParameter.I.

References INLINE.

EventParameter::EventParameter int  value  )  [inline]
 

Defines an EventParameter that stores an integer value.

Definition at line 80 of file eventParameter.I.

References INLINE.

EventParameter::EventParameter double  value  )  [inline]
 

Defines an EventParameter that stores a floating-point value.

Definition at line 94 of file eventParameter.I.

References _ptr, and INLINE.

EventParameter::EventParameter const string &  value  )  [inline]
 

Defines an EventParameter that stores a string value.

Definition at line 106 of file eventParameter.I.

References _ptr, INLINE, and NULL.

EventParameter::EventParameter const EventParameter &  copy  )  [inline]
 

Definition at line 117 of file eventParameter.I.

References _ptr, INLINE, and is_empty().


Member Function Documentation

double EventParameter::get_double_value  )  const [inline]
 

Retrieves the value stored in the EventParameter.

It is only valid to call this if is_double() has already returned true.

Definition at line 218 of file eventParameter.I.

References INLINE.

int EventParameter::get_int_value  )  const [inline]
 

Retrieves the value stored in the EventParameter.

It is only valid to call this if is_int() has already returned true.

Definition at line 179 of file eventParameter.I.

References _ptr.

TypedReferenceCount * EventParameter::get_ptr  )  const [inline]
 

Retrieves a pointer to the actual value stored in the parameter.

The TypeHandle of this pointer may be examined to determine the actual type of parameter it contains. This is the only way to retrieve the value when it is not one of the above predefined types.

Definition at line 276 of file eventParameter.I.

Referenced by Trackball::apply(), PandaFramework::clear_highlight(), PandaFramework::do_enable_default_keys(), MouseWatcher::global_keyboard_press(), ButtonThrower::has_throw_button(), PandaFramework::main_loop(), PandaFramework::make_default_pipe(), PandaFramework::make_window_framework(), and Transform2SG::set_velocity_node().

string EventParameter::get_string_value  )  const [inline]
 

Retrieves the value stored in the EventParameter.

It is only valid to call this if is_string() has already returned true.

Definition at line 254 of file eventParameter.I.

bool EventParameter::is_double  )  const [inline]
 

Returns true if the EventParameter stores a double floating-point value, false otherwise.

Definition at line 198 of file eventParameter.I.

References _ptr, and INLINE.

Referenced by is_int().

bool EventParameter::is_empty  )  const [inline]
 

Returns true if the EventParameter is the empty parameter, storing nothing, or false otherwise.

Definition at line 144 of file eventParameter.I.

References _ptr, and INLINE.

Referenced by EventParameter().

bool EventParameter::is_int  )  const [inline]
 

Returns true if the EventParameter stores an integer value, false otherwise.

Definition at line 159 of file eventParameter.I.

References _ptr, INLINE, is_double(), nassertr, and PointerTo< TypedReferenceCount >::p().

Referenced by operator=().

bool EventParameter::is_string  )  const [inline]
 

Returns true if the EventParameter stores a string value, false otherwise.

Definition at line 234 of file eventParameter.I.

References INLINE.

EventParameter & EventParameter::operator= const EventParameter &  copy  )  [inline]
 

Definition at line 128 of file eventParameter.I.

References _ptr, INLINE, is_int(), nassertr, and PointerTo< TypedReferenceCount >::p().

void EventParameter::output ostream &  out  )  const
 

Definition at line 41 of file eventParameter.cxx.


Member Data Documentation

PointerTo< TypedReferenceCount > EventParameter::_ptr [private]
 

Definition at line 80 of file eventParameter.h.

Referenced by EventParameter(), get_int_value(), is_double(), is_empty(), is_int(), and operator=().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:50:34 2003 for Panda by doxygen1.3