Jamoma API  0.6.0.a19
TTFoundation.cpp
1 /*
2  * Jamoma Foundation
3  * Copyright © 2008, Timothy Place
4  *
5  * License: This code is licensed under the terms of the "New BSD License"
6  * http://creativecommons.org/licenses/BSD/
7  */
8 
9 #include "TTFoundation.h"
10 #include "TTSymbolTable.h"
11 #include "TTEnvironment.h"
12 #include "TTSymbolCache.h"
13 #include "TTCallback.h"
14 #include "TTExtensionLoader.h"
15 
16 // Nodelib currently requires Boost Regex, which we don't have on the iOS
17 #ifndef DISABLE_NODELIB
18 #include "TTNodeLib.h"
19 #endif
20 
21 // Unit Tests
22 #include "TTMatrixBase.h"
23 #include "TTMatrixArray.h"
24 #include "TTObject.test.h"
25 #include "TTInterpolate.test.h"
26 #include "TTRegex.test.h"
27 #include "TTString.test.h"
28 #include "TTSymbol.test.h"
29 #include "TTValue.test.h"
30 #include "TTDictionary.test.h"
31 #include "TTList.test.h"
32 // Nodelib currently requires Boost Regex, which we don't have on the iOS
33 #ifndef DISABLE_NODELIB
34 #include "TTNodeLib.test.h"
35 #endif
36 
37 
38 TTString TTFoundationBinaryPath = "";
39 
40 static bool TTFoundationHasInitialized = false;
41 
42 TTObjectBasePtr TTFoundationInstantiateInternalClass(TTSymbol className, TTValue& arguments);
43 
44 /****************************************************************************************************/
45 void TTFoundationInit(const char* pathToBinaries, bool loadFromOtherPaths)
46 {
47  if (!TTFoundationHasInitialized) {
48  TTFoundationHasInitialized = true;
49 
50  if (pathToBinaries)
51  TTFoundationBinaryPath = pathToBinaries;
52 
53  for (int i=0; i<kNumTTDataTypes; i++)
54  TTDataInfo::addDataInfoForType(TTDataType(i));
55 
56  // Regex requires Boost libraries, not available for iOS for the time-being
57 #ifndef DISABLE_NODELIB
58  TTNodeLibInit();
59 #endif
60 
62 
63  // Regex requires Boost libraries, not available for iOS for the time-being
64  //#ifndef DISABLE_NODELIB
65  // TTAddressCacheInit();
66  //#endif
67 
68 #ifdef TT_DEBUG
69  TTLogMessage("JamomaFoundation (TT_DEBUG) -- Version %s", TTFOUNDATION_VERSION_STRING);
70  ttEnvironment->mDebugBasic = true;
71 #else
72  TTLogMessage("JamomaFoundation -- Version %s", TTFOUNDATION_VERSION_STRING);
73 #endif
74  if (pathToBinaries)
75  TTLogMessage("-- Path %s\n", pathToBinaries);
76  else
77  TTLogMessage("\n");
78 
79  // register classes -- both internal and external
80  TTCallback::registerClass();
81  TTMatrixBase::registerClass();
82  TTMatrixArray::registerClass();
83  TTObjectTest::registerClass();
84  TTRegexTest::registerClass();
85  TTStringTest::registerClass();
86  TTSymbolTest::registerClass();
87  TTValueTest::registerClass();
88  TTInterpolateTest::registerClass();
89  TTDictionaryTest::registerClass();
90  TTListTest::registerClass();
91  // Regex requires Boost libraries, not available for iOS for the time-being
92 #ifndef DISABLE_NODELIB
93  TTNodeLibTest::registerClass();
94 #endif
95 
96  TTLoadExtensions(pathToBinaries, loadFromOtherPaths);
97  }
98 }
99 
100 void TTFoundationShutdown();
101 void TTFoundationShutdown()
102 {
103  // FIXME: How do we call this (i.e. TTDSPShutdown()?) -- do we need to setup an observer of some sort on the environment class?
104  // TODO: we need to free singletons like the environment here!
105 
106  // Note : it is possible to do this using atexit();
107 }
108 
2-dimensional matrix of compound values with N elements each.
TTFOUNDATION_EXPORT TTEnvironment * ttEnvironment
The environment object has one instance, which is global in scope.
TTDataType
TTBlue Data Types Enumeration of data types used through out TTBlue, including the TTValue class and ...
Definition: TTBase.h:269
Base class for all first-class Jamoma objects.
Definition: TTObjectBase.h:109
TTDictionaryTest is an class used for unit tests of the TTDictionary class.
TTInterpolateTest is an class used for unit tests of the interpolation algorithms in #TTInterpolate...
This class is used to create a backward communication channel to notify a client that something chang...
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
TTBoolean mDebugBasic
Attribute: Basic debug functionality is enabled when true.
Definition: TTEnvironment.h:53
TTEnvironment is a global object providing information on the environemt.
void TTFOUNDATION_EXPORT TTLogMessage(TTImmutableCString message,...)
Platform and host independent method for posting log messages.
Definition: TTBase.cpp:534
TTValueTest is an class used for unit tests of the TTValue class.
TTListTest is an class used for unit tests of the #TTList class.
The TTString class is used to represent a string.
Definition: TTString.h:34
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
The global object maintains all global attributes/settings for the Jamoma environment.
Definition: TTEnvironment.h:47