DCSwitch

class DCSwitch

Bases: DCDeclaration

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 diagram

Inheritance diagram of DCSwitch

DCPackerInterface *get_case(int n) const

Returns the DCPackerInterface that packs the nth case.

int get_case_by_value(vector_uchar const &case_value) const

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

DCPackerInterface *get_default_case(void) const

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

DCField *get_field(int case_index, int n) const

Returns the nth field in the indicated case.

DCField *get_field_by_name(int case_index, std::string const &name) const

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

DCField *get_key_parameter(void) const

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.

std::string const &get_name(void) const

Returns the name of this switch.

int get_num_cases(void) const

Returns the number of different cases within the switch. The legal values for case_index range from 0 to get_num_cases() - 1.

int get_num_fields(int case_index) const

Returns the number of fields in the indicated case.

vector_uchar get_value(int case_index) const

Returns the packed value associated with the indicated case.