| 25 | public: |
| 26 | |
| 27 | class Binding : public GenericProxy<Binding> { |
| 28 | public: |
| 29 | Binding( EnvironmentClass& env_, const std::string& name_) : |
| 30 | env(env_), name(name_){} |
| 31 | |
| 32 | inline bool active() const { |
| 33 | return env.bindingIsActive(name) ; |
| 34 | } |
| 35 | inline bool locked() const { |
| 36 | return env.bindingIsLocked(name) ; |
| 37 | } |
| 38 | inline bool exists() const { |
| 39 | return env.exists(name) ; |
| 40 | } |
| 41 | void lock() { |
| 42 | env.lockBinding(name) ; |
| 43 | } |
| 44 | void unlock(){ |
| 45 | env.unlockBinding(name) ; |
| 46 | } |
| 47 | Binding& operator=(const Binding& rhs){ |
| 48 | if( *this != rhs ) |
| 49 | set( rhs.get() ) ; |
| 50 | return *this ; |
| 51 | } |
| 52 | |
| 53 | template <typename WRAPPABLE> |
| 54 | Binding& operator=(const WRAPPABLE& rhs); |
| 55 | |
| 56 | template <typename T> operator T() const; |
| 57 | |
| 58 | private: |
| 59 | |
| 60 | SEXP get() const { |
| 61 | return env.get( name ) ; |
| 62 | } |
| 63 | |
| 64 | void set( SEXP x){ |
| 65 | env.assign(name, x ) ; |
| 66 | } |
| 67 | |
| 68 | EnvironmentClass& env ; |
| 69 | std::string name ; |
| 70 | } ; |
| 71 | |
| 72 | class const_Binding : public GenericProxy<const_Binding> { |
| 73 | public: |