00001
00002
00003
00004
00005
00006 #ifndef OH_GRAPH_DATA_H
00007 #define OH_GRAPH_DATA_H
00008
00009 #include <oh/core/Graph.h>
00010 #include <oh/core/Graph2D.h>
00011 #include <oh/core/Axis.h>
00012 #include <owl/time.h>
00013
00014 namespace oh
00015 {
00016 template <class T>
00017 struct Dimension;
00018
00019 template <> struct Dimension<Graph> { static const unsigned int value = 1; };
00020 template <> struct Dimension<Graph2D> { static const unsigned int value = 2; };
00021
00028 template <class T>
00029 class GraphDataI : public T
00030 {
00031 static const unsigned int dimension = Dimension<T>::value;
00032
00033 public:
00040 GraphDataI( );
00041
00043 ~GraphDataI() {}
00044
00046 void set_title(const std::string& t);
00047
00049 std::string get_title() const;
00050
00052 void set_annotations(const std::vector< std::pair< std::string, std::string > > & ann );
00053
00055 void get_annotations( std::vector< std::pair< std::string, std::string > > & ann ) const;
00056
00058 void set_axis_title( oh::Axis::ID axis, const std::string & label );
00059
00061 const std::string & get_axis_title( oh::Axis::ID axis ) const;
00062
00064 std::vector<long> & indices( oh::Axis::ID axis );
00065
00067 const std::vector<long> & get_indices( oh::Axis::ID axis ) const;
00068
00073 std::vector<std::string> & labels( oh::Axis::ID axis );
00074
00076 const std::vector<std::string> & get_labels( oh::Axis::ID axis ) const;
00077
00079 oh::Axis::Kind get_axis_type( oh::Axis::ID axis ) const;
00080
00082 long get_bin_count( oh::Axis::ID axis ) const;
00083
00088 const std::vector<double> & get_axis_range( oh::Axis::ID axis ) const;
00089
00095 void get_axis_range( oh::Axis::ID axis, double & low, double & binwidth ) const;
00096
00101 void set_axis_range( oh::Axis::ID axis, const std::vector<double> & xbins );
00102
00108 void set_axis_range( oh::Axis::ID axis, const double * edges, unsigned long size );
00109
00116 void set_axis_range( oh::Axis::ID axis, double low, double binwidth, unsigned long nbins );
00117
00123 void get_errors(std::vector<const double*>& errorArrays) const;
00124
00126 void set_errors(const std::vector<const double*>& errorArrays);
00127
00129 void set_error_style(typename T::ErrorStyle es);
00130
00132 typename T::ErrorStyle get_error_style() const;
00133
00135 unsigned long get_entries( ) const;
00136
00138 void set_entries( unsigned long entries );
00139
00141 void get_points(std::vector<const double*>& valueArrays) const;
00142
00144 void get_data(std::vector<const double*>& data) const;
00145
00149 void set_points(const std::vector<const double*>& valueArrays);
00150 };
00151 }
00152
00153 namespace oh
00154 {
00155 typedef GraphDataI<oh::Graph> GraphData;
00156 typedef GraphDataI<oh::Graph2D> Graph2DData;
00157 }
00158
00159 #include <oh/core/GraphData.i>
00160
00161 #endif //OH_GRAPH_DATA_H
00162