LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
test13.cc File Reference
#include <iostream>
#include <boost/python.hpp>

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

int* alloc_int ( )

Definition at line 35 of file test13.cc.

Referenced by f_alloc_int().

36 {
37  int* intlist= new int [10];
38  for (int i=0; i<10; i++) intlist[i]= 0;
39 
40  return intlist;
41 }
BOOST_PYTHON_MODULE ( test13  )

Definition at line 85 of file test13.cc.

References f_alloc_int(), and f_operate_list().

86 {
87  def("alloc_int", f_alloc_int);
88  def("operate_list", f_operate_list);
89 }
void f_operate_list(list &alist)
Definition: test13.cc:69
list f_alloc_int()
Definition: test13.cc:58
list f_alloc_int ( )

Definition at line 58 of file test13.cc.

References alloc_int(), n, and x.

Referenced by BOOST_PYTHON_MODULE().

59 {
60  int* aaa= alloc_int();
61  int n= 10;
62  list x;
63  for(int i=0; i<n; i++) {
64  x.append(aaa[i]);
65  }
66  return x;
67 }
Float_t x
Definition: compare.C:6
int * alloc_int()
Definition: test13.cc:35
Char_t n[5]
void f_operate_list ( list &  alist)

Definition at line 69 of file test13.cc.

References operate_list().

Referenced by BOOST_PYTHON_MODULE().

70 {
71  int* intlist= new int [10];
72  for (int i=0; i<10; i++) {
73  intlist[i]= extract<int>(alist[i]);
74  }
75 
76  operate_list(intlist);
77 
78  for (int i=0; i<10; i++) {
79  alist[i]= intlist[i];
80  }
81 
82  delete intlist;
83 }
void operate_list(int vec[10])
Definition: test13.cc:44
void operate_list ( int  vec[10])

Definition at line 44 of file test13.cc.

Referenced by f_operate_list().

45 {
46  for(int i=0; i<10; i++) {
47  std::cout << vec[i] << std::endl;
48  vec[i]++;
49  }
50 }