Hooks execution

If a given component supports pre- and post-method invocation instrumentation, also known as ``hooks'', their execution can be enabled or disabled at runtime through the built-in set_hooks method. For example, given the following SIDL specification$:$


package hooks version 1.0
{
  class Basics {
    /**
     * Basic illustration of hooks for static methods.
     */
    static int aStaticMeth(in int i, out int o, inout int io);

    /**
     * Basic illustration of hooks for static methods.
     */
    int aNonStaticMeth(in int i, out int o, inout int io);
  }
}

which has a single static function and a member function for the Basics class. Due to unresolved method overloading problems, the processes for enabling and disabling execution of the implementation-specific hooks are currently dependent on use of fully-qualified functions, as illustrated below.


  use sidl
  use hooks_Basics
  type(hooks_Basics_t)         :: obj
  type(sidl_BaseInterface_t)   :: exception

  call new(obj, exception)

  !
  ! Enable hooks execution (enabled by default)
  ! ...for static methods
  !    (until method overloading issue can be resolved)...
  !
  call hooks_Basics__set_hooks_static_m(1, exception)
  !
  ! ...for non-static methods
  !    (until method overloading issue can be resolved)...
  !
  call hooks_Basics__set_hooks_m(obj, 1, exception)

  !
  ! ...do something important...
  !

  !
  ! Disable hooks execution
  ! ...for static methods
  !
  call hooks_Basics__set_hooks_static_m(0, exception)
  !
  ! ...for non-static methods
  !
  call hooks_Basics__set_hooks_m(obj, 0, exception)

  !
  ! ...do something important...
  !

It is important to keep in mind that the set_hooks_static method must be used to enable/disable invocation of hooks for static methods and the set_hooks method must be used for those of non-static methods. Also, Babel does not provide client access to the _pre and _post methods; therefore, they cannot be invoked directly. More information on the instrumentation process is provided in Subsection 9.4.5.





babel-1.4.0
users_guide Last Modified 2008-10-16

http://www.llnl.gov/CASC/components
components@llnl.gov