source: js/sdk/js_interface/js_interface.idl @ 927

Last change on this file since 927 was 918, checked in by Maciej Komosinski, 5 years ago

Created global LoggerToStdout? object so that all messages emitted by SDK loggers will be printf()'ed and consequently will appear in the JS console

File size: 14.3 KB
Line 
1interface IRange {
2        attribute long begin;
3        attribute long end;
4};
5
6interface MultiRange {
7        long rangeCount();
8        [Value] IRange getRange(long i);
9};
10
11interface SingleMapping {
12        attribute long begin;
13        [Value] attribute MultiRange to;
14};
15
16interface MultiMap {
17        void MultiMap();
18        SingleMapping getMapping(long i);
19        long rangeCount();
20        [Value] MultiRange map([Ref] MultiRange ranges);
21        void addCombined([Ref, Const] MultiMap m1, [Ref, Const] MultiMap m2);
22        void addReversed([Ref, Const] MultiMap m);
23};
24
25interface SString {
26        void SString();
27        [Operator = "="] void set([Const] DOMString ch);
28        [Const] DOMString c_str();
29};
30
31interface GenMan {
32        void GenMan();
33        void setDefaults();
34        [Value] string HTMLize([Const] DOMString g);
35        [Value] string HTMLizeShort([Const] DOMString g);
36};
37
38interface GlyphLoader {
39        void GlyphLoader();
40        [Const] DOMString getStringifiedGlyph(NeuroClass cl);
41};
42
43interface PreconfiguredGenetics {
44        void PreconfiguredGenetics();
45        [Value] attribute DefaultGenoConvManager gcm;
46        [Value] attribute GenMan genman;
47        [Value] attribute Validators validators;
48        [Value] attribute ModelGenoValidator model_validator;
49};
50
51interface string {
52        void string();
53        [Const] DOMString c_str();
54};
55
56interface SList {
57        void SList();
58        VoidPtr get(long i);
59        long size();
60};
61
62interface Pt3D {
63        attribute double x;
64        attribute double y;
65        attribute double z;
66        void Pt3D();
67};
68
69interface Orient
70{
71        [Value] attribute Pt3D x;
72        [Value] attribute Pt3D y;
73        [Value] attribute Pt3D z;
74
75        void Orient();
76        void Orient([Const, Ref] Pt3D a, [Const, Ref] Pt3D b, [Const, Ref] Pt3D c);
77
78        void rotate([Const, Ref] Pt3D rot);
79
80        [Value] Pt3D transform([Const, Ref] Pt3D src);
81        [Value] Pt3D revTransform([Const, Ref] Pt3D src);
82
83        void transformSelf([Const, Ref] Orient rot);
84        void revTransformSelf([Const, Ref] Orient rot);
85
86        [Value] Pt3D getAngles();
87        void lookAt([Const, Ref] Pt3D X, [Const, Ref] Pt3D dir);
88
89        boolean normalize();
90};
91
92enum Part_Shape {
93        "Part::SHAPE_BALL_AND_STICK",
94        "Part::SHAPE_ELLIPSOID",
95        "Part::SHAPE_CUBOID",
96        "Part::SHAPE_CYLINDER"
97};
98
99interface Part {
100        attribute long refno;
101        [Value] attribute Pt3D p;
102        [Value] attribute Orient o;
103        [Value] attribute Pt3D rot;
104        attribute double mass;
105        attribute double size;
106        attribute double density;
107        attribute double friction;
108        attribute double ingest;
109        attribute double assim;
110        attribute double hollow;
111        [Value] attribute Pt3D scale;
112        [Value] attribute Pt3D vcolor;
113        attribute double vsize;
114        attribute long shape;
115
116        void Part(optional Part_Shape s = "Part::SHAPE_BALL_AND_STICK");
117
118        void setPositionAndRotationFromAxis([Const, Ref] Pt3D p1, [Const, Ref] Pt3D p2);
119        void setOrient([Const, Ref] Orient o);
120        void setRot([Const, Ref] Pt3D r);
121
122        MultiRange getMapping();
123
124        //TODO: Extra properties
125};
126
127enum Joint_Shape {
128        "Joint::SHAPE_BALL_AND_STICK",
129        "Joint::SHAPE_FIXED"
130};
131
132interface Joint {
133        void Joint();
134        //paInt p1_refno,p2_refno;
135
136        attribute Part part1;
137        attribute Part part2;
138        [Value] attribute Pt3D d;
139        [Value] attribute Pt3D rot;
140
141        void attachToParts(Part p1, Part p2);
142        void resetDelta();
143        void useDelta(boolean use);
144        boolean isDelta();
145
146        attribute long refno;
147        attribute double stamina;
148        attribute double stif;
149        attribute double rotstif;
150        [Value] attribute Orient o;
151        attribute boolean usedelta;
152        [Value] attribute Pt3D vcolor;
153
154        attribute long shape;
155
156        MultiRange getMapping();
157};
158
159interface NeuroClass {
160        void NeuroClass();
161        [Const, Ref] SString getName();
162        long getVisualHints();
163};
164
165enum NeuroClass_Hint {
166        "NeuroClass::Invisible",
167        "NeuroClass::DontShowClass",
168        "NeuroClass::AtFirstPart",
169        "NeuroClass::AtSecondPart",
170        "NeuroClass::EffectorClass",
171        "NeuroClass::ReceptorClass",
172        "NeuroClass::V1BendMuscle",
173        "NeuroClass::V1RotMuscle",
174        "NeuroClass::LinearMuscle"
175};
176
177interface Neuro {
178        void Neuro();
179        void Neuro(double _state, double _inertia, double _force, double _sigmo);
180
181        attribute long refno;
182        void setInputInfo(long i, [Const, Ref] SString name, [Const, Ref] SString value);
183        [Value] SString getInputInfo(long i);
184        [Value] SString getInputInfo(long i, [Const, Ref] SString name);
185        NeuroClass getClass();
186        void setClass(NeuroClass clazz);
187        [Value] SString getClassParams();
188        void setClassParams([Const, Ref] SString cp);
189        [Value] SString getClassName();
190        void setClassName([Const, Ref] SString clazz);
191        [Value] SString getDetails();
192        void setDetails([Const, Ref] SString details);
193
194        void attachToPart(Part p);
195        void attachToJoint(Joint j);
196        Part getPart();
197        Joint getJoint();
198
199        boolean isOldEffector();
200        boolean isOldReceptor();
201        boolean isOldNeuron();
202        boolean isNNConnection();
203
204        long getInputCount();
205        long getOutputsCount();
206
207        Neuro getInput(long i);
208        double getInputWeight(long i);
209        void setInputWeight(long i, double weight);
210        void setInput(long i, Neuro n);
211        void setInput(long i, Neuro n, double weight);
212        long addInput(Neuro child, double weight, [Const] SString info);
213        long findInput(Neuro child);
214        void removeInput(long refno);
215
216        long findInputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
217        long findOutputs([Ref] SList result, [Const] DOMString classname, [Const] Part part, [Const] Joint joint);
218
219        MultiRange getMapping();
220};
221
222interface GenoValidator {
223};
224
225interface ModelGenoValidator : GenoValidator {
226        void ModelGenoValidator();
227};
228
229interface GenoConvManager {
230};
231
232interface DefaultGenoConvManager : GenoConvManager {
233        void DefaultGenoConvManager();
234        void addDefaultConverters();
235};
236
237[Prefix = "Geno::"]
238interface Validators {
239        void Validators();
240        void append(GenoValidator data);
241};
242
243interface Geno {
244        void Geno();
245        void Geno([Const, Ref] SString fullString);
246        void Geno([Const] DOMString genstring, byte genformat, [Const] DOMString genname, [Const] DOMString comment);
247        boolean isValid();
248        byte getFormat();
249        [Value] SString getGenes();
250        static Validators useValidators(Validators val);
251        static GenoConvManager useConverters(GenoConvManager gcm);
252};
253
254enum ModelBuildStatus {
255        "empty",
256        "building",
257        "invalid",
258        "valid"
259};
260
261enum Model_ShapeType {
262        "Model::SHAPE_UNKNOWN",
263        "Model::SHAPE_ILLEGAL",
264        "Model::SHAPE_BALL_AND_STICK",
265        "Model::SHAPE_SOLIDS"
266};
267
268interface Model {
269        [Value] attribute Pt3D size;
270        [Value] attribute SString vis_style;
271        attribute double startenergy;
272
273        void Model();
274        void Model([Ref, Const] Geno newgeno, optional boolean buildmaps = false);
275
276        [Value] MultiMap getMap();
277        [Const, Value] MultiMap getF0Map();
278        void getCurrentToF0Map([Ref] MultiMap m);
279
280        ModelBuildStatus getStatus();
281        boolean isValid();
282        long getErrorPosition(boolean includingwarnings);
283        Model_ShapeType getShapeType();
284        void updateRefno();
285        [Const, Value] Geno getF0Geno();
286        void makeGeno([Ref] Geno geno);
287        void setGeno([Const, Ref] Geno newgeno);
288        void setValidationLevel(long level);
289        [Value] Pt3D whereDelta([Const, Ref] Part start, [Const, Ref] Pt3D rot, [Const, Ref] Pt3D delta);
290        void resetAllDelta();
291        void useAllDelta(boolean yesno);
292        boolean validate();
293
294        long getPartCount();
295        Part getPart(long i);
296
297        long getJointCount();
298        Joint getJoint(long i);
299
300        long getNeuroCount();
301        long getConnectionCount();
302        Neuro getNeuro(long i);
303
304        Part addPart(Part p);
305        Joint addJoint(Joint j);
306        Neuro addNeuro(Neuro n);
307
308        Part addNewPart(Part_Shape shape);
309        Joint addNewJoint(Part p1, Part p2, Joint_Shape shape);
310        Neuro addNewNeuro();
311
312        void removePart(long partindex, optional long removeattachedjoints = 1, optional long removeattachedneurons = 1);
313        void removeJoint(long  jointindex, optional long removeattachedneurons = 1);
314        void removeNeuro(long  neuroindex, optional boolean removereferences = true);
315        void removeNeuros([Ref] SList nlist);
316
317        long findPart(Part p);
318        long findJoint(Joint j);
319        long findNeuro(Neuro nu);
320        long findJoint(Part p1, Part p2);
321
322        long findNeuros([Ref] SList result, DOMString classname, [Const] Part part, [Const] Joint joint);
323        long findJoints([Ref] SList result, [Const] Part part);
324
325        void move([Const, Ref] Pt3D shift);
326        void rotate([Const, Ref] Orient rotation);
327        void buildUsingSolidShapeTypes([Const, Ref] Model src_old_shapes, optional Part_Shape default_shape = "Part::SHAPE_CYLINDER", optional float thickness = 0.2);
328
329        void open();
330        void close();
331        void rebuild(boolean buildmaps);
332        void rebuild([Const, Ref] Geno newgeno, boolean buildmaps);
333        void clear();
334        [Const, Value] Geno getGeno();
335};
336
337interface GenotypeMini {
338        void GenotypeMini();
339        [Value] attribute SString name;
340        [Value] attribute SString genotype;
341        [Value] attribute SString info;
342        void clear();
343};
344
345interface GenotypeMiniLoader {
346        void GenotypeMiniLoader([Const] DOMString filename);
347        GenotypeMini loadNextGenotype();
348};
349
350[NoDelete]
351interface StdioFileSystem_autoselect {
352        void StdioFileSystem_autoselect();
353};
354
355
356interface LoggerBase {
357        void LoggerBase(optional long opts = 0);
358};
359
360enum LoggerBase_LoggerOptions {
361        "LoggerBase::DontBlock",
362        "LoggerBase::CannotBeBlocked",
363        "LoggerBase::Enable",
364        "LoggerBase::Paused"
365};
366
367interface LoggerToMemory
368{
369        void LoggerToMemory(long opts, optional long minimal_level_to_store = 2);
370
371        void reset();
372        long getErrorCount();
373        long getWarningCount();
374        long getInfoCount();
375        long getStoredCount();
376        long getErrorLevel();
377        [Value] string getMessages();
378        [Value] string getCountSummary();
379        void handle([Const] DOMString obj, [Const] DOMString method, long level, [Const] DOMString msg);
380};
381
382enum LoggerToMemory_Options2 {
383        "LoggerToMemory::StoreFirstMessage",
384        "LoggerToMemory::StoreAllMessages"
385};
386
387interface LoggerToStdout {
388        void LoggerToStdout(optional long opts = 0, optional VirtFILE ffile);
389};
390
391
392interface VirtFILE {
393};
394
395interface SaveFileHelper {
396        void SaveFileHelper();
397        VirtFILE Vfopen([Const] DOMString path, [Const] DOMString mode);
398        ParamEntry getMinigenotype_paramtab();
399};
400
401interface XY {
402        void XY(long x, long y);
403        attribute long x;
404        attribute long y;
405};
406
407interface XYWH : XY {
408        void XYWH(long x, long y, long w, long h);
409        attribute long x;
410        attribute long y;
411        attribute long w;
412        attribute long h;
413};
414
415interface NNLayoutState {
416};
417
418interface NNLayoutState_Model : NNLayoutState {
419};
420
421interface NNLayoutState_Model_Fred : NNLayoutState_Model {
422        void NNLayoutState_Model_Fred(Model m);
423        long GetElements();
424        [Value] XYWH GetValueXYWH(long el);
425        void SetXYWH(long el, long x, long y, long w, long h);
426        long GetInputs(long el);
427        long GetLink(long el, long i);
428        [Value] XY GetLinkValueXY(long el, long i);
429};
430
431interface NNLayoutFunctionHelper {
432        void NNLayoutFunctionHelper();
433        void doLayout(long layout_type, NNLayoutState nn_layout);
434};
435
436interface GenoOperators {
437        void GenoOperators();
438        // TODO: static long roulette(const double *probtab, long count);
439        long checkValidity([Const] DOMString geno, [Const] DOMString genoname);
440        long validate(DOMString geno, [Const] DOMString genoname);
441        [Value] SString getSimplest();
442};
443
444interface Geno_f4 : GenoOperators {
445        void Geno_f4();
446};
447
448interface Geno_fH : GenoOperators {
449        void Geno_fH();
450};
451
452interface Geno_fB : GenoOperators {
453        void Geno_fB();
454};
455
456interface Geno_fL : GenoOperators {
457        void Geno_fL();
458};
459
460interface GenoOper_f9 : GenoOperators {
461        void GenoOper_f9();
462};
463
464interface GenoOper_fF : GenoOperators {
465        void GenoOper_fF();
466};
467
468interface GenoOperatorsHelper {
469        void GenoOperatorsHelper(GenoOperators genoOper);
470        long mutate([Const] DOMString geno);
471        long crossOver([Const] DOMString geno1, [Const] DOMString geno2);
472        [Value] SString getLastMutateGeno();
473        [Value] SString getLastCrossGeno1();
474        [Value] SString getLastCrossGeno2();
475};
476
477interface ParamEntry {
478};
479
480interface ParamInterface {
481        long getGroupCount();
482        long getPropCount();
483        [Const] DOMString getName();
484        [Const] DOMString getDescription();
485        long findId([Const] DOMString n);
486        long findIdn([Const] DOMString naz, long n);
487        [Const] DOMString type(long i);
488        [Const] DOMString help(long i);
489        long flags(long i);
490        long group(long i);
491        [Const] DOMString grname(long gi);
492        [Value] SString get(long i);
493        [Value] SString getString(long i);
494        long getInt(long i);
495        double getDouble(long i);
496
497        [Value] SString getStringById([Const] DOMString prop);
498        long getIntById([Const] DOMString prop);
499        double getDoubleById([Const] DOMString prop);
500
501        long setIntFromString(long i, [Const] DOMString str, boolean strict);
502        long setDoubleFromString(long i, [Const] DOMString str);
503
504        long setInt(long i, long val);
505        long setDouble(long i, double val);
506        long setString(long i, [Const, Ref] SString str);
507
508        long setFromString(long i, [Const] DOMString str, boolean strict);
509
510        long setIntById([Const] DOMString prop, long value);
511        long setDoubleById([Const] DOMString prop, double value);
512        long setStringById([Const] DOMString prop, [Const] DOMString value);
513
514        //long getMinMaxInt(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
515        //long getMinMaxDouble(long prop, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
516        //long getMinMaxString(long prop, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
517        //
518        //static long getMinMaxIntFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] long def);
519        //static long getMinMaxDoubleFromTypeDef([Const] DOMString type, [Ref] double minimum, [Ref] double maximum, [Ref] double def);
520        //static long getMinMaxStringFromTypeDef([Const] DOMString type, [Ref] long minimum, [Ref] long maximum, [Ref] SString def);
521
522        void setDefault();
523        void setDefault(long i);
524
525        void setMin();
526        void setMax();
527        void setMin(long i);
528        void setMax(long i);
529
530        [Value] static SString friendlyTypeDescrFromTypeDef([Const] DOMString type);
531        [Value] SString friendlyTypeDescr(long i);
532
533        void copyFrom(ParamInterface src);
534        void quickCopyFrom(ParamInterface src);
535
536        //long save(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
537
538        static boolean isValidTypeDescription([Const] DOMString t);
539};
540
541interface SimpleAbstractParam : ParamInterface {
542
543};
544
545interface Param : SimpleAbstractParam {
546        void Param(ParamEntry t, VoidPtr o);
547        //long save(VirtFILE file, [Const] DOMString altname, optional boolean force = false);
548};
549
550[Prefix = "ParamTree::"]
551interface NodePtr {
552        ParamTreeNode get();
553};
554
555[Prefix = "ParamTree::"]
556interface ParamTreeNode {
557        attribute ParamTree tree;
558        attribute ParamTreeNode parent;
559        [Value] attribute string name;
560        [Value] attribute NodePtr first_child;
561        [Value] attribute NodePtr next_sibling;
562        attribute long group_index;
563};
564
565interface ParamTree {
566        [Value] attribute ParamTreeNode root;
567        ParamTreeNode addNode(ParamTreeNode parent, [Ref, Const] string name, long group);
568        ParamTreeNode findNode(ParamTreeNode parent, [Ref, Const] string name);
569        void ParamTree(ParamInterface _pi);
570};
571
572interface MutableParamList : ParamInterface {
573
574};
575
576interface ParamTreeConfigured {
577        void ParamTreeConfigured();
578        attribute ParamTree tree;
579        [Value] attribute MutableParamList paramiface;
580        ParamTree generateTree();
581};
Note: See TracBrowser for help on using the repository browser.