export_NumArrayTuple.cxx

Go to the documentation of this file.
00001 
00012 // for have numarray etc
00013 #ifdef HAVE_CONFIG_H
00014 #include "config.h"
00015 #endif
00016 
00017 #ifdef _MSC_VER
00018 // nonstandard extension used 'extern' before...
00019 # pragma warning(disable:4231)  
00020 
00021 // needs to have dll-interface used by client
00022 # pragma warning(disable:4251)  
00023 
00024 // non dll-interface struct
00025 # pragma warning(disable:4275)  
00026 
00027 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
00028 # pragma warning(disable:4800)  
00029 #endif
00030 
00031 // include first to avoid _POSIX_C_SOURCE warning.
00032 #include <boost/python.hpp>
00033 
00034 #define PY_ARRAY_UNIQUE_SYMBOL HippoPyArrayHandle
00035 
00036 //#include "num_util.h"
00037 
00038 #include "NumArrayTuple.h"
00039 
00040 using namespace boost::python;
00041 
00042 namespace hippodraw {
00043 namespace Python {
00044 
00045 void
00046 export_NumArrayTuple()
00047 {
00048   import_array();
00049 
00050 #ifdef HAVE_NUMERIC
00051   numeric::array::set_module_and_type 
00052     ( "Numeric",
00053       "ArrayType" );
00054 #else
00055 #ifdef HAVE_NUMPY
00056   numeric::array::set_module_and_type 
00057     ( "numpy",
00058       "ndarray" );
00059 #else
00060   numeric::array::set_module_and_type (); // default numarray & NDarray
00061 #endif
00062 #endif
00063 
00064   class_ < NumArrayTuple, bases < DataSource > > ( "NumArrayTuple",
00065                 "Interface to numarray Python extension module.",
00066                  init< > ( "Creates an empty NumArrayTuple" ) )
00067 
00068 //     .add_property ( "rows", &NumArrayTuple::rows )
00069 
00070     .def ( "setLabels", &NumArrayTuple::setLabels,
00071            args ( "[label, ...]" ), 
00072            "Sets the labels of the columns." )
00073 
00074     .def ( "getLabel", &NumArrayTuple::getLabelAt,
00075            return_value_policy < copy_const_reference > () )
00076 
00077 //     .def ( "getLabels", &NumArrayTuple::getLabels,
00078 //         return_value_policy < copy_const_reference > () )
00079 
00080     .def ( "addColumn", 
00081            &NumArrayTuple::addColumn,
00082            "Adds the array as a new column with label" )
00083 
00084     .def ( "replaceColumn",
00085            ( void ( NumArrayTuple:: * ) //function pointer
00086              ( unsigned int, numeric::array ) ) // signature
00087            &NumArrayTuple::replaceColumn,
00088            "Replaces existing column with new array\n"
00089            "Args:\n"
00090            "\t index\n"
00091            "\t numarray" )
00092 
00093     .def ( "replaceColumn",
00094            ( void ( NumArrayTuple:: * ) //function pointer
00095              ( const std::string &, numeric::array ) ) // signature
00096            &NumArrayTuple::replaceColumn,
00097            "Replaces existing column with new array\n"
00098            "Args:\n"
00099            "\t label\n"
00100            "\t numarray" )
00101 
00102     .def ( "notifyObservers",
00103            &NumArrayTuple::notifyObservers,
00104            "Sends update message to all observers." )
00105 
00106     ;
00107 }
00108 
00109 } // namespace Python
00110 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen