libcommonc++  0.7
JavaScope Class Reference

A convenience class for creating lexical Java scopes in native code. More...

#include <JavaScope.h++>

Public Member Functions

 JavaScope (JavaContext &context, int capacity)
 Construct a new JavaScope for the given JavaContext and local reference capacity. More...
 
 ~JavaScope ()
 Destructor. More...
 

Detailed Description

A convenience class for creating lexical Java scopes in native code.

JavaScope creates a new JVM stack frame in its constructor and releases it in its destructor.

A block of code can be conveniently wrapped in a new scope by using the java_scoped() macro, as follows:

JavaContext ctx = ...;
int capacity = ...;
java_scoped(ctx, capacity)
{
  // scoped code here
}

With this approach, any Java local references that are created within the scoped block will be automatically freed when control leaves the block.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ JavaScope()

JavaScope ( JavaContext context,
int  capacity 
)
inline

Construct a new JavaScope for the given JavaContext and local reference capacity.

A new stack frame is created in the JVM.

◆ ~JavaScope()

~JavaScope ( )
inline

Destructor.

Pops the stack frame.


The documentation for this class was generated from the following file: