Halide
halide_cplusplus_type_name Struct Reference

A set of types to represent a C++ function signature. More...

#include <Type.h>

Public Types

enum  CPPTypeType {
  Simple, Struct, Class, Union,
  Enum
}
 An enum to indicate whether a C++ type is non-composite, a struct, class, or union. More...
 

Public Member Functions

 halide_cplusplus_type_name (CPPTypeType cpp_type_type, const std::string &name)
 
bool operator== (const halide_cplusplus_type_name &rhs) const
 
bool operator!= (const halide_cplusplus_type_name &rhs) const
 
bool operator< (const halide_cplusplus_type_name &rhs) const
 

Public Attributes

enum halide_cplusplus_type_name::CPPTypeType cpp_type_type
 
std::string name
 

Detailed Description

A set of types to represent a C++ function signature.

This allows two things. First, proper prototypes can be provided for Halide generated functions, giving better compile time type checking. Second, C++ name mangling can be done to provide link time type checking for both Halide generated functions and calls from Halide to external functions.

These are intended to be constexpr producable.

halide_handle_traits has to go outside the Halide namespace due to template resolution rules. TODO(zalman): Do all types need to be in global namespace? A structure to represent the (unscoped) name of a C++ composite type for use as a single argument (or return value) in a function signature.

Currently does not support the restrict qualifier, references, or r-value references. These features cannot be used in extern function calls from Halide or in the generated function from Halide, but their applicability seems limited anyway.

Although this is in the global namespace, it should be considered "Halide Internal" and subject to change; code outside Halide should avoid referencing it.

Definition at line 39 of file Type.h.

Member Enumeration Documentation

◆ CPPTypeType

An enum to indicate whether a C++ type is non-composite, a struct, class, or union.

Enumerator
Simple 

"int"

Struct 

"struct Foo"

Class 

"class Foo"

Union 

"union Foo"

Enum 

"enum Foo"

Definition at line 41 of file Type.h.

Constructor & Destructor Documentation

◆ halide_cplusplus_type_name()

halide_cplusplus_type_name::halide_cplusplus_type_name ( CPPTypeType  cpp_type_type,
const std::string &  name 
)
inline

Definition at line 51 of file Type.h.

Member Function Documentation

◆ operator==()

bool halide_cplusplus_type_name::operator== ( const halide_cplusplus_type_name rhs) const
inline

Definition at line 55 of file Type.h.

References cpp_type_type, and name.

◆ operator!=()

bool halide_cplusplus_type_name::operator!= ( const halide_cplusplus_type_name rhs) const
inline

Definition at line 60 of file Type.h.

◆ operator<()

bool halide_cplusplus_type_name::operator< ( const halide_cplusplus_type_name rhs) const
inline

Definition at line 64 of file Type.h.

References cpp_type_type, and name.

Member Data Documentation

◆ cpp_type_type

enum halide_cplusplus_type_name::CPPTypeType halide_cplusplus_type_name::cpp_type_type

Referenced by operator<(), and operator==().

◆ name

std::string halide_cplusplus_type_name::name

Definition at line 49 of file Type.h.

Referenced by halide_handle_cplusplus_type::make(), operator<(), and operator==().


The documentation for this struct was generated from the following file: