Vuo 2.4.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
VuoGenericType Class Reference

Description

A generic port type.

The generic type is a placeholder until the port is specialized (i.e., its type is replaced) with a non-generic type.

Definition at line 19 of file VuoGenericType.hh.

Public Types

enum  Compatibility { anyType , anyListType , whitelistedTypes }
 Descriptions of the specialized types with which a generic type is compatible. More...
 

Public Member Functions

 VuoGenericType (string typeName, vector< string > compatibleSpecializedTypes)
 Creates a generic type.
 
bool isSpecializedTypeCompatible (const string &typeName)
 Returns true if this generic type is allowed to be specialized with the given type.
 
bool isGenericTypeCompatible (VuoGenericType *otherType)
 Returns true if this generic type has any compatible specialized types in common with the given generic type.
 
vector< string > getCompatibleSpecializedTypes (Compatibility &compatibility)
 Returns a set of the non-generic types compatible with the given type, or an empty set if all types or all list types are compatible.
 
- Public Member Functions inherited from VuoType
 VuoType (string typeName)
 Creates a type.
 
virtual ~VuoType (void)
 to make this class dynamic_cast-able
 
- Public Member Functions inherited from VuoBase< VuoCompilerType, void >
 VuoBase (string id)
 Creates a base class.
 
void setCompiler (VuoCompilerType *compiler)
 Sets the base class instance's compiler detail class instance.
 
VuoCompilerTypegetCompiler (void) const
 Returns the base class instance's compiler detail class instance.
 
bool hasCompiler (void) const
 Returns true if this base class instance has a compiler detail.
 
void setRenderer (void *renderer)
 Sets the base class instance's renderer detail class instance.
 
void * getRenderer (void) const
 Returns the base class instance's renderer detail class instance.
 
bool hasRenderer (void) const
 Returns true if this base class instance has a renderer detail.
 
- Public Member Functions inherited from VuoModule
 VuoModule (string moduleKey)
 Creates a module.
 
string getModuleKey (void)
 Returns this module's unique name.
 
void setModuleKey (string moduleKey)
 Sets this module's unique name.
 
string getDefaultTitle (void)
 Returns the default title for instances of this module, as specified by the .vuonode/.bc implementation.
 
string getDefaultTitleWithoutSuffix (void)
 Returns the default title, with the optional parenthetical suffix removed.
 
void setDefaultTitle (string defaultTitle)
 Sets the default title for instances of this module.
 
string getDescription (void)
 Returns the description given in the module's metadata, or if none is given, the description found in a separate file in the module's node set.
 
void setDescription (string description)
 Sets the description of this module provided as documentation.
 
string getVersion (void)
 Returns the module's version, in Semantic Versioning format.
 
void setVersion (string version)
 Sets the module's version, in Semantic Versioning format.
 
vector< string > getKeywords (void)
 Returns a list of the module's keywords.
 
void setKeywords (vector< string > keywords)
 Sets the module's keywords.
 
VuoNodeSetgetNodeSet (void)
 Returns the node set containing this module.
 
void setNodeSet (VuoNodeSet *nodeSet)
 Sets the node set containing this module.
 

Static Public Member Functions

static bool isGenericTypeName (string typeName)
 Returns true if the name has the format of a generic type name.
 
static vector< string > findGenericTypeNames (const string &stringToSearch)
 Finds all unique generic type names in stringToSearch.
 
static string replaceInnermostGenericTypeName (string genericTypeName, string replacementTypeName)
 Returns a type name created by replacing the innermost type name in genericTypeName (either the innermost item type if genericTypeName is a list type, or else genericTypeName itself) with replacementTypeName.
 
static bool replaceGenericTypeNamesInString (string &stringToSearch, const map< string, string > &specializedForGenericTypeName, vector< string > &orderedGenericTypeNames)
 Finds each generic type name from specializedForGenericTypeName in stringToSearch and replaces it with the corresponding specialized type name from specializedForGenericTypeName.
 
static string createGenericTypeName (unsigned int suffix)
 Creates a generic type name by appending the given numerical suffix.
 
static void sortGenericTypeNames (vector< string > &genericTypeNames)
 Puts the list of generic type names in ascending order of their numerical suffix.
 
- Static Public Member Functions inherited from VuoType
static bool isTypeName (const string &potentialTypeName)
 Returns true if potentialTypeName has the format of a type's module key.
 
static bool isListTypeName (const string &typeName)
 Returns true if the type name is for a list type.
 
static bool isDictionaryTypeName (const string &typeName)
 Returns true if the type name is for a dictionary type.
 
static string extractInnermostTypeName (const string &typeName)
 If the type name is a list (or list of lists, etc.), returns the innermost item type name.
 

Additional Inherited Members

- Static Public Attributes inherited from VuoType
static const string listTypeNamePrefix = "VuoList_"
 The common beginning of all VuoList type names (before the item type name).
 
static const string dictionaryTypeNamePrefix = "VuoDictionary_"
 The common beginning of all VuoDictionary type names (before the key and value type names).
 

Member Enumeration Documentation

◆ Compatibility

Descriptions of the specialized types with which a generic type is compatible.

Enumerator
anyType 

Compatible with any specialized singleton type.

anyListType 

Compatible with any specialized VuoList type.

whitelistedTypes 

Compatible only with certain types.

Definition at line 25 of file VuoGenericType.hh.

Constructor & Destructor Documentation

◆ VuoGenericType()

VuoGenericType::VuoGenericType ( string  typeName,
vector< string >  compatibleSpecializedTypes 
)

Creates a generic type.

Definition at line 20 of file VuoGenericType.cc.

Member Function Documentation

◆ createGenericTypeName()

string VuoGenericType::createGenericTypeName ( unsigned int  suffix)
static

Creates a generic type name by appending the given numerical suffix.

Definition at line 254 of file VuoGenericType.cc.

◆ findGenericTypeNames()

vector< string > VuoGenericType::findGenericTypeNames ( const string &  stringToSearch)
static

Finds all unique generic type names in stringToSearch.

Definition at line 127 of file VuoGenericType.cc.

◆ getCompatibleSpecializedTypes()

vector< string > VuoGenericType::getCompatibleSpecializedTypes ( Compatibility compatibility)

Returns a set of the non-generic types compatible with the given type, or an empty set if all types or all list types are compatible.

Parameters
[out]compatibilityIf the returned set is empty, this becomes anyType or anyListType. Otherwise, this becomes whitelistedTypes.
See also
VuoModuleMetadata

Definition at line 103 of file VuoGenericType.cc.

◆ isGenericTypeCompatible()

bool VuoGenericType::isGenericTypeCompatible ( VuoGenericType otherType)

Returns true if this generic type has any compatible specialized types in common with the given generic type.

Definition at line 71 of file VuoGenericType.cc.

◆ isGenericTypeName()

bool VuoGenericType::isGenericTypeName ( string  typeName)
static

Returns true if the name has the format of a generic type name.

Definition at line 117 of file VuoGenericType.cc.

◆ isSpecializedTypeCompatible()

bool VuoGenericType::isSpecializedTypeCompatible ( const string &  typeName)

Returns true if this generic type is allowed to be specialized with the given type.

Definition at line 56 of file VuoGenericType.cc.

◆ replaceGenericTypeNamesInString()

bool VuoGenericType::replaceGenericTypeNamesInString ( string &  stringToSearch,
const map< string, string > &  specializedForGenericTypeName,
vector< string > &  orderedGenericTypeNames 
)
static

Finds each generic type name from specializedForGenericTypeName in stringToSearch and replaces it with the corresponding specialized type name from specializedForGenericTypeName.

This function searches for the longest matching generic type name. For example, if stringToSearch is VuoGenericType11_fun and specializedForGenericTypeName contains both VuoGenericType1 and VuoGenericType11, then the substring VuoGenericType11 will be replaced.

For orderedGenericTypeNames, pass an empty vector on the first call and the same (modified) vector on any subsequent calls that use the same specializedForGenericTypeName.

Definition at line 227 of file VuoGenericType.cc.

◆ replaceInnermostGenericTypeName()

string VuoGenericType::replaceInnermostGenericTypeName ( string  genericTypeName,
string  replacementTypeName 
)
static

Returns a type name created by replacing the innermost type name in genericTypeName (either the innermost item type if genericTypeName is a list type, or else genericTypeName itself) with replacementTypeName.

Definition at line 204 of file VuoGenericType.cc.

◆ sortGenericTypeNames()

void VuoGenericType::sortGenericTypeNames ( vector< string > &  genericTypeNames)
static

Puts the list of generic type names in ascending order of their numerical suffix.

Definition at line 264 of file VuoGenericType.cc.


The documentation for this class was generated from the following files: