| Trees | Indices | Help | 
 | 
|---|
|  | 
 1  # Copyright 2004-2008 Roman Yakovenko. 
 2  # Distributed under the Boost Software License, Version 1.0. (See 
 3  # accompanying file LICENSE_1_0.txt or copy at 
 4  # http://www.boost.org/LICENSE_1_0.txt) 
 5   
 6  """defines interface for exposing STD containers, using current version of indexing suite""" 
 7   
 8  from pygccxml import declarations 
 9  import python_traits 
10  #NoProxy 
11  #By default indexed elements have Python reference semantics and are returned by 
12  #proxy. This can be disabled by supplying true in the NoProxy template parameter. 
13  #We want to disable NoProxy when we deal with immutable objects. 
14   
15  containers = { 
16      'vector' : "boost/python/suite/indexing/vector_indexing_suite.hpp" 
17      , 'map' : "boost/python/suite/indexing/map_indexing_suite.hpp" 
18  } 
22      """ 
23      This class helps user to export STD containers, using built-in Boost.Python 
24      indexing suite. 
25      """ 
26   
28          object.__init__( self ) 
29          self.__no_proxy = no_proxy 
30          self.__derived_policies = derived_policies 
31          self.__container_class = container_class 
32          self.__include_files = None 
33          self.__element_type = None 
34   
35      @property 
39   
40      @property 
42          """reference to container value_type( mapped_type ) type""" 
43          if self.__element_type is None: 
44              self.__element_type = self.container_class.container_traits.element_type( self.container_class ) 
45          return self.__element_type 
46           
47      @property 
49          "reference to container traits. See pygccxml documentation for more information." 
50          return self.container_class.container_traits 
51       
53          if self.__no_proxy is None: 
54              self.__no_proxy = python_traits.is_immutable( self.element_type ) 
55          return self.__no_proxy 
56   
58          self.__no_proxy = no_proxy 
59      no_proxy = property( _get_no_proxy, _set_no_proxy 
60                           , doc="NoProxy value, the initial value depends on container" 
61                                +" element_type( mapped_type ) type. In most cases, " 
62                                +"Py++ is able to guess this value, right. If you are not " 
63                                +"lucky, you will have to set the property value.") 
64   
68          self.__derived_policies = derived_policies 
69      derived_policies = property( _get_derived_policies, _set_derived_policies 
70                                   , doc="This proprty contains DerivedPolicies string. " 
71                                        +"It will be added as is to the generated code.") 
72   
73      @property 
75          """Return list of header files to be included in generated code""" 
76          if self.__include_files is None: 
77              name = self.container_class.name.split( '<' )[0] 
78              if name not in containers: 
79                  self.__include_files = [] #not supported 
80              else: 
81                  self.__include_files = [containers[ name ]] 
82          return self.__include_files 
83   
| Trees | Indices | Help | 
 | 
|---|
| Generated by Epydoc 3.0.1 on Mon Oct 20 08:51:31 2008 | http://epydoc.sourceforge.net |