Sha256: f749758b61e49e4c6b9adaea960992674fd19b1c953648030a00855273a18538

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

#ifndef Rice__Director__hpp_
#define Rice__Director__hpp_

#include "Object.hpp"

namespace Rice {

  /**
   * A Director works exactly as a SWIG %director works (thus the name).
   * You use this class to help build proxy classes so that polymorphism
   * works from C++ into Ruby.
   */
  class Director 
  {
    public:
      //! Construct new Director. Needs the Ruby object so that the 
      //  proxy class can call methods on that object.
      Director(Object self);

      virtual ~Director() { }

      //! Is the current method call path coming from Ruby?
      /*! This method allows one to choose the call chain according
       *  to the direction of the execution path. We need to do
       *  this to prevent infinite loops where super() calls could
       *  inadvertantly call methods back in Ruby
       */
      bool callIsFromRuby(const char* methodName) const;

      //! Raise a ruby exception when a call comes through for a pure virtual method
      /*! If a Ruby script calls 'super' on a method that's otherwise a pure virtual
       *  method, use this method to throw an exception in this case. 
       */
      void raisePureVirtual() const;

      //! Get the Ruby object linked to this C++ instance
      Object getSelf() const { return self_; }

    private:

      // Save the Ruby object related to the instance of this class
      Object self_;

  };
}

#endif // Rice__Director__hpp_

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jameskilton-rice-1.2.0 rice/Director.hpp
rice-1.2.0 rice/Director.hpp