Cstruct

Inheritance diagram of ccg.types.Cstruct.CStruct
class ccg.types.Cstruct.CStruct(struct_def)

Bases: ccg.types.Ctypes.CGenericType, ccg.types.Ctypes.CItemDefinable

Struct without inplace definition.

Assumes struct already is declared

Parameters

struct_def (CStructDef) –

definition(style=<ccg.style.Style object>, from_space=None, doc=False)
Parameters
  • style (Style) –

  • from_space (CSpace) –

  • doc (bool) –

Return type

str

style_checks(style)
Parameters

style (Style) –

Return type

None

property bit_size: int
check_value(value)

Checks that a value is correct for the type

Parameters

value (Any) – value to check

Returns

boolean indicating if value fits type (True) or not

Return type

bool

declaration(style=<ccg.style.Style object>, semicolon=True, doc=True, from_space=None, without_arguments=False, for_variable=False)

Type declaration

Parameters
  • style (Style) – generating style

  • semicolon (bool) – include semicolon in declaration

  • doc (bool) – include documentation

  • from_space (CSpace) – relative to space

  • without_arguments (bool) – include arguments if any

  • for_variable (bool) – if the declaration is for a variable

Return type

str

Returns:

declare(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

ccg.statements.Cstatement.CDeclaration

define(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

ccg.statements.Cstatement.CDeclaration

doc_render(style)
Parameters

style (Style) –

Return type

str

property full_space_list: List[ccg.Cnamespace.CSpace]
space_def(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

str

type(name)

Create a copy of the type with a new name

Parameters

name (str) –

Return type

ccg.types.Ctypes.CGenericType

typedef(doc=None)
Parameters

doc (Optional[Doc]) –

Return type

ccg.statements.Cstatement.CStatement

typedef_render(style=<ccg.style.Style object>, from_space=None, doc=None)
Parameters
Return type

str

Inheritance diagram of ccg.types.Cstruct.CStructDef
class ccg.types.Cstruct.CStructDef(name=None, is_packed=False, members=None, doc=None)

Bases: ccg.types.Ctypes.CGenericType, ccg.types.Ctypes.CItemDefinable

Struct with inplace definition

Parameters
Member

alias of ccg.types.Cstruct.CStructDefMember

style_checks(style)
Parameters

style (Style) –

Return type

None

property struct: ccg.types.Cstruct.CStruct

Same struct without inplace definition

definition(style=<ccg.style.Style object>, from_space=None, doc=False)
Parameters
  • style (Style) –

  • from_space (CSpace) –

  • doc (bool) –

Return type

str

check_value(value)

Checks that a value is correct for the type

Parameters

value (Any) – value to check

Returns

boolean indicating if value fits type (True) or not

Return type

bool

declaration(style=<ccg.style.Style object>, semicolon=True, doc=True, from_space=None, without_arguments=False, for_variable=False)

Type declaration

Parameters
  • style (Style) – generating style

  • semicolon (bool) – include semicolon in declaration

  • doc (bool) – include documentation

  • from_space (CSpace) – relative to space

  • without_arguments (bool) – include arguments if any

  • for_variable (bool) – if the declaration is for a variable

Return type

str

Returns:

declare(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

ccg.statements.Cstatement.CDeclaration

define(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

ccg.statements.Cstatement.CDeclaration

doc_render(style)
Parameters

style (Style) –

Return type

str

property full_space_list: List[ccg.Cnamespace.CSpace]
space_def(from_space=None)
Parameters

from_space (Optional[ccg.Cnamespace.CSpace]) –

Return type

str

type(name)

Create a copy of the type with a new name

Parameters

name (str) –

Return type

ccg.types.Ctypes.CGenericType

typedef(doc=None)
Parameters

doc (Optional[Doc]) –

Return type

ccg.statements.Cstatement.CStatement

typedef_render(style=<ccg.style.Style object>, from_space=None, doc=None)
Parameters
Return type

str

property bit_size: int
Inheritance diagram of ccg.types.Cstruct.CStructDefMember
class ccg.types.Cstruct.CStructDefMember(variable, bitfield=None, doc=None)

Bases: object

Member of struct definition

Parameters
  • variable (CVariable) –

  • bitfield (Optional[int]) –

  • doc (Optional[Doc]) –

declaration(style=<ccg.style.Style object>)

Member declaration

Parameters

style (Style) –

Return type

str

property bit_size: int