PyNTuple.cxx
Go to the documentation of this file.
1 
16 #include "PyNTuple.h"
17 
18 #include "PyApp.h"
19 
20 #include <stdexcept>
21 
22 using std::runtime_error;
23 using std::string;
24 using std::vector;
25 
26 using namespace hippodraw;
27 
28 
30 PyNTuple ( const std::vector < std::string > & labels )
31  : NTuple ( labels )
32 {
33  // nothing else to be done.
34 }
35 
37 PyNTuple ( unsigned int n )
38  : NTuple ( n )
39 {
40  // nothing else to be done
41 }
42 
44 PyNTuple ( const PyNTuple & nt )
45  : NTuple ( nt )
46 {
47  // nothing else to be done
48 }
49 
51 PyNTuple ( const NTuple & nt )
52  : NTuple ( nt )
53 {
54  // nothing else to be done
55 }
56 
59  : NTuple ( )
60 {
61 }
62 
63 void
65 setTitle ( const std::string & title )
66 {
67  PyApp::lock ();
68  DataSource::setTitle ( title );
69  PyApp::unlock ();
70 }
71 
72 int
74 addColumn ( const std::string & label,
75  const std::vector < double > & column )
76 {
77  PyApp::lock ();
78  int index = -1;
79  try {
80  index = NTuple::addColumn ( label, column );
81  }
82  catch ( const runtime_error & e ) {
83  PyApp::unlock ();
84  throw e;
85  }
86  PyApp::unlock ();
87 
88  return index;
89 }
90 
91 void
93 replaceColumn ( unsigned int i, const std::vector < double > & column )
94 {
95  PyApp::lock ();
96  try {
97  NTuple::replaceColumn ( i, column );
98  }
99  catch ( const runtime_error & e ) {
100  PyApp::unlock ();
101  throw e;
102  }
103  PyApp::unlock ();
104 }
105 
106 void
108 replaceColumn ( const std::string & label,
109  const std::vector < double > & column )
110 {
111  PyApp::lock ();
112  try {
113  DataSource::replaceColumn ( label, column );
114  }
115  catch ( const runtime_error & e ) {
116  PyApp::unlock ();
117  throw e;
118  }
119  PyApp::unlock ();
120 }
121 
122 void
124 addRow ( const std::vector < double > & row )
125 {
126  // at some point we needed this lock, but after to code was fixed so
127  // PyCanvas checks for pending events this lock causes
128  // run_test_scripts to hang when running with no pompt.
129 
130  PyApp::lock ();
131 
132  try {
133  NTuple::addRow ( row );
134  }
135  catch ( const runtime_error & e ) {
136  PyApp::unlock ();
137  throw e;
138  }
139 
140  PyApp::unlock ();
141 }
142 
143 void
146 {
147  PyApp::lock ();
148  NTuple::clear ();
149  PyApp::unlock ();
150 }
151 
152 void
154 append ( const DataSource * source )
155 {
156  PyApp::lock ();
157  NTuple::append ( source );
158  PyApp::unlock ();
159 }

Generated for HippoDraw Class Library by doxygen