Vuo 2.4.4
Loading...
Searching...
No Matches
VuoCompilerGenericType.cc
Go to the documentation of this file.
1
11#include "VuoGenericType.hh"
12
13
15const string VuoCompilerGenericType::defaultBackingTypeName = "VuoInteger";
16
17
22{
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
37VuoCompilerGenericType::VuoCompilerGenericType(VuoGenericType *baseType, VuoCompilerType *backingType)
38 : VuoCompilerType(backingType->getBase()->getModuleKey(), backingType->getModule())
39{
40 setBase(baseType);
41 baseType->setCompiler(this);
42}
43
54string VuoCompilerGenericType::chooseBackingTypeName(string genericTypeName, vector<string> compatibleTypeNames)
55{
56 return (! compatibleTypeNames.empty() ?
57 compatibleTypeNames.front() :
58 VuoGenericType::replaceInnermostGenericTypeName(genericTypeName, defaultBackingTypeName));
59}
60
65{
66 VuoGenericType *baseType = static_cast<VuoGenericType *>(getBase());
68 return chooseBackingTypeName(baseType->getModuleKey(), baseType->getCompatibleSpecializedTypes(compatibility));
69}