Itasca C++ Interface
Loading...
Searching...
No Matches
Classes | Functions
Example implementation of the IFishLibrary interface

Classes

class  FishExample
 Example implementation of the IFishLibrary interface. More...
 

Functions

int __stdcall DllMain (void *, unsigned, void *)
 This function is required by all DLLs. See Win32 documentation for details.
 
EXPORT_TAG const char * getName ()
 
EXPORT_TAG unsigned getMajorVersion ()
 
EXPORT_TAG unsigned getMinorVersion ()
 
EXPORT_TAG void * createInstance ()
 
 FishExample::FishExample (uint id, const QString &name, int numArguments, const QString &returnDescription, bool readOnly=true, const QString &argumentDescription=QString::null)
 
virtual QString FishExample::getPluginName () const
 Name identifying the plugin that is adding possibly many intrinsics.
 
virtual QStringList FishExample::createIntrinsics (IFish *fish)
 Creates 7 instances of this class for each intrinsic, and registers them, then calls delete this.
 
virtual void FishExample::get (IProgram *prog, uint id, const IFishArguments *reg, IFishParam *p)
 Called if the intrinsic appears on the right-hand-side of an assignment.
 
virtual void FishExample::set (IProgram *prog, uint id, const IFishArguments *reg, const IFishParam *p)
 Called if the intrinsic appears on the left-hand-side of an assignment.
 
virtual void FishExample::archiveLibrary (IArchive &a)
 Saves/Restores data to the archive.
 
virtual void FishExample::saveLibrary (Archive2 &a) const override
 
virtual bool FishExample::restoreLibrary (Archive2 &a, quint64 label) override
 
virtual void FishExample::remapLibrary (Archive2 &a) override
 
virtual void FishExample::reset ()
 Clears data to the default settings, when a NEW Model is created.
 

Detailed Description

Function Documentation

◆ createInstance()

EXPORT_TAG void * createInstance ( )

This functions should return a single new instance of the library class. The createIntrinsics() method is then called to register FISH intrinsics.

◆ DllMain()

int __stdcall DllMain ( void * ,
unsigned ,
void *  )

This function is required by all DLLs. See Win32 documentation for details.

The Itasca Plugin standard requires four functions be exported from the DLL. These are getName(), getMajorVersion(), getMinorVersion(), and createInstance(). These are described below:

◆ FishExample()

FishExample::FishExample ( uint id,
const QString & name,
int numArguments,
const QString & returnDescription,
bool readOnly = true,
const QString & argumentDescription = QString::null )

The contructor allows you to specify the id, name, argumenst, and other data associated with this particular intrinsic.
Recall that a separate instance of the library class is created for each intrinsic added.
Each separate intrinsic is identified by a unique ID number.
In this implementation, the intrinsic specific data is stored as members and assigned on construction.
Another valid implementation would be to store nothing locally but the ID and use CASE Statements (or similar) in the implementaion of getName(), getReadOnly(), etc.

◆ getMajorVersion()

EXPORT_TAG unsigned getMajorVersion ( )

Returns the major version number.
This number indicates binary compatibility, and must match with the number expected by the FISH DLL.

◆ getMinorVersion()

EXPORT_TAG unsigned getMinorVersion ( )

Returns a minor version number, used to indicate internal changes. The use may specific a minimum minor version required during the load command.

◆ getName()

EXPORT_TAG const char * getName ( )

Returns the name of the plugin, with a "fish" prefix.
This is used to verify that the plugin represents the library you intended, in case the filename was changed.