forked from ahmidou/SpliceAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFabricSplice.h
4618 lines (3775 loc) · 147 KB
/
FabricSplice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2010-2013 Fabric Engine Inc. All rights reserved.
#ifndef __FabricSplice_H__
#define __FabricSplice_H__
/*SPHINX:index
.. _SPLICECAPI:
|FABRIC_PRODUCT_NAME| Splice C/C++ API Documentation
=======================================================
.. image:: /images/Splice/Splice_logo.png
:width: 360px
:height: 64px
| |FABRIC_PRODUCT_NAME| version |FABRIC_VERSION|
| |FABRIC_COPYRIGHT|
Table of Contents
-----------------
.. toctree::
:maxdepth: 2
intro
helloworld
functions
classes
Indices and Tables
------------------
* :ref:`genindex`
* :ref:`search`
*/
/*SPHINX:intro
Introduction
============
.. note:: You can find the source code for the SpliceAPI here: http://github.com/fabric-engine/SpliceAPI
The Fabric:Splice C/C++ API, referred to as :dfn:`SPLICECAPI` in this document, is an abstraction layer to the `Fabric Core CAPI <http://documentation.fabric-engine.com/CreationPlatform/latest/HTML/CAPIProgrammingGuide/index.html>`_. The SPLICEAPI provides a simpler way to integrate Fabric Core based functionality into C/C++ hosts applications and wraps lots of the rudimentary facilities. The :dfn:`SPLICECAPI` also supports additional facilities, such as persistence, for example.
Aside from this documentation API you can find a general description of how to integrate Splice into a host application here: :ref:`SPLICEINTEGRATION`. This also includes recommendations for build settings and C defines.
One API, Two Interfaces
-----------------------
:dfn:`SPLICECAPI` is implemented as a pure C API with a thin, inlined C++ interface that makes it easier to use in C++ applications. This is done to minimize linking issues, as the C linking interface on the platforms that Fabric:Splice supports is much more controlled than the C++ linking interface. The C++ interface is thus purely a C++ programmer convenience; however, it is a big programmer convenience, and as such it is recommended that you use the C++ language interface when possible. Both interfaces link with exactly the same shared library (DLL).
Since the host application targeted with the :dfn:`SPLICECAPI` are mainly C++ based, when discussing the API in this guide, we will only present the C++ version.
*/
/*SPHINX:helloworld
Hello World
============
The sample below shows the most basic use of the SPLICECAPI. This can be used to test the library and establish the right linker settings etc.
.. code-block:: c++
#include <FabricSplice.h>
using namespace FabricSplice;
int main( int argc, const char* argv[] )
{
Initialize();
// create a graph
DGGraph graph = DGGraph("myGraph");
// construct a single DG node
graph.constructDGNode();
// create an operator
std::string klCode = "";
klCode += "operator helloWorldOp() {\n";
klCode += " report('Hello World from KL!');\n";
klCode += "}\n";
graph.constructKLOperator("helloWorldOp", klCode.c_str());
// // evaluate the graph
graph.evaluate();
Finalize();
return 0;
}
*/
/*SPHINX:classes
.. _classes:
Classes
========================
All Fabric:Splice C++ classes are implemented within the :dfn:`FabricSplice` namespace.
.. toctree::
:maxdepth: 1
logging
exception
dggraph
dgport
scenemanagement
scripting
klparser
*/
/*SPHINX:functions
.. _functions:
Global functions
=========================
The SPLICECAPI provides several global functions. These can be used to initialize the use of the library as well as control the licensing aspects of Fabric:Splice.
.. code-block:: c++
namespace FabricSplice
{
// Initialize needs to be called before calling into
// any other functionality of the SPLICECAPI.
void Initialize();
// Finalize needs to be called whenever the host application
// is finished with accessing the SPLICECAPI.
void Finalize();
// Returns the Core Version number as a string
char const * GetCoreVersion();
// Returns the Splice Version number as a string
char const * GetSpliceVersion();
// Constructs a FabricCore client
FabricCore::Client ConstructClient(int guarded = -1, FabricCore::ClientOptimizationType optType = FabricCore::ClientOptimizationType_Background);
// Destroys a FabricCore client
bool DestroyClient(bool force = false);
// returns the ID for the client-context used by splice
char const * GetClientContextID();
// isLicenseValid returns true if the Creation Platform
// license on the current running host is valid. This may
// be resolving a network floating or a standalone license.
bool isLicenseValid();
// setLicenseServer can be called with the name and port
// of the RLM license server on the network.
void setLicenseServer(const char * serverName);
// setStandaloneLicense can be called with the
// standalone license text to setup the license
// on the current running host.
void setStandaloneLicense(const char * license);
// addExtFolder can be used to add paths to KL extension
// resolval mechanism. First the folders listed in the
// FABRIC_EXTS_PATH variable will be checked, followed
// by the list of folders defined through this function.
bool addExtFolder(const char * folder)
// creates a RTVal just given a KL type name
FabricCore::RTVal constructRTVal(const char * rt);
// creates a RTVal given a KL type name and construction args
FabricCore::RTVal constructRTVal(const char * rt, uint32_t nbArgs, const FabricCore::RTVal * args);
// creates a RTVal just given a KL object name
FabricCore::RTVal constructObjectRTVal(const char * rt);
// creates a RTVal given a KL object name and construction args
FabricCore::RTVal constructObjectRTVal(const char * rt, uint32_t nbArgs, const FabricCore::RTVal * args);
// creates a KL interface RTVal given a KL object to cast
FabricCore::RTVal constructInterfaceRTVal(const char * rt, const FabricCore::RTVal & object);
// creates a Boolean RTVal given its value
FabricCore::RTVal constructBooleanRTVal(bool value);
// creates a SInt8 RTVal given its value
FabricCore::RTVal constructSInt8RTVal(int8_t value);
// creates a SInt16 RTVal given its value
FabricCore::RTVal constructSInt16RTVal(int16_t value);
// creates a SInt32 RTVal given its value
FabricCore::RTVal constructSInt32RTVal(int32_t value);
// creates a SInt64 RTVal given its value
FabricCore::RTVal constructSInt64RTVal(int64_t value);
// creates a UInt8 RTVal given its value
FabricCore::RTVal constructUInt8RTVal(uint8_t value);
// creates a UInt16 RTVal given its value
FabricCore::RTVal constructUInt16RTVal(uint16_t value);
// creates a UInt32 RTVal given its value
FabricCore::RTVal constructUInt32RTVal(uint32_t value);
// creates a UInt64 RTVal given its value
FabricCore::RTVal constructUInt64RTVal(uint64_t value);
// creates a Float32 RTVal given its value
FabricCore::RTVal constructFloat32RTVal(float value);
// creates a Float64 RTVal given its value
FabricCore::RTVal constructFloat64RTVal(double value);
// creates a Data RTVal given its value
FabricCore::RTVal constructDataRTVal(void *value);
// creates a String RTVal given its value
FabricCore::RTVal constructStringRTVal(const char * value);
// creates a variable array RTVal given its type
FabricCore::RTVal constructVariableArrayRTVal(const char * rt);
// creates an external array RTVal given its type, nbElements and the void pointer
FabricCore::RTVal constructExternalArrayRTVal(const char * rt, uint32_t nbElements, void * data);
};
*/
/*SPHINX:logging
.. _logging:
FabricSplice::Logging
=========================
The Logging class provides static methods to redirect the log outputs of the SPLICECAPI. This includes output for KL report statements, KL queueStatusMessage statements as well as KL errors and compiler errors. Furthermore this class provides helper functions for profiling, measuring time and getting access to internal timers. Please refer to the 08_profiling sample in the api samples for an example of that.
Example
---------------------------------
The sample below shows how to use log redirection.
.. code-block:: c++
#include <FabricSplice.h>
using namespace FabricSplice;
void myLogFunc(const char * message, unsigned int length)
{
printf("[MyCallback] %s\n", message);
}
void myLogErrorFunc(const char * message, unsigned int length)
{
printf("[MyCallback] Error: %s\n", message);
}
void myCompilerErrorFunc(
unsigned int row,
unsigned int col,
const char * file,
const char * level,
const char * desc
) {
printf("[MyCallback] KL Error: %s, Line %d, Col %d: %s\n", file, (int)row, (int)col, desc);
}
void myKLReportFunc(const char * message, unsigned int length)
{
printf("[MyCallback] KL Reports: %s\n", message);
}
void myKLStatusFunc(const char * topic, unsigned int topicLength, const char * message, unsigned int messageLength)
{
printf("[MyCallback] KL Status for '%s': %s\n", topic, message);
}
int main( int argc, const char* argv[] )
{
Initialize();
// setup the callback functions
Logging::setLogFunc(myLogFunc);
Logging::setLogErrorFunc(myLogErrorFunc);
Logging::setCompilerErrorFunc(myCompilerErrorFunc);
Logging::setKLReportFunc(myKLReportFunc);
Logging::setKLStatusFunc(myKLStatusFunc);
// create a graph
DGGraph graph = DGGraph("myGraph");
// create a DG node
graph.constructDGNode();
// create a member
graph.addDGNodeMember("value", "Vec3");
// create a port
DGPort port = graph.addDGPort("value", "value", Port_Mode_IO);
// create an op
graph.constructKLOperator("testOp");
// on purpose create a compiler error
try
{
graph.setKLOperatorSourceCode("testOp", "operator testOp(Vec3 value) {adsadsd;}");
}
catch(Exception e)
{
printf("Caught error: %s\n", e.what());
}
// update the operator to report from KL
graph.setKLOperatorSourceCode("testOp", "operator testOp() { report('my message');}");
// evaluate will invoke all operators
// and in this case also call the myKLReportFunc
graph.evaluate();
// update the operator to send a status update from KL
graph.setKLOperatorSourceCode("testOp", "operator testOp() { queueStatusMessage('info', 'nothing going on!');}");
// evaluate will invoke all operators
// and in this case also call the myKLStatusFunc
graph.evaluate();
Finalize();
return 0;
}
Class Outline
---------------------------------
.. code-block:: c++
namespace FabricSplice
{
typedef void(*LoggingFunc)(const char * message, unsigned int messageLength);
typedef void(*CompilerErrorFunc)(unsigned int row, unsigned int col, const char * file, const char * level, const char * desc);
typedef void(*StatusFunc)(const char * topic, unsigned int topicLength, const char * message, unsigned int messageLength);
class Logging
{
public:
// sets the callback for generic log messages
static void setLogFunc(LoggingFunc func);
// sets the callback for error log messages
static void setLogErrorFunc(LoggingFunc func);
// sets the callback for KL compiler error messages
static void setCompilerErrorFunc(CompilerErrorFunc func);
// sets the callback for KL report statements
static void setKLReportFunc(LoggingFunc func);
// sets the callback for KL queueStatusMessage statements
static void setKLStatusFunc(StatusFunc func);
// enable timers
static void enableTimers();
// disable timers
static void disableTimers();
// reset a timer
static void resetTimer(const char * name);
// start a timer
static void startTimer(const char * name);
// stop a timer and accumulate the time
static void stopTimer(const char * name);
// log a given timer
static void logTimer(const char * name);
// return the number of existing timers
static unsigned int getNbTimers();
// return the name of a specific timer
char const * getTimerName(unsigned int index);
// a timer which records time on construction and destruction
class AutoTimer
{
public:
AutoTimer(const char * name);
~AutoTimer();
private:
std::string mName;
};
};
};
*/
/*SPHINX:klparser
.. _klparser:
FabricSplice::KLParser
=========================
The KLParser class provides functionality to parse KL files. It also implements sub-classes for accessing contextual symbols for constants, structs, operators and functions. Using the :ref:`klparser` you can implement code completion tools, analytic tools for KL code, doxygen style documentation generation tools etc.
.. note:: The KLParser will be deprecated after 1.13.0 and replaced by a proper AST representation.
Example
---------------------------------
The sample below shows how to use the :ref:`klparser` for iterating over all defined symbols within a KL file.
.. code-block:: c++
#include <FabricSplice.h>
using namespace FabricSplice;
int main( int argc, const char* argv[] )
{
std::string klCode;
klCode += "struct MyType {\n";
klCode += " Float32 x;\n";
klCode += " Float32 y;\n";
klCode += "}\n";
klCode += "\n";
klCode += "function MyType(Float64 x, Float64 y) {\n";
klCode += " this.x = x;\n";
klCode += " this.y = y;\n";
klCode += "}\n";
KLParser parser = KLParser::getParser("MyType", "MyType", klCode.c_str());
for(unsigned int j=0;j<parser.getNbKLSymbols();j++)
{
KLParser::KLSymbol s = parser.getKLSymbol(j);
printf("%03d: '%s' '%s'\n", (int)i, s.typeName(), s.str().c_str());
}
return 0;
}
Class Outline
---------------------------------
.. code-block:: c++
namespace FabricSplice
{
class KLParser
{
public:
class KLSymbol
{
public:
enum Type {
Type_none,
Type_separator,
Type_semicolon,
Type_comma,
Type_period,
Type_comment,
Type_firstkeyword,
Type_in,
Type_io,
Type_if,
Type_else,
Type_switch,
Type_case,
Type_default,
Type_for,
Type_while,
Type_do,
Type_break,
Type_continue,
Type_this,
Type_alias,
Type_require,
Type_return,
Type_const,
Type_function,
Type_operator,
Type_struct,
Type_object,
Type_interface,
Type_lastkeyword,
Type_rt,
Type_name,
Type_number,
Type_string,
Type_assignment,
Type_arithmetic,
Type_brace1,
Type_brace2,
Type_bracket1,
Type_bracket2,
Type_curly1,
Type_curly2,
Type_pex1,
Type_pex2,
Type_maxtypes
};
public:
// copy constructor
KLSymbol(KLSymbol const & other);
// copy operator
KLSymbol & operator =( KLSymbol const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the index of this symbol
unsigned int index() const;
// returns the char position within the code
unsigned int pos() const;
// returns the length of this symbol
unsigned int length() const;
// returns the type of this symbol
Type type() const;
// returns true of this symbol is a keyword
bool isKeyword() const;
// returns
const char * typeName() const;
// returns a char from the front (given an index);
char front(unsigned int index = 0) const;
// returns a char from the back (given an index);
char back(unsigned int index = 0) const;
// returns the contained string
std::string str() const;
// returns true if this contains a given char
bool contains(char c) const;
// returns the index of a given char, or UINT_MAX if not found
unsigned int find(char c) const;
// returns the previous symbol before this one, or an invalid one
KLSymbol prev(bool skipComments = true, unsigned int offset = 1) const;
// returns the next symbol after this one, or an invalid one
KLSymbol next(bool skipComments = true, unsigned int offset = 1) const;
// returns the name of the parser this symbol belongs to
const char * parser() const;
};
class KLConstant
{
public:
// copy constructor
KLConstant(KLConstant const & other);
// copy operator
KLConstant & operator =( KLConstant const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the symbol of this KLConstant
KLSymbol symbol() const;
// returns the comments of this KLConstant
const char * comments() const;
// returns the type of this KLConstant
const char * type() const;
// returns the name of this KLConstant
const char * name() const;
// returns the value of this KLConstant
const char * value() const;
};
class KLVariable
{
public:
// copy constructor
KLVariable(KLVariable const & other);
// copy operator
KLVariable & operator =( KLVariable const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the symbol of this KLVariable
KLSymbol symbol() const;
// returns the type of this KLVariable
const char * type() const;
// returns the name of this KLVariable
const char * name() const;
};
class KLStruct
{
public:
// copy constructor
KLStruct(KLStruct const & other);
// copy operator
KLStruct & operator =( KLStruct const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the symbol of this KLStruct
KLSymbol symbol() const;
// returns the comments of this KLStruct
const char * comments() const;
// returns the type of this KLStruct
const char * type() const;
// returns the name of this KLStruct
const char * name() const;
// returns number of interfaces in this KLStruct
unsigned int nbInterfaces() const;
// returns name of an interface of a given index
const char * getInterface(unsigned int index) const;
// returns number of members in this KLStruct
unsigned int nbMembers() const;
// returns the type of a member of this KLStruct with a given index
const char * memberType(unsigned int index) const;
// returns the type of a member of this KLStruct with a given index
const char * memberName(unsigned int index) const;
};
class KLArgumentList
{
public:
// copy constructor
KLArgumentList(KLArgumentList const & other);
// copy operator
KLArgumentList & operator =( KLArgumentList const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns number of arguments in this KLArgumentList
unsigned int nbArgs() const;
// returns the mode of an argument with a given index
const char * mode(unsigned int index) const;
// returns the type of an argument with a given index
const char * type(unsigned int index) const;
// returns the name of an argument with a given index
const char * name(unsigned int index) const;
};
class KLOperator
{
public:
// copy constructor
KLOperator(KLOperator const & other);
// copy operator
KLOperator & operator =( KLOperator const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the symbol of this KLOperator
KLSymbol symbol() const;
// returns the comments of this KLOperator
const char * comments() const;
// returns the name of this KLOperator
const char * name() const;
// returns true if this KLOperator uses a PEX notation
bool isPex() const;
// returns the pexArgument of this KLOperator
const char * pexArgument() const;
// returns the argument list of this KLOperator
KLArgumentList arguments() const;
// returns the symbol starting the body of this KLOperator
KLSymbol bodyStart() const;
// returns the symbol ending the body of this KLOperator
KLSymbol bodyEnd() const;
};
class KLFunction
{
public:
// copy constructor
KLFunction(KLFunction const & other);
// copy operator
KLFunction & operator =( KLFunction const & other );
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the symbol of this KLFunction
KLSymbol symbol() const;
// returns the comments of this KLFunction
const char * comments() const;
// returns the type of this KLFunction (or "" if it is a void);
const char * type() const;
// returns the name of this KLFunction
const char * name() const;
// returns the owner of this KLFunction (or "" if it's not a method);
const char * owner() const;
// returns the argument list of this KLFunction
KLArgumentList arguments() const;
// returns the symbol starting the body of this KLFunction
KLSymbol bodyStart() const;
// returns the symbol ending the body of this KLFunction
KLSymbol bodyEnd() const;
};
class KLInterface
{
public:
// returns the symbol of this KLInterface
KLSymbol symbol() const;
// returns the comments of this KLInterface
const char * comments() const;
// returns the name of this KLInterface
const char * name() const;
// returns the number of functions on this KLInterface
unsigned int nbFunctions() const;
// returns a function of this KLInterface by index
KLFunction function(unsigned int index) const;
};
// default constructor
KLParser();
// copy constructor
KLParser(KLParser const & other);
// copy operator
KLParser & operator =( KLParser const & other );
// default destructor
~KLParser();
// returns true if the object is valid
bool isValid() const;
// bool conversion operator
operator bool() const;
// returns the owner of the parser
const char * owner() const ;
// returns the name of the parser
const char * name() const ;
// returns the contained sourcecode of the parser
const char * code() const ;
// returns the number of current parsers
static unsigned int getNbParsers();
// returns a parser given an index
static KLParser getParser(unsigned int index);
// returns a parser given a name an optional klCode
// if the parser doesn't exist yet - it will be created.
static KLParser getParser(const char * owner, const char * name, const char * klCode = NULL);
// parse new KL code in this parser
bool parse(const char * klCode);
// returns the number of KL symbols
unsigned int getNbKLSymbols() const;
// returns a specific KL symbol
KLSymbol getKLSymbol(unsigned int symbolIndex) const;
// returns the symbol for a special character index in the KL code
KLSymbol getKLSymbolFromCharIndex(unsigned int charIndex) const;
// returns the number of required KL types / extensions
unsigned int getNbKLRequires() const;
// returns the name of the required KL type / extension given an index
const char * getKLRequire(unsigned int index) const;
// returns the number of KL constants
unsigned int getNbKLConstants() const;
// returns the KL constant given an index
KLConstant getKLConstant(unsigned int index) const;
// returns the number of KL variables
unsigned int getNbKLVariables() const;
// returns the KL variable given an index
KLVariable getKLVariable(unsigned int index) const;
// returns the number of KL interfaces
unsigned int getNbKLInterfaces() const;
// returns the KL interface given an index
KLInterface getKLInterface(unsigned int index) const;
// returns the number of KL structs / objects
unsigned int getNbKLStructs() const;
// returns the KL struct / object given an index
KLStruct getKLStruct(unsigned int index) const;
// returns the number of KL operators
unsigned int getNbKLOperators() const;
// returns the KL operator given an index
KLOperator getKLOperator(unsigned int index) const;
// returns the number of KL functions / methods
unsigned int getNbKLFunctions() const;
// returns the KL function given an index
KLFunction getKLFunction(unsigned int index) const;
// returns the KL type for a given name symbol (or "" if unknown)
const char * getKLTypeForSymbol(const KLSymbol & symbol) const;
// returns the KL type for a member or method below a given owner type
static const char * getKLTypeForSymbol(const char * owner, const char * member);
};
};
*/
/*SPHINX:scenemanagement
.. _scenemanagement:
FabricSplice::SceneManagement
===============================
The SceneManagement class provides static methods to perform certain scene management related tasks, such as draw all drawable :ref:`dgport` object, as well deal with interactive manipulation.
Class Outline
---------------------------------
.. code-block:: c++
namespace FabricSplice
{
struct ManipulationData {
int event;
void * userData;
const char * graphName;
const char * portName;
const FabricCore::RTVal * manipulationContext;
const FabricCore::RTVal * manipulationResult;
};
typedef int(*ManipulationFunc)(ManipulationData * data);
class SceneManagement
{
public:
// sets the callback for manipulation
static void setManipulationFunc(ManipulationFunc func);
// returns true if there is anything to render
static bool hasRenderableContent();
// draw all drawable ports
// ensure to only call this with a valid
// OpenGL context set, otherwise it might
// cause instabilities
static void drawOpenGL(FabricCore::RTVal & drawContext);
// raycast against all raycastable objects
static bool raycast(FabricCore::RTVal & raycastContext, DGPort & port);
};
};
*/
/*SPHINX:scripting
.. _scripting:
FabricSplice::Scripting
===============================
The Scripting class provides static methods for parsing script arguments. This can be useful within Splice integrations. Options are provided as json strings typically, and the following helper functions simplify parsing these.
Class Outline
---------------------------------
.. code-block:: c++
namespace FabricSplice
{
class Scripting
{
public:
// decodes a flat list of scripting arguments into a dictionary of
// argument values. this also assume one of the arguments (index 1 or 2)
// to contain a json structure with additional values
static FabricCore::Variant parseScriptingArguments(const char * action, const char * reference, const char * data, const char * auxiliary);
// returns a bool argument of a given parsed dictionary
static bool consumeBooleanArgument(FabricCore::Variant & argsDict, const char * name, bool defaultValue = false, bool optional = false);
// returns a int argument of a given parsed dictionary
static int consumeIntegerArgument(FabricCore::Variant & argsDict, const char * name, int defaultValue = 0, bool optional = false);
// returns a float argument of a given parsed dictionary
static float consumeScalarArgument(FabricCore::Variant & argsDict, const char * name, float defaultValue = 0.0, bool optional = false);
// returns a string argument of a given parsed dictionary (string variant)
static std::string consumeStringArgument(FabricCore::Variant & argsDict, const char * name, const char * defaultValue = "", bool optional = false);
// returns a variant argument of a given parsed dictionary
static FabricCore::Variant consumeVariantArgument(FabricCore::Variant & argsDict, const char * name, const FabricCore::Variant & defaultValue = FabricCore::Variant(), bool optional = false);
};
};
*/
/*SPHINX:exception
.. _exception:
FabricSplice::Exception
=========================
The Exception is used to catch any errors happening within Fabric:Splice or the Fabric Core from a host application. You may wrap any call to the :dfn:`SPLICECAPI` like this:
Example
---------------------------------