Panda3D
|
An optional parameter associated with an event. More...
#include "eventParameter.h"
Public Member Functions | |
EventParameter () | |
Defines an EventParameter that stores nothing: the "empty" parameter. | |
EventParameter (const TypedWritableReferenceCount *ptr) | |
Defines an EventParameter that stores a pointer to any kind of TypedWritableReferenceCount object. | |
EventParameter (const TypedReferenceCount *ptr) | |
Defines an EventParameter that stores a pointer to a 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 wstring &value) | |
Defines an EventParameter that stores a wstring value. | |
EventParameter (const EventParameter ©) | |
double | get_double_value () const |
Retrieves the value stored in the EventParameter. | |
int | get_int_value () const |
Retrieves the value stored in the EventParameter. | |
TypedWritableReferenceCount * | get_ptr () const |
Retrieves a pointer to the actual value stored in the parameter. | |
string | get_string_value () const |
Retrieves the value stored in the EventParameter. | |
TypedReferenceCount * | get_typed_ref_count_value () const |
Retrieves the value stored in the EventParameter. | |
wstring | get_wstring_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. | |
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. | |
bool | is_string () const |
Returns true if the EventParameter stores a string value, false otherwise. | |
bool | is_typed_ref_count () const |
Returns true if the EventParameter stores a TypedReferenceCount pointer, false otherwise. | |
bool | is_wstring () const |
Returns true if the EventParameter stores a wstring value, false otherwise. | |
EventParameter & | operator= (const EventParameter ©) |
void | output (ostream &out) const |
An optional parameter associated with an event.
Each event may have zero or more of these. Each parameter stores a pointer to a TypedWritableReferenceCount 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 38 of file eventParameter.h.
EventParameter::EventParameter | ( | ) | [inline] |
Defines an EventParameter that stores nothing: the "empty" parameter.
Definition at line 27 of file eventParameter.I.
EventParameter::EventParameter | ( | const TypedWritableReferenceCount * | ptr | ) | [inline] |
Defines an EventParameter that stores a pointer to any kind of TypedWritableReferenceCount 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 44 of file eventParameter.I.
EventParameter::EventParameter | ( | const TypedReferenceCount * | ptr | ) | [inline] |
Defines an EventParameter that stores a pointer to a TypedReferenceCount object.
Note that a TypedReferenceCount is not the same kind of pointer as a TypedWritableReferenceCount, hence we require both constructors.
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 62 of file eventParameter.I.
EventParameter::EventParameter | ( | int | value | ) | [inline] |
Defines an EventParameter that stores an integer value.
Definition at line 72 of file eventParameter.I.
EventParameter::EventParameter | ( | double | value | ) | [inline] |
Defines an EventParameter that stores a floating-point value.
Definition at line 82 of file eventParameter.I.
EventParameter::EventParameter | ( | const string & | value | ) | [inline] |
Defines an EventParameter that stores a string value.
Definition at line 91 of file eventParameter.I.
EventParameter::EventParameter | ( | const wstring & | value | ) | [inline] |
Defines an EventParameter that stores a wstring value.
Definition at line 99 of file eventParameter.I.
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 194 of file eventParameter.I.
References is_double().
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 164 of file eventParameter.I.
References is_int().
TypedWritableReferenceCount * 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 293 of file eventParameter.I.
Referenced by MouseInterfaceNode::check_button_events(), AwMouseAndKeyboard::do_transmit_data(), Transform2SG::do_transmit_data(), RocketInputHandler::do_transmit_data(), MouseSubregion::do_transmit_data(), MouseRecorder::do_transmit_data(), ButtonThrower::do_transmit_data(), Trackball::do_transmit_data(), DriveInterface::do_transmit_data(), MouseWatcher::do_transmit_data(), PandaFramework::event_a(), PandaFramework::event_b(), PandaFramework::event_c(), PandaFramework::event_comma(), PandaFramework::event_esc(), PandaFramework::event_f9(), PandaFramework::event_i(), PandaFramework::event_l(), PandaFramework::event_p(), PandaFramework::event_question(), PandaFramework::event_t(), PandaFramework::event_w(), PandaFramework::event_window_event(), and DataNodeTransmit::write_datagram().
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 221 of file eventParameter.I.
References is_string().
TypedReferenceCount * EventParameter::get_typed_ref_count_value | ( | ) | const [inline] |
Retrieves the value stored in the EventParameter.
It is only valid to call this if is_typed_ref_count() has already returned true.
Definition at line 278 of file eventParameter.I.
References is_typed_ref_count().
wstring EventParameter::get_wstring_value | ( | ) | const [inline] |
Retrieves the value stored in the EventParameter.
It is only valid to call this if is_wstring() has already returned true.
Definition at line 248 of file eventParameter.I.
References is_wstring().
bool EventParameter::is_double | ( | ) | const [inline] |
Returns true if the EventParameter stores a double floating-point value, false otherwise.
Definition at line 179 of file eventParameter.I.
References is_empty().
Referenced by get_double_value().
bool EventParameter::is_empty | ( | ) | const [inline] |
Returns true if the EventParameter is the empty parameter, storing nothing, or false otherwise.
Definition at line 138 of file eventParameter.I.
Referenced by is_double(), is_int(), is_string(), is_typed_ref_count(), is_wstring(), and DataNode::transmit_data().
bool EventParameter::is_int | ( | ) | const [inline] |
Returns true if the EventParameter stores an integer value, false otherwise.
Definition at line 149 of file eventParameter.I.
References is_empty().
Referenced by get_int_value().
bool EventParameter::is_string | ( | ) | const [inline] |
Returns true if the EventParameter stores a string value, false otherwise.
Definition at line 206 of file eventParameter.I.
References is_empty().
Referenced by get_string_value().
bool EventParameter::is_typed_ref_count | ( | ) | const [inline] |
Returns true if the EventParameter stores a TypedReferenceCount pointer, false otherwise.
Note that a TypedReferenceCount is not exactly the same kind of pointer as a TypedWritableReferenceCount, hence the need for this separate call.
Definition at line 263 of file eventParameter.I.
References is_empty().
Referenced by get_typed_ref_count_value().
bool EventParameter::is_wstring | ( | ) | const [inline] |
Returns true if the EventParameter stores a wstring value, false otherwise.
Definition at line 233 of file eventParameter.I.
References is_empty().
Referenced by get_wstring_value().