Package pyplusplus :: Package decl_wrappers :: Module variable_wrapper :: Class variable_t |

# type variable_t

source code

                                             object --+
                                                      |
                            decl_wrapper.decl_wrapper_t --+
                                                          |
                                         object --+       |
                                                  |       |
    pygccxml.declarations.declaration.declaration_t --+   |
                                                      |   |
              pygccxml.declarations.variable.variable_t --+
                                                          |
                                                         variable_t

defines a set of properties, that will instruct Py++ how to expose the variable

Instance Methods
__init__(self, *arguments, **keywords) creates class that describes C++ global or member variable | source code
get_getter_call_policies(self) | source code
set_getter_call_policies(self, call_policies) | source code
get_setter_call_policies(self) | source code
set_setter_call_policies(self, call_policies) | source code
get_apply_smart_ptr_wa(self) | source code
set_apply_smart_ptr_wa(self, value) | source code
get_use_make_functions(self) | source code
set_use_make_functions(self, value) | source code
get_expose_address(self) | source code
set_expose_address(self, value) | source code
get_expose_value(self) | source code
set_expose_value(self, value) | source code
get_is_read_only(self) | source code
set_is_read_only(self, v) | source code
is_wrapper_needed(self) returns an explanation( list of str ) why wrapper is needed. | source code
Inherited from `decl_wrapper.decl_wrapper_t`: `disable_messages`, `disable_warnings`, `exclude`, `get_already_exposed`, `get_exportable`, `include`, `readme`, `rename`, `set_already_exposed`, `set_exportable`, `why_not_exportable` Inherited from `pygccxml.declarations.variable.variable_t`: `__eq__`, `i_depend_on_them` Inherited from `pygccxml.declarations.declaration.declaration_t`: `__lt__`, `__ne__`, `__str__`, `create_decl_string`

Class Variables
| __call_policies_doc__ = ``'``There are usecase, when exporting mem``...``
| __use_make_functions_doc__ = ``'``Generate code using make_getter` `...``
| __expose_address_doc__ = ``'``There are some cases when Boost.Pyth``...``
| __expose_value_doc__ = ``'``Boost.Python is not able to expose uni``...``
Inherited from `decl_wrapper.decl_wrapper_t`: `SPECIAL_TYPEDEF_PICK_ANY`

Properties
| getter_call_policies There are usecase, when exporting member variable forces Py++ to create accessors functions.
| setter_call_policies There are usecase, when exporting member variable forces Py++ to create accessors functions.
| apply_smart_ptr_wa Generate code using make_getter and make_setter functions
| use_make_functions Generate code using make_getter and make_setter functions
| expose_address There are some cases when Boost.Python doesn't provide a convenient way to expose the variable to Python.
| expose_value Boost.Python is not able to expose unions.
| is_read_only
Inherited from `decl_wrapper.decl_wrapper_t`: `alias`, `already_exposed`, `disabled_messages`, `documentation`, `exportable`, `ignore`, `include_files`, `logger` Inherited from `pygccxml.declarations.variable.variable_t`: `access_type`, `bits`, `byte_offset`, `type`, `type_qualifiers`, `value` Inherited from `pygccxml.declarations.declaration.declaration_t`: `attributes`, `cache`, `compiler`, `decl_string`, `demangled`, `is_artificial`, `location`, `mangled`, `name`, `parent`, `partial_decl_string`, `partial_name`, `top_parent`

Method Details

### __init__(self, *arguments, **keywords) (Constructor) | source code
creates class that describes C++ global or member variable Overrides: pygccxml.declarations.declaration.declaration_t.__init__

### is_wrapper_needed(self) | source code
returns an explanation( list of str ) why wrapper is needed. If wrapper is not needed than [] will be returned.

Class Variable Details

  ### __call_policies_doc__ Value:
      '''There are usecase, when exporting member variable forces Py++ to
          create accessors functions. Sometime, those functions requires cal
      l policies.
          To be more specific: when you export member variable that has refe
      rence or
          pointer type, you need to tell Boost.Python library how to manage
      object
          life-time. In all cases, Py++ will give reasonable default value.
      ...

  ### __use_make_functions_doc__ Value:
      '''Generate code using make_getter and make_setter functions

          Basically you don\'t need to use this, untill you have one of the
      next use-cases:
          * member variable is smart pointer - in this case Boost.Python has
       small problem
            to expose it right. Using the functions is a work around to the
      problem.
      ...

  ### __expose_address_doc__ Value:
      '''There are some cases when Boost.Python doesn\'t provide a convenien
      t way
          to expose the variable to Python. For example:

          double* x[10];
          //or
          char* buffer; //in case you want to modify the buffer in place

      ...

  ### __expose_value_doc__ Value:
      '''Boost.Python is not able to expose unions. Using ctypes module
          it is possible to get access to the data stored in a variable, whi
      ch
          has some union type.

          This property controls whether Py++ should expose the variable val
      ue
          or not. In case, this variable has type union, this property will
      ...

Property Details

### getter_call_policies There are usecase, when exporting member variable forces Py++ to create accessors functions. Sometime, those functions requires call policies. To be more specific: when you export member variable that has reference or pointer type, you need to tell Boost.Python library how to manage object life-time. In all cases, Py++ will give reasonable default value. I am sure, that there are use cases, when you will have to change it. You should use this property to change it. Get Method: get_getter_call_policies(self) Set Method: set_getter_call_policies(self, call_policies)

### setter_call_policies There are usecase, when exporting member variable forces Py++ to create accessors functions. Sometime, those functions requires call policies. To be more specific: when you export member variable that has reference or pointer type, you need to tell Boost.Python library how to manage object life-time. In all cases, Py++ will give reasonable default value. I am sure, that there are use cases, when you will have to change it. You should use this property to change it. Get Method: get_setter_call_policies(self) Set Method: set_setter_call_policies(self, call_policies)

### apply_smart_ptr_wa
    Generate code using make_getter and make_setter functions

    Basically you don't need to use this, untill you have one of the next use-cases:
    * member variable is smart pointer - in this case Boost.Python has small problem
      to expose it right. Using the functions is a work around to the problem.
    * member variable defined custom r-value converter - may be you don't know
      but the conversion is applied only on functions arguments. So you need to
      use make_getter/make_setter in order to allow user to enjoy from the
      conversion.

    Setting "apply_smart_ptr_wa" and/or "use_make_functions" to "True" will tell
    Py++ to generate such code.
Get Method: get_apply_smart_ptr_wa(self) Set Method: set_apply_smart_ptr_wa(self, value)

### use_make_functions
    Generate code using make_getter and make_setter functions

    Basically you don't need to use this, untill you have one of the next use-cases:
    * member variable is smart pointer - in this case Boost.Python has small problem
      to expose it right. Using the functions is a work around to the problem.
    * member variable defined custom r-value converter - may be you don't know
      but the conversion is applied only on functions arguments. So you need to
      use make_getter/make_setter in order to allow user to enjoy from the
      conversion.

    Setting "apply_smart_ptr_wa" and/or "use_make_functions" to "True" will tell
    Py++ to generate such code.
Get Method: get_use_make_functions(self) Set Method: set_use_make_functions(self, value)

### expose_address There are some cases when Boost.Python doesn't provide a convenient way to expose the variable to Python. For example: double* x[10]; //or char* buffer; //in case you want to modify the buffer in place In this cases Py++ doesn't help too. In these cases it is possible to expose the actual address of the variable. After that, you can use built-in "ctypes" package to edit the content of the variable. Get Method: get_expose_address(self) Set Method: set_expose_address(self, value)

### expose_value Boost.Python is not able to expose unions. Using ctypes module it is possible to get access to the data stored in a variable, which has some union type. This property controls whether Py++ should expose the variable value or not. In case, this variable has type union, this property will be False. Get Method: get_expose_value(self) Set Method: set_expose_value(self, value)

### is_read_only Get Method: get_is_read_only(self) Set Method: set_is_read_only(self, v)