Itasca C++ Interface
Loading...
Searching...
No Matches
fishexample.h
Go to the documentation of this file.
1#pragma once
8#include "fish/interface/ifishlibrary.h"
9using namespace itasca;
10
25class FishExample : public IFishLibrary {
26public:
35 };
36
43 FishExample(uint id,const QString &name,int numArguments,const QString &returnDescription,
44 bool readOnly=true,const QString &argumentDescription=QString::null);
46 virtual QStringList createIntrinsics(IFish *fish);
48 virtual QStringList createTypes(IFish *,bool) {return QStringList();}
50 virtual void get(IProgram *prog,uint id,const IFishArguments *reg,IFishParam *p);
52 virtual void set(IProgram *prog,uint id,const IFishArguments *reg,const IFishParam *p);
53
55 virtual uint getID() const { return id_; }
57 virtual uint getSubID() const { return 0; }
59 virtual IString getName() const { return name_; }
61 virtual QString getPluginName() const;
63 virtual bool getReadOnly() const { return readOnly_; }
65 virtual int getNumArguments() const { return numArguments_; }
67 virtual QString getReturnDesc() const { return returnDescription_; }
69 virtual QString getArgumentDesc() const { return argumentDescription_; }
72 virtual bool willSave() const { return getID() ? false : true; }
74 virtual void archiveLibrary(IArchive &a);
75 virtual void saveLibrary(Archive2 &a) const override;
76 virtual bool restoreLibrary(Archive2 &a,quint64 label) override;
77 virtual void remapLibrary(Archive2 &a) override;
79 virtual void reset();
81 virtual void destroy() { delete this; }
82private:
83 uint id_;
84 QString name_;
85 int numArguments_;
86 QString returnDescription_;
87 bool readOnly_;
88 QString argumentDescription_;
89
90 static uint version_;
91 static Double frequency_;
92 static Double amplitude_;
93 static Double phase_;
94 static Double interval_;
95 static qptrdiff number_;
96};
98// EoF
Example implementation of the IFishLibrary interface.
Definition fishexample.h:25
Functions
This enum is used to define ID numbers for the seven different FISH functions.
Definition fishexample.h:28
@ IntervalFunction
example_int ID number
Definition fishexample.h:31
@ FreqFunction
example_freq ID number
Definition fishexample.h:28
@ AmpFunction
example_amp ID number
Definition fishexample.h:29
@ CreateFunction
example_create ID number
Definition fishexample.h:34
@ AllFunction
example_all ID number
Definition fishexample.h:33
@ NumberFunction
example_num ID number
Definition fishexample.h:32
@ PhaseFunction
example_phase ID number
Definition fishexample.h:30
virtual QStringList createTypes(IFish *, bool)
This example does not create any type, thus returns an empty QStringList.
Definition fishexample.h:48
virtual IString getName() const
Returns the name of this intrinsic.
Definition fishexample.h:59
virtual uint getSubID() const
Returns a sub ID for automatically generated version of functions under a general ID....
Definition fishexample.h:57
virtual uint getID() const
Returns the ID number of this particular instance of the library class, must be unique for each intri...
Definition fishexample.h:55
virtual QString getArgumentDesc() const
Returns a string describing the argument types, used for help only.
Definition fishexample.h:69
virtual void destroy()
Destroys this particular instace of the library, representing this intrinsic.
Definition fishexample.h:81
virtual QString getReturnDesc() const
Returns a string describing the return type, used for help only.
Definition fishexample.h:67
virtual int getNumArguments() const
Returns the number of arguments the intrinsic requires, or -1 if that number may vary.
Definition fishexample.h:65
virtual bool getReadOnly() const
Returns TRUE if the intrinsic may not appear on the left-hand-side of an assignment.
Definition fishexample.h:63
virtual bool willSave() const
Definition fishexample.h:72
Definition istring.h:14
The main program access point.
Definition iprogram.h:37
virtual void reset()
Clears data to the default settings, when a NEW Model is created.
Definition fishexample.cpp:204
virtual void set(IProgram *prog, uint id, const IFishArguments *reg, const IFishParam *p)
Called if the intrinsic appears on the left-hand-side of an assignment.
Definition fishexample.cpp:152
FishExample(uint id, const QString &name, int numArguments, const QString &returnDescription, bool readOnly=true, const QString &argumentDescription=QString::null)
Definition fishexample.cpp:73
virtual void archiveLibrary(IArchive &a)
Saves/Restores data to the archive.
Definition fishexample.cpp:163
virtual QStringList createIntrinsics(IFish *fish)
Creates 7 instances of this class for each intrinsic, and registers them, then calls delete this.
Definition fishexample.cpp:88
virtual QString getPluginName() const
Name identifying the plugin that is adding possibly many intrinsics.
Definition fishexample.cpp:80
virtual void get(IProgram *prog, uint id, const IFishArguments *reg, IFishParam *p)
Called if the intrinsic appears on the right-hand-side of an assignment.
Definition fishexample.cpp:105
namespace Itasca
Definition basememory.cpp:14