PyNTuple.cxx

Go to the documentation of this file.
00001 
00016 #include "PyNTuple.h"
00017 
00018 #include "PyApp.h"
00019 
00020 #include <stdexcept>
00021 
00022 using std::runtime_error;
00023 using std::string;
00024 using std::vector;
00025 
00026 using namespace hippodraw;
00027 
00028 
00029 PyNTuple::
00030 PyNTuple ( const std::vector < std::string > & labels )
00031   : NTuple ( labels )
00032 {
00033   // nothing else to be done.
00034 }
00035 
00036 PyNTuple::
00037 PyNTuple ( unsigned int n )
00038   : NTuple ( n )
00039 {
00040   // nothing else to be done
00041 }
00042 
00043 PyNTuple::
00044 PyNTuple ( const PyNTuple & nt )
00045   : NTuple ( nt )
00046 {
00047   // nothing else to be done
00048 }
00049 
00050 PyNTuple::
00051 PyNTuple ( const NTuple & nt )
00052   : NTuple ( nt )
00053 {
00054   // nothing else to be done
00055 }
00056 
00057 PyNTuple::
00058 PyNTuple ( )
00059   : NTuple ( )
00060 {
00061 }
00062 
00063 void
00064 PyNTuple::
00065 setTitle ( const std::string & title )
00066 {
00067   PyApp::lock ();
00068   DataSource::setTitle ( title );
00069   PyApp::unlock ();
00070 }
00071 
00072 int
00073 PyNTuple::
00074 addColumn ( const std::string & label,
00075             const std::vector < double > & column )
00076 {
00077   PyApp::lock ();
00078   int index = -1;
00079   try {
00080     index = NTuple::addColumn ( label, column );
00081   }
00082   catch ( const runtime_error & e ) {
00083     PyApp::unlock ();
00084     throw e;
00085   }
00086   PyApp::unlock ();
00087 
00088   return index;
00089 }
00090 
00091 void
00092 PyNTuple::
00093 replaceColumn ( unsigned int i, const std::vector < double > & column )
00094 {
00095   PyApp::lock ();
00096   try {
00097     NTuple::replaceColumn ( i, column );
00098   }
00099   catch ( const runtime_error & e ) {
00100     PyApp::unlock ();
00101     throw e;
00102   }
00103   PyApp::unlock ();
00104 }
00105 
00106 void
00107 PyNTuple::
00108 replaceColumn ( const std::string & label,
00109                 const std::vector < double > & column )
00110 {
00111   PyApp::lock ();
00112   try {
00113     DataSource::replaceColumn ( label, column );
00114   }
00115   catch ( const runtime_error & e ) {
00116     PyApp::unlock ();
00117     throw e;
00118   }
00119   PyApp::unlock ();
00120 }
00121 
00122 void
00123 PyNTuple::
00124 addRow ( const std::vector < double > & row )
00125 {
00126   // at some point we needed this lock, but after to code was fixed so
00127   // PyCanvas checks for pending events this lock causes
00128   // run_test_scripts to hang when running with no pompt.
00129 
00130   PyApp::lock ();
00131 
00132   try { 
00133     NTuple::addRow ( row );
00134   }
00135   catch ( const runtime_error & e ) {
00136     PyApp::unlock ();
00137     throw e;
00138   }
00139 
00140   PyApp::unlock ();
00141 }
00142 
00143 void
00144 PyNTuple::
00145 clear ()
00146 {
00147   PyApp::lock ();
00148   NTuple::clear ();
00149   PyApp::unlock ();
00150 }
00151 
00152 void
00153 PyNTuple::
00154 append ( const DataSource * source )
00155 {
00156   PyApp::lock ();
00157   NTuple::append ( source );
00158   PyApp::unlock ();
00159 }

Generated for HippoDraw Class Library by doxygen