00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef SWIG_gnuradio_swig_python_WRAP_H_
00012 #define SWIG_gnuradio_swig_python_WRAP_H_
00013
00014 #include <map>
00015 #include <string>
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef SWIG_DIRECTOR_PYTHON_HEADER_
00028 #define SWIG_DIRECTOR_PYTHON_HEADER_
00029
00030 #ifdef __cplusplus
00031
00032 #include <string>
00033 #include <iostream>
00034 #include <exception>
00035 #include <vector>
00036 #include <map>
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef SWIG_PYTHON_DIRECTOR_NO_VTABLE
00046 #ifndef SWIG_PYTHON_DIRECTOR_VTABLE
00047 #define SWIG_PYTHON_DIRECTOR_VTABLE
00048 #endif
00049 #endif
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef SWIG_DIRECTOR_NO_UEH
00058 #ifndef SWIG_DIRECTOR_UEH
00059 #define SWIG_DIRECTOR_UEH
00060 #endif
00061 #endif
00062
00063
00064
00065
00066
00067
00068 #ifdef SWIG_DIRECTOR_STATIC
00069
00070 #define Swig
00071 #endif
00072
00073
00074
00075
00076
00077
00078
00079 #ifdef SWIG_DIRECTOR_NORTTI
00080
00081
00082
00083
00084 # ifndef SWIG_DIRECTOR_RTDIR
00085 # define SWIG_DIRECTOR_RTDIR
00086 #include <map>
00087
00088 namespace Swig {
00089 class Director;
00090 SWIGINTERN std::map<void*,Director*>& get_rtdir_map() {
00091 static std::map<void*,Director*> rtdir_map;
00092 return rtdir_map;
00093 }
00094
00095 SWIGINTERNINLINE void set_rtdir(void *vptr, Director *rtdir) {
00096 get_rtdir_map()[vptr] = rtdir;
00097 }
00098
00099 SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
00100 std::map<void*,Director*>::const_iterator pos = get_rtdir_map().find(vptr);
00101 Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
00102 return rtdir;
00103 }
00104 }
00105 # endif
00106
00107 # define SWIG_DIRECTOR_CAST(Arg) Swig::get_rtdir(static_cast<void*>(Arg))
00108 # define SWIG_DIRECTOR_RGTR(Arg1, Arg2) Swig::set_rtdir(static_cast<void*>(Arg1), Arg2)
00109
00110 #else
00111
00112 # define SWIG_DIRECTOR_CAST(Arg) dynamic_cast<Swig::Director*>(Arg)
00113 # define SWIG_DIRECTOR_RGTR(Arg1, Arg2)
00114
00115 #endif
00116
00117 extern "C" {
00118 struct swig_type_info;
00119 }
00120
00121 namespace Swig {
00122
00123
00124 struct GCItem
00125 {
00126 virtual ~GCItem() = 0;
00127
00128 virtual int get_own() const
00129 {
00130 return 0;
00131 }
00132 };
00133
00134 struct GCItem_var
00135 {
00136 GCItem_var(GCItem *item = 0) : _item(item)
00137 {
00138 }
00139
00140 GCItem_var& operator=(GCItem *item)
00141 {
00142 GCItem *tmp = _item;
00143 _item = item;
00144 delete tmp;
00145 return *this;
00146 }
00147
00148 ~GCItem_var()
00149 {
00150 delete _item;
00151 }
00152
00153 GCItem * operator->() const
00154 {
00155 return _item;
00156 }
00157
00158 private:
00159 GCItem *_item;
00160 };
00161
00162 struct GCItem_Object : GCItem
00163 {
00164 GCItem_Object(int own) : _own(own)
00165 {
00166 }
00167
00168 virtual ~GCItem_Object()
00169 {
00170 }
00171
00172 int get_own() const
00173 {
00174 return _own;
00175 }
00176
00177 private:
00178 int _own;
00179 };
00180
00181 template <typename Type>
00182 struct GCItem_T : GCItem
00183 {
00184 GCItem_T(Type *ptr) : _ptr(ptr)
00185 {
00186 }
00187
00188 virtual ~GCItem_T()
00189 {
00190 delete _ptr;
00191 }
00192
00193 private:
00194 Type *_ptr;
00195 };
00196
00197 template <typename Type>
00198 struct GCArray_T : GCItem
00199 {
00200 GCArray_T(Type *ptr) : _ptr(ptr)
00201 {
00202 }
00203
00204 virtual ~GCArray_T()
00205 {
00206 delete[] _ptr;
00207 }
00208
00209 private:
00210 Type *_ptr;
00211 };
00212
00213
00214
00215 class UnknownExceptionHandler
00216 {
00217 static void handler();
00218 public:
00219
00220 #ifdef SWIG_DIRECTOR_UEH
00221 std::unexpected_handler old;
00222 UnknownExceptionHandler(std::unexpected_handler nh = handler)
00223 {
00224 old = std::set_unexpected(nh);
00225 }
00226
00227 ~UnknownExceptionHandler()
00228 {
00229 std::set_unexpected(old);
00230 }
00231 #endif
00232 };
00233
00234
00235 class DirectorException {
00236 protected:
00237 std::string swig_msg;
00238 public:
00239 DirectorException(PyObject *error, const char* hdr ="", const char* msg ="")
00240 : swig_msg(hdr)
00241 {
00242 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
00243 if (strlen(msg)) {
00244 swig_msg += " ";
00245 swig_msg += msg;
00246 }
00247 if (!PyErr_Occurred()) {
00248 PyErr_SetString(error, getMessage());
00249 } else {
00250 SWIG_Python_AddErrorMsg(getMessage());
00251 }
00252 SWIG_PYTHON_THREAD_END_BLOCK;
00253 }
00254
00255 const char *getMessage() const
00256 {
00257 return swig_msg.c_str();
00258 }
00259
00260 static void raise(PyObject *error, const char *msg)
00261 {
00262 throw DirectorException(error, msg);
00263 }
00264
00265 static void raise(const char *msg)
00266 {
00267 raise(PyExc_RuntimeError, msg);
00268 }
00269 };
00270
00271
00272
00273 class DirectorTypeMismatchException : public Swig::DirectorException {
00274 public:
00275 DirectorTypeMismatchException(PyObject *error, const char* msg="")
00276 : Swig::DirectorException(error, "Swig director type mismatch", msg)
00277 {
00278 }
00279
00280 DirectorTypeMismatchException(const char* msg="")
00281 : Swig::DirectorException(PyExc_TypeError, "Swig director type mismatch", msg)
00282 {
00283 }
00284
00285 static void raise(PyObject *error, const char *msg)
00286 {
00287 throw DirectorTypeMismatchException(error, msg);
00288 }
00289
00290 static void raise(const char *msg)
00291 {
00292 throw DirectorTypeMismatchException(msg);
00293 }
00294 };
00295
00296
00297 class DirectorMethodException : public Swig::DirectorException {
00298 public:
00299 DirectorMethodException(const char* msg = "")
00300 : DirectorException(PyExc_RuntimeError, "Swig director method error", msg)
00301 {
00302 }
00303
00304 static void raise(const char *msg)
00305 {
00306 throw DirectorMethodException(msg);
00307 }
00308 };
00309
00310
00311 class DirectorPureVirtualException : public Swig::DirectorException
00312 {
00313 public:
00314 DirectorPureVirtualException(const char* msg = "")
00315 : DirectorException(PyExc_RuntimeError, "Swig director pure virtal method called", msg)
00316 {
00317 }
00318
00319 static void raise(const char *msg)
00320 {
00321 throw DirectorPureVirtualException(msg);
00322 }
00323 };
00324
00325
00326 #if defined(SWIG_PYTHON_THREADS)
00327
00328 # if !defined(__THREAD__)
00329 # define __THREAD__ 1
00330 # endif
00331 #endif
00332
00333
00334 #ifdef __THREAD__
00335 # define __PTHREAD__
00336 # if defined(_WIN32) || defined(__WIN32__)
00337 # define pthread_mutex_lock EnterCriticalSection
00338 # define pthread_mutex_unlock LeaveCriticalSection
00339 # define pthread_mutex_t CRITICAL_SECTION
00340 # define SWIG_MUTEX_INIT(var) var
00341 # else
00342 # include <pthread.h>
00343 # define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER
00344 # endif
00345 #endif
00346
00347 #ifdef __PTHREAD__
00348 struct Guard
00349 {
00350 pthread_mutex_t *_mutex;
00351
00352 Guard(pthread_mutex_t &mutex) : _mutex(&mutex)
00353 {
00354 pthread_mutex_lock(_mutex);
00355 }
00356
00357 ~Guard()
00358 {
00359 pthread_mutex_unlock(_mutex);
00360 }
00361 };
00362 # define SWIG_GUARD(mutex) Guard _guard(mutex)
00363 #else
00364 # define SWIG_GUARD(mutex)
00365 #endif
00366
00367
00368 class Director {
00369 private:
00370
00371 PyObject* swig_self;
00372
00373 mutable bool swig_disown_flag;
00374
00375 static bool swig_up;
00376
00377 #ifdef __PTHREAD__
00378
00379 static pthread_mutex_t swig_mutex_up;
00380 static bool swig_mutex_active;
00381 static pthread_t swig_mutex_thread;
00382 #endif
00383
00384
00385 void swig_decref() const {
00386 if (swig_disown_flag) {
00387 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
00388 Py_DECREF(swig_self);
00389 SWIG_PYTHON_THREAD_END_BLOCK;
00390 }
00391 }
00392
00393
00394 #ifdef __PTHREAD__
00395 void swig_clear_up() const {
00396 Swig::Director::swig_up = false;
00397 Swig::Director::swig_mutex_active = false;
00398 pthread_mutex_unlock(&swig_mutex_up);
00399 }
00400 #else
00401 void swig_clear_up() const {
00402 Swig::Director::swig_up = false;
00403 }
00404 #endif
00405
00406 public:
00407
00408 Director(PyObject* self);
00409
00410
00411 virtual ~Director();
00412
00413
00414 PyObject *swig_get_self() const {
00415 return swig_self;
00416 }
00417
00418
00419
00420
00421 #ifdef __PTHREAD__
00422 bool swig_get_up() const {
00423 if (Swig::Director::swig_mutex_active) {
00424 if (pthread_equal(Swig::Director::swig_mutex_thread, pthread_self())) {
00425 bool up = swig_up;
00426 swig_clear_up();
00427 return up;
00428 }
00429 }
00430 return 0;
00431 }
00432 #else
00433 bool swig_get_up() const {
00434 bool up = swig_up;
00435 swig_up = false;
00436 return up;
00437 }
00438 #endif
00439
00440
00441
00442
00443 #ifdef __PTHREAD__
00444 void swig_set_up() const {
00445 pthread_mutex_lock(&Swig::Director::swig_mutex_up);
00446 Swig::Director::swig_mutex_thread = pthread_self();
00447 Swig::Director::swig_mutex_active = true;
00448 Swig::Director::swig_up = true;
00449 }
00450 #else
00451 void swig_set_up() const {
00452 Swig::Director::swig_up = true;
00453 }
00454 #endif
00455
00456
00457
00458 void swig_disown() const {
00459 if (!swig_disown_flag) {
00460 swig_disown_flag=true;
00461 swig_incref();
00462 }
00463 }
00464
00465
00466 void swig_incref() const {
00467 if (swig_disown_flag) {
00468 Py_INCREF(swig_self);
00469 }
00470 }
00471
00472
00473 virtual bool swig_get_inner(const char* ) const {
00474 return true;
00475 }
00476
00477 virtual void swig_set_inner(const char* , bool ) const {
00478 }
00479
00480
00481 private:
00482 typedef std::map<void*, GCItem_var> ownership_map;
00483 mutable ownership_map owner;
00484 #ifdef __PTHREAD__
00485 static pthread_mutex_t swig_mutex_own;
00486 #endif
00487
00488 public:
00489 template <typename Type>
00490 void swig_acquire_ownership_array(Type *vptr) const
00491 {
00492 if (vptr) {
00493 SWIG_GUARD(swig_mutex_own);
00494 owner[vptr] = new GCArray_T<Type>(vptr);
00495 }
00496 }
00497
00498 template <typename Type>
00499 void swig_acquire_ownership(Type *vptr) const
00500 {
00501 if (vptr) {
00502 SWIG_GUARD(swig_mutex_own);
00503 owner[vptr] = new GCItem_T<Type>(vptr);
00504 }
00505 }
00506
00507 void swig_acquire_ownership_obj(void *vptr, int own) const
00508 {
00509 if (vptr && own) {
00510 SWIG_GUARD(swig_mutex_own);
00511 owner[vptr] = new GCItem_Object(own);
00512 }
00513 }
00514
00515 int swig_release_ownership(void *vptr) const
00516 {
00517 int own = 0;
00518 if (vptr) {
00519 SWIG_GUARD(swig_mutex_own);
00520 ownership_map::iterator iter = owner.find(vptr);
00521 if (iter != owner.end()) {
00522 own = iter->second->get_own();
00523 owner.erase(iter);
00524 }
00525 }
00526 return own;
00527 }
00528 };
00529
00530 }
00531
00532 #endif
00533
00534
00535 #endif
00536
00537 class SwigDirector_gr_prefs : public gr_prefs, public Swig::Director {
00538
00539 public:
00540 SwigDirector_gr_prefs(PyObject *self);
00541 virtual bool has_option(std::string const section, std::string const option);
00542 virtual std::string const get_string(std::string const section, std::string const option, std::string const default_val);
00543 virtual double get_double(std::string const section, std::string const option, double default_val);
00544 virtual ~SwigDirector_gr_prefs();
00545 virtual bool has_section(std::string const section);
00546 virtual bool get_bool(std::string const section, std::string const option, bool default_val);
00547 virtual long get_long(std::string const section, std::string const option, long default_val);
00548
00549
00550
00551 public:
00552 bool swig_get_inner(const char* name) const {
00553 std::map<std::string, bool>::const_iterator iv = inner.find(name);
00554 return (iv != inner.end() ? iv->second : false);
00555 }
00556
00557 void swig_set_inner(const char* name, bool val) const
00558 { inner[name] = val;}
00559
00560 private:
00561 mutable std::map<std::string, bool> inner;
00562
00563
00564 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
00565
00566 PyObject *swig_get_method(size_t method_index, const char *method_name) const {
00567 PyObject *method = vtable[method_index];
00568 if (!method) {
00569 swig::PyObject_var name = PyString_FromString(method_name);
00570 method = PyObject_GetAttr(swig_get_self(), name);
00571 if (method == NULL) {
00572 std::string msg = "Method in class gr_prefs doesn't exist, undefined ";
00573 msg += method_name;
00574 Swig::DirectorMethodException::raise(msg.c_str());
00575 }
00576 vtable[method_index] = method;
00577 };
00578 return method;
00579 }
00580 private:
00581 mutable swig::PyObject_var vtable[6];
00582 #endif
00583
00584 };
00585
00586
00587 class SwigDirector_feval_dd : public gr_feval_dd, public Swig::Director {
00588
00589 public:
00590 SwigDirector_feval_dd(PyObject *self);
00591 virtual ~SwigDirector_feval_dd();
00592 virtual double eval(double x);
00593
00594
00595
00596 public:
00597 bool swig_get_inner(const char* name) const {
00598 std::map<std::string, bool>::const_iterator iv = inner.find(name);
00599 return (iv != inner.end() ? iv->second : false);
00600 }
00601
00602 void swig_set_inner(const char* name, bool val) const
00603 { inner[name] = val;}
00604
00605 private:
00606 mutable std::map<std::string, bool> inner;
00607
00608
00609 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
00610
00611 PyObject *swig_get_method(size_t method_index, const char *method_name) const {
00612 PyObject *method = vtable[method_index];
00613 if (!method) {
00614 swig::PyObject_var name = PyString_FromString(method_name);
00615 method = PyObject_GetAttr(swig_get_self(), name);
00616 if (method == NULL) {
00617 std::string msg = "Method in class feval_dd doesn't exist, undefined ";
00618 msg += method_name;
00619 Swig::DirectorMethodException::raise(msg.c_str());
00620 }
00621 vtable[method_index] = method;
00622 };
00623 return method;
00624 }
00625 private:
00626 mutable swig::PyObject_var vtable[1];
00627 #endif
00628
00629 };
00630
00631
00632 class SwigDirector_feval_cc : public gr_feval_cc, public Swig::Director {
00633
00634 public:
00635 SwigDirector_feval_cc(PyObject *self);
00636 virtual ~SwigDirector_feval_cc();
00637 virtual gr_complex eval(gr_complex x);
00638
00639
00640
00641 public:
00642 bool swig_get_inner(const char* name) const {
00643 std::map<std::string, bool>::const_iterator iv = inner.find(name);
00644 return (iv != inner.end() ? iv->second : false);
00645 }
00646
00647 void swig_set_inner(const char* name, bool val) const
00648 { inner[name] = val;}
00649
00650 private:
00651 mutable std::map<std::string, bool> inner;
00652
00653
00654 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
00655
00656 PyObject *swig_get_method(size_t method_index, const char *method_name) const {
00657 PyObject *method = vtable[method_index];
00658 if (!method) {
00659 swig::PyObject_var name = PyString_FromString(method_name);
00660 method = PyObject_GetAttr(swig_get_self(), name);
00661 if (method == NULL) {
00662 std::string msg = "Method in class feval_cc doesn't exist, undefined ";
00663 msg += method_name;
00664 Swig::DirectorMethodException::raise(msg.c_str());
00665 }
00666 vtable[method_index] = method;
00667 };
00668 return method;
00669 }
00670 private:
00671 mutable swig::PyObject_var vtable[1];
00672 #endif
00673
00674 };
00675
00676
00677 class SwigDirector_feval_ll : public gr_feval_ll, public Swig::Director {
00678
00679 public:
00680 SwigDirector_feval_ll(PyObject *self);
00681 virtual ~SwigDirector_feval_ll();
00682 virtual long eval(long x);
00683
00684
00685
00686 public:
00687 bool swig_get_inner(const char* name) const {
00688 std::map<std::string, bool>::const_iterator iv = inner.find(name);
00689 return (iv != inner.end() ? iv->second : false);
00690 }
00691
00692 void swig_set_inner(const char* name, bool val) const
00693 { inner[name] = val;}
00694
00695 private:
00696 mutable std::map<std::string, bool> inner;
00697
00698
00699 #if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
00700
00701 PyObject *swig_get_method(size_t method_index, const char *method_name) const {
00702 PyObject *method = vtable[method_index];
00703 if (!method) {
00704 swig::PyObject_var name = PyString_FromString(method_name);
00705 method = PyObject_GetAttr(swig_get_self(), name);
00706 if (method == NULL) {
00707 std::string msg = "Method in class feval_ll doesn't exist, undefined ";
00708 msg += method_name;
00709 Swig::DirectorMethodException::raise(msg.c_str());
00710 }
00711 vtable[method_index] = method;
00712 };
00713 return method;
00714 }
00715 private:
00716 mutable swig::PyObject_var vtable[1];
00717 #endif
00718
00719 };
00720
00721
00722 #endif