libqasm
library for handling cQASM files
Public Member Functions | List of all members
cqasm::v1::resolver::FunctionTable Class Reference

Table of all overloads of all constant propagation functions. More...

Public Member Functions

 FunctionTable ()
 
 ~FunctionTable ()
 
 FunctionTable (const FunctionTable &t)
 
 FunctionTable (FunctionTable &&t)
 
FunctionTableoperator= (const FunctionTable &t)
 
FunctionTableoperator= (FunctionTable &&t)
 
void add (const std::string &name, const types::Types &param_types, const FunctionImpl &impl)
 Registers a function. More...
 
values::Value call (const std::string &name, const values::Values &args) const
 Calls a function. More...
 

Detailed Description

Table of all overloads of all constant propagation functions.

Definition at line 79 of file cqasm-v1-resolver.hpp.

#include <cqasm-v1-resolver.hpp>

Constructor & Destructor Documentation

◆ FunctionTable() [1/3]

cqasm::v1::resolver::FunctionTable::FunctionTable ( )

Definition at line 216 of file cqasm-v1-resolver.cpp.

◆ ~FunctionTable()

cqasm::v1::resolver::FunctionTable::~FunctionTable ( )

Definition at line 217 of file cqasm-v1-resolver.cpp.

◆ FunctionTable() [2/3]

cqasm::v1::resolver::FunctionTable::FunctionTable ( const FunctionTable t)

Definition at line 218 of file cqasm-v1-resolver.cpp.

◆ FunctionTable() [3/3]

cqasm::v1::resolver::FunctionTable::FunctionTable ( FunctionTable &&  t)

Definition at line 219 of file cqasm-v1-resolver.cpp.

Member Function Documentation

◆ operator=() [1/2]

FunctionTable & cqasm::v1::resolver::FunctionTable::operator= ( const FunctionTable t)

Definition at line 220 of file cqasm-v1-resolver.cpp.

◆ operator=() [2/2]

FunctionTable & cqasm::v1::resolver::FunctionTable::operator= ( FunctionTable &&  t)

Definition at line 224 of file cqasm-v1-resolver.cpp.

◆ add()

void cqasm::v1::resolver::FunctionTable::add ( const std::string &  name,
const types::Types param_types,
const FunctionImpl impl 
)

Registers a function.

The name should be lowercase; matching will be done case-insensitively. The param_types variadic specifies the amount and types of the parameters that (this particular overload of) the function expects. The C++ implementation of the function can assume that the value list it gets is of the right size and the values are of the right types.

This method does not contain any intelligence to override previously added overloads. However, the overload resolution engine will always use the last applicable overload it finds, so adding does have the effect of overriding.

Definition at line 242 of file cqasm-v1-resolver.cpp.

◆ call()

Value cqasm::v1::resolver::FunctionTable::call ( const std::string &  name,
const values::Values args 
) const

Calls a function.

Throws NameResolutionFailure if no function by the given name exists, OverloadResolutionFailure if no overload of the function exists for the given arguments, or otherwise returns the value returned by the function.

Definition at line 252 of file cqasm-v1-resolver.cpp.


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