# DCSwitch

from pandac.PandaModules import DCSwitch

Class : DCSwitch
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.

## Inheritance:

DCSwitch: DCDeclaration
DCDeclaration:

## Methods of DCSwitch:

getCase
getCaseByValue
getDefaultCase
getField
getFieldByName
getKeyParameter
getName
getNumCases
getNumFields
getValue

## Methods of DCDeclaration:

asClass
asSwitch
output
write

getCase DCPackerInterface *DCSwitch::get_case(int n) const; Description: Returns the DCPackerInterface that packs the nth case.

getCaseByValue int DCSwitch::get_case_by_value(string const &case_value) const; Description: Returns the index number of the case with the indicated packed value, or -1 if no case has this value.

getDefaultCase DCPackerInterface *DCSwitch::get_default_case(void) const; Description: Returns the DCPackerInterface that packs the default case, or NULL if there is no default case.

getField DCField *DCSwitch::get_field(int case_index, int n) const; Description: Returns the nth field in the indicated case.

getFieldByName DCField *DCSwitch::get_field_by_name(int case_index, string const &name) const; Description: Returns the field with the given name from the indicated case, or NULL if no field has this name.

getKeyParameter DCField *DCSwitch::get_key_parameter(void) const; Description: 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 string const &DCSwitch::get_name(void) const; Description: Returns the name of this switch.

getNumCases int DCSwitch::get_num_cases(void) const; Description: 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 DCSwitch::get_num_fields(int case_index) const; Description: Returns the number of fields in the indicated case.

getValue string DCSwitch::get_value(int case_index) const; Description: Returns the packed value associated with the indicated case.

asClass virtual DCClass *DCDeclaration::as_class(void); Description:

asSwitch virtual DCSwitch *DCDeclaration::as_switch(void); Description:

output virtual void DCDeclaration::output(ostream &out) const; Description : Write a string representation of this instance to <out>.

write void DCDeclaration::write(ostream &out, int indent_level) const; Description : Write a string representation of this instance to <out>.