LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 36 of file test13.cc.

Referenced by f_alloc_int().

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

Definition at line 86 of file test13.cc.

References f_alloc_int(), and f_operate_list().

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
list f_alloc_int ( )

Definition at line 59 of file test13.cc.

References alloc_int(), n, and x.

Referenced by BOOST_PYTHON_MODULE().

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 }
Float_t x
Definition: compare.C:6
int * alloc_int()
Definition: test13.cc:36
Char_t n[5]
void f_operate_list ( list &  alist)

Definition at line 70 of file test13.cc.

References operate_list().

Referenced by BOOST_PYTHON_MODULE().

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
void operate_list ( int  vec[10])

Definition at line 45 of file test13.cc.

Referenced by f_operate_list().

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