Impact Acquire SDK Java
RequestFactory Class Reference

A default request factory. More...

Public Member Functions

Request createRequest (Device arg0, int arg1)
 
synchronized void delete ()
 
 RequestFactory ()
 
void swigReleaseOwnership ()
 
void swigTakeOwnership ()
 

Protected Member Functions

void finalize ()
 
 RequestFactory (long cPtr, boolean cMemoryOwn)
 
void swigDirectorDisconnect ()
 

Static Protected Member Functions

static long swigRelease (RequestFactory obj)
 

Protected Attributes

transient boolean swigCMemOwn
 

Detailed Description

A default request factory.

Applications need to derive from this class and must re-implement the function mvIMPACT.acquire.RequestFactory.createRequest to work with custom objects derived from mvIMPACT.acquire.Request.

Deriving from mvIMPACT.acquire.Request can be useful when a certain device driver or device offers a custom feature that is returned as part of the request object that can not be accessed using the mvIMPACT.acquire.Request class offered by this interface.

This shows how a request factory could be used to create custom request objects from within a mvIMPACT::acquire::FunctionInterface instance.

MyRequest.java:

import mvIMPACT.acquire.*;
//-----------------------------------------------------------------------------
// Example for a derived request object. It doesn't introduce new functionality
// but rebinds an existing property. Custom properties could bound in a similar
// way.
class MyRequest extends Request
//-----------------------------------------------------------------------------
{
private PropertyI myRequestResult_ = new PropertyI();
private void init()
{
DeviceComponentLocator locator = new DeviceComponentLocator( getComponentLocator().hObj() );
locator.bindComponent( myRequestResult_, "Result" );
}
protected MyRequest( Device pDev, int requestNr )
{
super( pDev, requestNr );
init();
}
// Without this constructor this whole 'RequestFactory' concept will not work
// at the moment as in 'FunctionInterface.getRequest' the internal correctly
// constructed 'MyRequest' generated via the director class and 'MyRequestFactory'
// will be used to create a new 'Request' instance from it. We now use this to
// re-create yet another 'MyRequest' instance from that which is kind of silly
// but in Python we have a very similar effect(see corresponding snippet in the Python manual).
//
// Maybe there is a better way to do this! Suggestions welcome!
public MyRequest( Request pRequest )
{
super( Request.getCPtr( pRequest ), false );
init();
}
public PropertyI getMyRequestResult()
{
return myRequestResult_;
}
}
boolean bindComponent(Component access, String name, int searchMode, int maxSearchDepth)
Binds an access object to an internal driver object.
Definition ComponentLocatorBase.java:114
A class to locate components within the driver.
Definition DeviceComponentLocator.java:139
This class and its functions represent an actual device detected by this interface in the current sys...
Definition Device.java:52
A template class to represent 32 bit integer properties and 32 bit enumerated integer properties.
Definition PropertyI.java:18
Contains information about a captured buffer.
Definition Request.java:32

MyRequestFactory.java:

import mvIMPACT.acquire.*;
//-----------------------------------------------------------------------------
// Example for a factory that creates 'MyRequest' instances
class MyRequestFactory extends RequestFactory
//-----------------------------------------------------------------------------
{
@Override
public Request createRequest( Device pDev, int requestNr )
{
return new MyRequest( pDev, requestNr );
}
}
A default request factory.
Definition RequestFactory.java:248

Now the request factory must be passed to the constructor of the function interface! This might happen in some other source file or class within the application.

//-----------------------------------------------------------------------------
void fn( Device pDev )
//-----------------------------------------------------------------------------
{
// ... some code ...
MyRequestFactory mrf = new MyRequestFactory();
FunctionInterface fi = new FunctionInterface( pDev, mrf );
// ... more additional code
// assuming we got back a request from the driver at this point:
Request pRequest = fi.getRequest( getRequestNrFromSomewhere() );
if( pRequest->isOK() )
{
System.out.println( String.format( "%s: %s", ( ( MyRequest )pRequest ).getMyRequestResult().name(), ( ( MyRequest )pRequest ).getMyRequestResult().readS() );
// do what you want to do with your derived request instance here!
}
// ... probably even more additional code
}
The function interface to devices supported by this interface.
Definition FunctionInterface.java:34
Request getRequest(int nr)
Returns a pointer to the desired mvIMPACT.acquire.Request.
Definition FunctionInterface.java:473
boolean isOK()
Convenience function to check if a request has been processed successfully.
Definition Request.java:494
Since
1.12.56

Constructor & Destructor Documentation

◆ RequestFactory() [1/2]

RequestFactory ( long cPtr,
boolean cMemoryOwn )
protected

◆ RequestFactory() [2/2]

Member Function Documentation

◆ createRequest()

Request createRequest ( Device arg0,
int arg1 )

◆ delete()

synchronized void delete ( )

◆ finalize()

void finalize ( )
protected

◆ swigDirectorDisconnect()

void swigDirectorDisconnect ( )
protected

◆ swigRelease()

static long swigRelease ( RequestFactory obj)
staticprotected

◆ swigReleaseOwnership()

void swigReleaseOwnership ( )

◆ swigTakeOwnership()

void swigTakeOwnership ( )

Member Data Documentation

◆ swigCMemOwn

transient boolean swigCMemOwn
protected