Geant4  10.02.p03
test13.cc File Reference
#include <iostream>
#include <boost/python.hpp>
Include dependency graph for test13.cc:

Go to the source code of this file.

Functions

int * alloc_int ()
 
void operate_list (int vec[10])
 
list f_alloc_int ()
 
void f_operate_list (list &alist)
 
 BOOST_PYTHON_MODULE (test13)
 

Function Documentation

◆ alloc_int()

int* alloc_int ( )

Definition at line 36 of file test13.cc.

37 {
38  int* intlist= new int [10];
39  for (int i=0; i<10; i++) intlist[i]= 0;
40 
41  return intlist;
42 }
Here is the caller graph for this function:

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( test13  )

Definition at line 86 of file test13.cc.

87 {
88  def("alloc_int", f_alloc_int);
89  def("operate_list", f_operate_list);
90 }
void f_operate_list(list &alist)
Definition: test13.cc:70
list f_alloc_int()
Definition: test13.cc:59
Here is the call graph for this function:

◆ f_alloc_int()

list f_alloc_int ( )

Definition at line 59 of file test13.cc.

60 {
61  int* aaa= alloc_int();
62  int n= 10;
63  list x;
64  for(int i=0; i<n; i++) {
65  x.append(aaa[i]);
66  }
67  return x;
68 }
Char_t n[5]
int * alloc_int()
Definition: test13.cc:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_operate_list()

void f_operate_list ( list &  alist)

Definition at line 70 of file test13.cc.

71 {
72  int* intlist= new int [10];
73  for (int i=0; i<10; i++) {
74  intlist[i]= extract<int>(alist[i]);
75  }
76 
77  operate_list(intlist);
78 
79  for (int i=0; i<10; i++) {
80  alist[i]= intlist[i];
81  }
82 
83  delete intlist;
84 }
void operate_list(int vec[10])
Definition: test13.cc:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operate_list()

void operate_list ( int  vec[10])

Definition at line 45 of file test13.cc.

46 {
47  for(int i=0; i<10; i++) {
48  std::cout << vec[i] << std::endl;
49  vec[i]++;
50  }
51 }
Here is the caller graph for this function: