Panda3D
Public Member Functions | List of all members
EventParameter Class Reference

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

#include "eventParameter.h"

Public Member Functions

 EventParameter ()
 Defines an EventParameter that stores nothing: the "empty" parameter. More...
 
 EventParameter (const TypedWritableReferenceCount *ptr)
 Defines an EventParameter that stores a pointer to any kind of TypedWritableReferenceCount object. More...
 
 EventParameter (const TypedReferenceCount *ptr)
 Defines an EventParameter that stores a pointer to a TypedReferenceCount object. More...
 
 EventParameter (int value)
 Defines an EventParameter that stores an integer value. More...
 
 EventParameter (double value)
 Defines an EventParameter that stores a floating-point value. More...
 
 EventParameter (const string &value)
 Defines an EventParameter that stores a string value. More...
 
 EventParameter (const wstring &value)
 Defines an EventParameter that stores a wstring value. More...
 
 EventParameter (const EventParameter &copy)
 
double get_double_value () const
 Retrieves the value stored in the EventParameter. More...
 
int get_int_value () const
 Retrieves the value stored in the EventParameter. More...
 
TypedWritableReferenceCountget_ptr () const
 Retrieves a pointer to the actual value stored in the parameter. More...
 
string get_string_value () const
 Retrieves the value stored in the EventParameter. More...
 
TypedReferenceCountget_typed_ref_count_value () const
 Retrieves the value stored in the EventParameter. More...
 
wstring get_wstring_value () const
 Retrieves the value stored in the EventParameter. More...
 
bool is_double () const
 Returns true if the EventParameter stores a double floating-point value, false otherwise. More...
 
bool is_empty () const
 Returns true if the EventParameter is the empty parameter, storing nothing, or false otherwise. More...
 
bool is_int () const
 Returns true if the EventParameter stores an integer value, false otherwise. More...
 
bool is_string () const
 Returns true if the EventParameter stores a string value, false otherwise. More...
 
bool is_typed_ref_count () const
 Returns true if the EventParameter stores a TypedReferenceCount pointer, false otherwise. More...
 
bool is_wstring () const
 Returns true if the EventParameter stores a wstring value, false otherwise. More...
 
EventParameteroperator= (const EventParameter &copy)
 
void output (ostream &out) const
 

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 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 ParamValue template class from paramValue.h.

Definition at line 38 of file eventParameter.h.

Constructor & Destructor Documentation

◆ EventParameter() [1/7]

EventParameter::EventParameter ( )
inline

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

Definition at line 23 of file eventParameter.I.

Referenced by EventParameter().

◆ EventParameter() [2/7]

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 40 of file eventParameter.I.

References EventParameter().

◆ EventParameter() [3/7]

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 58 of file eventParameter.I.

References EventParameter().

◆ EventParameter() [4/7]

EventParameter::EventParameter ( int  value)
inline

Defines an EventParameter that stores an integer value.

Definition at line 68 of file eventParameter.I.

References EventParameter().

◆ EventParameter() [5/7]

EventParameter::EventParameter ( double  value)
inline

Defines an EventParameter that stores a floating-point value.

Definition at line 78 of file eventParameter.I.

References EventParameter().

◆ EventParameter() [6/7]

EventParameter::EventParameter ( const string &  value)
inline

Defines an EventParameter that stores a string value.

Definition at line 87 of file eventParameter.I.

References EventParameter().

◆ EventParameter() [7/7]

EventParameter::EventParameter ( const wstring &  value)
inline

Defines an EventParameter that stores a wstring value.

Definition at line 95 of file eventParameter.I.

References EventParameter(), and is_empty().

Member Function Documentation

◆ get_double_value()

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 190 of file eventParameter.I.

References is_double(), and is_string().

Referenced by is_double().

◆ get_int_value()

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 160 of file eventParameter.I.

References is_double(), and is_int().

Referenced by is_int().

◆ get_ptr()

TypedWritableReferenceCount * EventParameter::get_ptr ( ) const
inline

◆ get_string_value()

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 217 of file eventParameter.I.

References is_string(), and is_wstring().

Referenced by is_string().

◆ get_typed_ref_count_value()

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 274 of file eventParameter.I.

References get_ptr(), and is_typed_ref_count().

Referenced by is_typed_ref_count().

◆ get_wstring_value()

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 244 of file eventParameter.I.

References is_typed_ref_count(), and is_wstring().

Referenced by is_wstring().

◆ is_double()

bool EventParameter::is_double ( ) const
inline

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

Definition at line 175 of file eventParameter.I.

References get_double_value(), and is_empty().

Referenced by get_double_value(), and get_int_value().

◆ is_empty()

bool EventParameter::is_empty ( ) const
inline

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

Definition at line 134 of file eventParameter.I.

References is_int().

Referenced by EventParameter(), is_double(), is_int(), is_string(), is_typed_ref_count(), is_wstring(), and DataNode::transmit_data().

◆ is_int()

bool EventParameter::is_int ( ) const
inline

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

Definition at line 145 of file eventParameter.I.

References get_int_value(), and is_empty().

Referenced by get_int_value(), and is_empty().

◆ is_string()

bool EventParameter::is_string ( ) const
inline

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

Definition at line 202 of file eventParameter.I.

References get_string_value(), and is_empty().

Referenced by get_double_value(), and get_string_value().

◆ is_typed_ref_count()

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 259 of file eventParameter.I.

References get_typed_ref_count_value(), and is_empty().

Referenced by get_typed_ref_count_value(), and get_wstring_value().

◆ is_wstring()

bool EventParameter::is_wstring ( ) const
inline

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

Definition at line 229 of file eventParameter.I.

References get_wstring_value(), and is_empty().

Referenced by get_string_value(), and get_wstring_value().


The documentation for this class was generated from the following files: