Commit 211c2251c3ed3cd6bd57b673e4bfa89e92af86e1

Authored by Jürgen Knödlseder
1 parent 2ccf624e

Remove const at() method and __str()__() extension.

The const at() method is ignored by swig anyway, as Python has no const declaration.

The __str()__() extension is now implemented in the GBase base class, so we don't need to implement it again for the derived class.
Showing 1 changed file with 21 additions and 25 deletions
pyext/GModels.i
@@ -59,28 +59,27 @@ public: @@ -59,28 +59,27 @@ public:
59 virtual ~GModels(void); 59 virtual ~GModels(void);
60 60
61 // Methods 61 // Methods
62 - void clear(void);  
63 - GModels* clone(void) const;  
64 - GModel* at(const int& index);  
65 - const GModel* at(const int& index) const;  
66 - int size(void) const;  
67 - bool isempty(void) const;  
68 - GModel* set(const int& index, const GModel& model);  
69 - GModel* set(const std::string& name, const GModel& model);  
70 - GModel* append(const GModel& model);  
71 - GModel* insert(const int& index, const GModel& model);  
72 - GModel* insert(const std::string& name, const GModel& model);  
73 - void remove(const int& index);  
74 - void remove(const std::string& name);  
75 - void reserve(const int& num);  
76 - void extend(const GModels& models);  
77 - bool contains(const std::string& name) const;  
78 - void load(const std::string& filename);  
79 - void save(const std::string& filename) const;  
80 - void read(const GXml& xml);  
81 - void write(GXml& xml) const;  
82 - double eval(const GEvent& event, const GObservation& obs) const;  
83 - double eval_gradients(const GEvent& event, const GObservation& obs) const; 62 + void clear(void);
  63 + GModels* clone(void) const;
  64 + GModel* at(const int& index);
  65 + int size(void) const;
  66 + bool isempty(void) const;
  67 + GModel* set(const int& index, const GModel& model);
  68 + GModel* set(const std::string& name, const GModel& model);
  69 + GModel* append(const GModel& model);
  70 + GModel* insert(const int& index, const GModel& model);
  71 + GModel* insert(const std::string& name, const GModel& model);
  72 + void remove(const int& index);
  73 + void remove(const std::string& name);
  74 + void reserve(const int& num);
  75 + void extend(const GModels& models);
  76 + bool contains(const std::string& name) const;
  77 + void load(const std::string& filename);
  78 + void save(const std::string& filename) const;
  79 + void read(const GXml& xml);
  80 + void write(GXml& xml) const;
  81 + double eval(const GEvent& event, const GObservation& obs) const;
  82 + double eval_gradients(const GEvent& event, const GObservation& obs) const;
84 }; 83 };
85 84
86 85
@@ -88,9 +87,6 @@ public: @@ -88,9 +87,6 @@ public:
88 * @brief GModels class extension 87 * @brief GModels class extension
89 ***************************************************************************/ 88 ***************************************************************************/
90 %extend GModels { 89 %extend GModels {
91 - char *__str__() {  
92 - return tochar(self->print());  
93 - }  
94 GModel* __getitem__(const int& index) { 90 GModel* __getitem__(const int& index) {
95 if (index >= 0 && index < self->size()) { 91 if (index >= 0 && index < self->size()) {
96 return (*self)[index]; 92 return (*self)[index];