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

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

Public Member Functions

 __init__ ()
 
 __init__ (const EventParameter copy)
 
 __init__ (const TypedReferenceCount ptr)
 Defines an EventParameter that stores a pointer to a TypedReferenceCount object. More...
 
 __init__ (const TypedWritableReferenceCount ptr)
 Defines an EventParameter that stores a pointer to any kind of TypedWritableReferenceCount object. More...
 
 __init__ (double value)
 Defines an EventParameter that stores a floating-point value. More...
 
 __init__ (int value)
 Defines an EventParameter that stores an integer value. More...
 
 __init__ (nullptr_t)
 
 __init__ (str value)
 Defines an EventParameter that stores a string value. More...
 
 __init__ (str value)
 Defines an EventParameter that stores a wstring value. More...
 
double getDoubleValue ()
 Retrieves the value stored in the EventParameter. More...
 
int getIntValue ()
 Retrieves the value stored in the EventParameter. More...
 
TypedWritableReferenceCount getPtr ()
 Retrieves a pointer to the actual value stored in the parameter. More...
 
str getStringValue ()
 Retrieves the value stored in the EventParameter. More...
 
TypedReferenceCount getTypedRefCountValue ()
 Retrieves the value stored in the EventParameter. More...
 
str getWstringValue ()
 Retrieves the value stored in the EventParameter. More...
 
bool isDouble ()
 Returns true if the EventParameter stores a double floating-point value, false otherwise. More...
 
bool isEmpty ()
 
bool isInt ()
 Returns true if the EventParameter stores an integer value, false otherwise. More...
 
bool isString ()
 Returns true if the EventParameter stores a string value, false otherwise. More...
 
bool isTypedRefCount ()
 Returns true if the EventParameter stores a TypedReferenceCount pointer, false otherwise. More...
 
bool isWstring ()
 Returns true if the EventParameter stores a wstring value, false otherwise. More...
 
EventParameter operator= (const EventParameter copy)
 
 output (Ostream out)
 

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.

Member Function Documentation

◆ __init__() [1/9]

__init__ ( )

◆ __init__() [2/9]

__init__ ( const EventParameter  copy)

◆ __init__() [3/9]

__init__ ( const TypedReferenceCount  ptr)

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.

◆ __init__() [4/9]

__init__ ( const TypedWritableReferenceCount  ptr)

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.

◆ __init__() [5/9]

__init__ ( double  value)

Defines an EventParameter that stores a floating-point value.

◆ __init__() [6/9]

__init__ ( int  value)

Defines an EventParameter that stores an integer value.

◆ __init__() [7/9]

__init__ ( nullptr_t  )

◆ __init__() [8/9]

__init__ ( str  value)

Defines an EventParameter that stores a string value.

◆ __init__() [9/9]

__init__ ( str  value)

Defines an EventParameter that stores a wstring value.

◆ getDoubleValue()

double getDoubleValue ( )

Retrieves the value stored in the EventParameter.

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

◆ getIntValue()

int getIntValue ( )

Retrieves the value stored in the EventParameter.

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

◆ getPtr()

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.

◆ getStringValue()

str getStringValue ( )

Retrieves the value stored in the EventParameter.

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

◆ getTypedRefCountValue()

TypedReferenceCount getTypedRefCountValue ( )

Retrieves the value stored in the EventParameter.

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

◆ getWstringValue()

str getWstringValue ( )

Retrieves the value stored in the EventParameter.

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

◆ isDouble()

bool isDouble ( )

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

◆ isEmpty()

bool isEmpty ( )

◆ isInt()

bool isInt ( )

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

◆ isString()

bool isString ( )

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

◆ isTypedRefCount()

bool isTypedRefCount ( )

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.

◆ isWstring()

bool isWstring ( )

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

◆ operator=()

EventParameter operator= ( const EventParameter  copy)

◆ output()

output ( Ostream  out)