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

This represents a switch statement, which can appear inside a class body and represents two or more alternative unpacking schemes based on the first field read. More...

Inheritance diagram for DCSwitch:
DCDeclaration

Public Member Functions

DCPackerInterface getCase (int n)
 Returns the DCPackerInterface that packs the nth case. More...
 
int getCaseByValue (VectorUchar case_value)
 Returns the index number of the case with the indicated packed value, or -1 if no case has this value. More...
 
DCPackerInterface getDefaultCase ()
 Returns the DCPackerInterface that packs the default case, or NULL if there is no default case. More...
 
DCField getField (int case_index, int n)
 Returns the nth field in the indicated case. More...
 
DCField getFieldByName (int case_index, str name)
 Returns the field with the given name from the indicated case, or NULL if no field has this name. More...
 
DCField getKeyParameter ()
 Returns the key parameter on which the switch is based. More...
 
str getName ()
 Returns the name of this switch. More...
 
int getNumCases ()
 Returns the number of different cases within the switch. More...
 
int getNumFields (int case_index)
 Returns the number of fields in the indicated case. More...
 
VectorUchar getValue (int case_index)
 Returns the packed value associated with the indicated case. More...
 
- Public Member Functions inherited from DCDeclaration
DCClass asClass ()
 
const DCClass asClass ()
 
DCSwitch asSwitch ()
 
const DCSwitch asSwitch ()
 
 output (Ostream out)
 Write a string representation of this instance to <out>. More...
 
 write (Ostream out, int indent_level)
 Write a string representation of this instance to <out>. More...
 

Detailed Description

This represents a switch statement, which can appear inside a class body and represents two or more alternative unpacking schemes based on the first field read.

Member Function Documentation

◆ getCase()

DCPackerInterface getCase ( int  n)

Returns the DCPackerInterface that packs the nth case.

◆ getCaseByValue()

int getCaseByValue ( VectorUchar  case_value)

Returns the index number of the case with the indicated packed value, or -1 if no case has this value.

◆ getDefaultCase()

DCPackerInterface getDefaultCase ( )

Returns the DCPackerInterface that packs the default case, or NULL if there is no default case.

◆ getField()

DCField getField ( int  case_index,
int  n 
)

Returns the nth field in the indicated case.

◆ getFieldByName()

DCField getFieldByName ( int  case_index,
str  name 
)

Returns the field with the given name from the indicated case, or NULL if no field has this name.

◆ getKeyParameter()

DCField getKeyParameter ( )

Returns the key parameter on which the switch is based.

The value of this parameter in the record determines which one of the several cases within the switch will be used.

◆ getName()

str getName ( )

Returns the name of this switch.

◆ getNumCases()

int getNumCases ( )

Returns the number of different cases within the switch.

The legal values for case_index range from 0 to get_num_cases() - 1.

◆ getNumFields()

int getNumFields ( int  case_index)

Returns the number of fields in the indicated case.

◆ getValue()

VectorUchar getValue ( int  case_index)

Returns the packed value associated with the indicated case.