export_DataSource.cxx

Go to the documentation of this file.
00001 
00012 #ifdef _MSC_VER
00013 // nonstandard extension used 'extern' before...
00014 # pragma warning(disable:4231)  
00015 
00016 // needs to have dll-interface used by client
00017 # pragma warning(disable:4251)  
00018 
00019 // non dll-interface struct
00020 # pragma warning(disable:4275)  
00021 
00022 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
00023 # pragma warning(disable:4800)  
00024 #endif
00025 
00026 // include first to avoid _POSIX_C_SOURCE warning.
00027 #include <boost/python.hpp>
00028 
00029 #include "datasrcs/DataSource.h"
00030 
00031 using std::vector;
00032 using namespace boost::python;
00033 
00034 namespace hippodraw {
00035 namespace Python {
00036 
00037 void
00038 export_DataSource()
00039 {
00040   class_ < DataSource, bases<>,
00041     DataSource, boost::noncopyable >
00042     ( "DataSource",
00043       "This class is an abstract base class defining the data table,\n"
00044       "called an ntuple.  That is a table with some number of columns and a\n"
00045       "perhaps large number of rows. It implements some of the\n"
00046       "but the actual data storage is done in a derived class.",
00047       no_init )
00048 
00049     .add_property ( "columns", 
00050                     &DataSource::columns )
00051 
00052     .add_property ( "rows",
00053                     &DataSource::rows )
00054 
00055     .def ( "getTitle", &DataSource::title,
00056            return_value_policy < copy_const_reference > (),
00057            "getTitle () -> string\n"
00058            "\n"
00059            "Returns the title of the ntuple." )
00060 
00061     .def ( "setName", &DataSource::setName,
00062            "setName ( string ) -> None\n"
00063            "\n"
00064            "Sets the name of the ntuple.   The name should be a unique\n"
00065            "string withing a running application.   It may appear in the\n"
00066            "Inspector." )
00067 
00068     .def ( "setTitle", &DataSource::setTitle,
00069            "setTitle ( string ) -> None\n"
00070            "\n"
00071            "Sets the title of the ntuple.  The title by default appears at\n"
00072            "the top of a Display." )
00073            
00074     .def ( "getLabels", &DataSource::getLabels,
00075            return_value_policy < copy_const_reference > (),
00076            "getLabels () -> list\n"
00077            "\n"
00078            "Returns list of column labels." )
00079 
00080     .def ( "getColumn", 
00081            ( const std::vector < double > & (DataSource::* ) // fptr
00082              ( unsigned int ) const) // function signature
00083            &DataSource::getColumn,
00084            return_value_policy < copy_const_reference> (),
00085            "getColumn ( label ) -> list\n"
00086            "getColumn ( index ) -> list\n"
00087            "\n"
00088            "Get a column by its label or index.   Returns copy of the\n"
00089            "contents." )
00090 
00091     .def ( "getColumn", 
00092            ( const std::vector < double > & (DataSource::* ) // fptr
00093              ( const std::string & ) const) // function signature
00094            &DataSource::getColumn,
00095            return_value_policy < copy_const_reference> () )
00096 
00097     .def ( "replaceColumn",
00098            ( void ( DataSource::* ) // function pointer
00099              ( const std::string &,
00100                const std::vector < double > & ) ) // signature
00101            &DataSource::replaceColumn,
00102            "replaceColumn ( label, list ) -> None\n"
00103            "\n"
00104            "Replaces the column of data by abel." )
00105 
00106     .def ( "clear",
00107            &DataSource::clear,
00108            "clear () -> None\n"
00109            "\n"
00110            "Clears the data elements of the DataSource.   That is, remove\n"
00111            "all the rows while keeping the column labels." )
00112 
00113    ;
00114 }
00115 
00116 } // namespace Python
00117 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen