Mercurial > hg > aimc
changeset 166:d4029d3124c4
- Better python support for signals
author | tomwalters |
---|---|
date | Wed, 04 Aug 2010 07:20:26 +0000 |
parents | f75123cf39ce |
children | 420965490ce1 |
files | src/Support/SignalBank.h swig/aim_modules.i |
diffstat | 2 files changed, 7 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Support/SignalBank.h Wed Aug 04 06:41:56 2010 +0000 +++ b/src/Support/SignalBank.h Wed Aug 04 07:20:26 2010 +0000 @@ -54,31 +54,14 @@ bool Initialize(const SignalBank &input); bool Validate() const; - // Return a const reference to an individual signal. Allows for - // signal[channel][sample] referencing of SignalBanks. inline const vector<float> &operator[](int channel) const { return signals_[channel]; }; - // Return a const reference to an individual signal. inline const vector<float> &get_signal(int channel) const { return signals_[channel]; }; - // Return a reference to the signal vector. The reference is not - // const, so the vector is directly modifiable. In order to maintain - // consistency of the data within the filterbank, the size of this - // vector should not be changed. Changes to the vector size can be picked - // up with a call to Validate(), which will return false if the sizes of - // channle vectors are not consistent. - inline vector<float> &get_mutable_signal(int channel) { - return signals_[channel]; - }; - - inline void set_signal(int channel, vector<float> input) { - signals_[channel] = input; - } - inline float sample(int channel, int index) const { return signals_[channel][index]; } @@ -99,7 +82,6 @@ void set_centre_frequency(int i, float cf); bool initialized() const; int channel_count() const; - void Clear(); private: int channel_count_; int buffer_length_;
--- a/swig/aim_modules.i Wed Aug 04 06:41:56 2010 +0000 +++ b/swig/aim_modules.i Wed Aug 04 07:20:26 2010 +0000 @@ -18,6 +18,12 @@ %module aimc %include "std_string.i" %include stl.i +%include "std_vector.i" + +namespace std { + %template(FloatVector) vector<float>; +} + %{ #include "Support/Common.h" #include "Support/Module.h" @@ -35,6 +41,7 @@ %} %include "Support/Parameters.h" +using namespace std; %include "Support/SignalBank.h" namespace aimc {