Vuo
2.4.4
Loading...
Searching...
No Matches
compiler
VuoCompilerGenericType.cc
Go to the documentation of this file.
1
10
#include "
VuoCompilerGenericType.hh
"
11
#include "
VuoGenericType.hh
"
12
13
15
const
string
VuoCompilerGenericType::defaultBackingTypeName =
"VuoInteger"
;
16
17
21
VuoCompilerGenericType
*
VuoCompilerGenericType::newGenericType
(
VuoGenericType
*baseType, std::function<
VuoCompilerType
*(
const
string
&)> lookUpType)
22
{
23
VuoGenericType::Compatibility
compatibility;
24
vector<string> compatibleTypeNames = baseType->
getCompatibleSpecializedTypes
(compatibility);
25
string
backingTypeName =
VuoCompilerGenericType::chooseBackingTypeName
(baseType->
getModuleKey
(), compatibleTypeNames);
26
27
VuoCompilerType
*backingType = lookUpType(backingTypeName);
28
if
(! backingType)
29
return
NULL;
30
31
return
new
VuoCompilerGenericType
(baseType, backingType);
32
}
33
37
VuoCompilerGenericType::VuoCompilerGenericType(
VuoGenericType
*baseType,
VuoCompilerType
*backingType)
38
:
VuoCompilerType
(backingType->getBase()->getModuleKey(), backingType->getModule())
39
{
40
setBase
(baseType);
41
baseType->
setCompiler
(
this
);
42
}
43
54
string
VuoCompilerGenericType::chooseBackingTypeName
(
string
genericTypeName, vector<string> compatibleTypeNames)
55
{
56
return
(! compatibleTypeNames.empty() ?
57
compatibleTypeNames.front() :
58
VuoGenericType::replaceInnermostGenericTypeName
(genericTypeName, defaultBackingTypeName));
59
}
60
64
string
VuoCompilerGenericType::getBackingTypeName
(
void
)
65
{
66
VuoGenericType
*baseType =
static_cast<
VuoGenericType
*
>
(
getBase
());
67
VuoGenericType::Compatibility
compatibility;
68
return
chooseBackingTypeName
(baseType->
getModuleKey
(), baseType->
getCompatibleSpecializedTypes
(compatibility));
69
}
Generated on Thu Nov 9 2023 16:59:29 for Vuo by
1.9.8