/[ascend]/trunk/ascxx/curve.cpp
ViewVC logotype

Contents of /trunk/ascxx/curve.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1198 - (show annotations) (download) (as text)
Mon Jan 22 08:29:32 2007 UTC (17 years, 8 months ago) by johnpye
Original Path: trunk/pygtk/curve.cpp
File MIME type: text/x-c++src
File size: 1003 byte(s)
Fixed 'plotbvp' example.
Tried to clean up C++ wrapping wrt default ctors & std::vector in SWIG (not much improvement though)
1 #include "curve.h"
2
3 #include <compiler/plot.h>
4 #include <stdexcept>
5 using namespace std;
6
7 Curve::Curve(const Instanc &i) : Instanc(i){
8 cerr << "Created curve";
9
10 // may through 'child not found'...
11 Instanc point_array = getChild(PLOT_POINT);
12
13 vector<Instanc> pa = point_array.getChildren();
14 vector<Instanc>::iterator pai;
15
16 for(pai = pa.begin(); pai < pa.end() ; ++pai){
17 Instanc xinst = pai->getChild(PLOT_XPOINT);
18 Instanc yinst = pai->getChild(PLOT_YPOINT);
19 if(xinst.isAssigned() && yinst.isAssigned()){
20 x.push_back(xinst.getRealValue());
21 y.push_back(yinst.getRealValue());
22 }
23 }
24 }
25
26 Curve::Curve(){
27 throw runtime_error("not allowed");
28 }
29
30 Curve::Curve(const Curve &old) : Instanc(old.getInternalType()){
31 x = old.x;
32 y = old.y;
33 }
34
35 Curve &
36 Curve::operator=(const Curve &old){
37 this->x = old.x;
38 this->y = old.y;
39 return *this;
40 }
41
42 const string
43 Curve::getLegend() const{
44 Instanc li = getChild(PLOT_LEGEND);
45 if(li.isAssigned()){
46 return li.getSymbolValue().toString();
47 }
48 return "";
49 }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22