Loading...
Searching...
No Matches
SdfPredicateLibrary< DomainType > Class Template Reference

Represents a library of predicate functions for use with SdfPredicateExpression. More...

#include <predicateLibrary.h>

Public Types

using PredicateFunction = std::function< SdfPredicateFunctionResult(DomainType const &)>
 The type of a bound function, the result of binding passed arguments.
 

Public Member Functions

 SdfPredicateLibrary ()=default
 Default constructor produces an empty library.
 
 SdfPredicateLibrary (SdfPredicateLibrary &&other)=default
 Move-construct from an other library.
 
 SdfPredicateLibrary (SdfPredicateLibrary const &other)
 Copy-construct from an other library.
 
SdfPredicateLibraryoperator= (SdfPredicateLibrary &&other)=default
 Move-assignment from an other library.
 
SdfPredicateLibraryoperator= (SdfPredicateLibrary const &other)
 Copy-assignment from an other library.
 
template<class Fn >
SdfPredicateLibraryDefine (char const *name, Fn &&fn)
 Register a function with name name in this library.
 
template<class Fn >
SdfPredicateLibraryDefine (std::string const &name, Fn &&fn, NamesAndDefaults const &namesAndDefaults)
 Register a function with name name in this library.
 
template<class Fn >
SdfPredicateLibraryDefineBinder (std::string const &name, Fn &&fn)
 Register a custom binding function for name in this library.
 

Friends

SdfPredicateProgram< DomainType > SdfLinkPredicateExpression (SdfPredicateExpression const &expr, SdfPredicateLibrary const &lib)
 Link expr with lib and return a callable program that evaluates expr on given objects of the DomainType.
 

Detailed Description

template<class DomainType>
class SdfPredicateLibrary< DomainType >

Represents a library of predicate functions for use with SdfPredicateExpression.

Call SdfLinkPredicateExpression() with an expression and a library to produce a callable SdfPredicateProgram.

Definition at line 232 of file predicateLibrary.h.

Member Typedef Documentation

◆ PredicateFunction

using PredicateFunction = std::function<SdfPredicateFunctionResult (DomainType const &)>

The type of a bound function, the result of binding passed arguments.

Definition at line 243 of file predicateLibrary.h.

Constructor & Destructor Documentation

◆ SdfPredicateLibrary() [1/3]

SdfPredicateLibrary ( )
default

Default constructor produces an empty library.

◆ SdfPredicateLibrary() [2/3]

SdfPredicateLibrary ( SdfPredicateLibrary< DomainType > &&  other)
default

Move-construct from an other library.

◆ SdfPredicateLibrary() [3/3]

SdfPredicateLibrary ( SdfPredicateLibrary< DomainType > const &  other)
inline

Copy-construct from an other library.

Definition at line 253 of file predicateLibrary.h.

Member Function Documentation

◆ Define() [1/2]

SdfPredicateLibrary & Define ( char const *  name,
Fn &&  fn 
)
inline

Register a function with name name in this library.

The first argument must accept a DomainType instance. The remaining arguments must be convertible from bool, int, float, string.

Definition at line 279 of file predicateLibrary.h.

◆ Define() [2/2]

SdfPredicateLibrary & Define ( std::string const &  name,
Fn &&  fn,
NamesAndDefaults const &  namesAndDefaults 
)
inline

Register a function with name name in this library.

The first argument must accept a DomainType instance. The remaining arguments must be convertible from bool, int, float, string. Optional parameter names and default values may be supplied in namesAndDefaults.

Definition at line 289 of file predicateLibrary.h.

◆ DefineBinder()

SdfPredicateLibrary & DefineBinder ( std::string const &  name,
Fn &&  fn 
)
inline

Register a custom binding function for name in this library.

The function must take a single argument of type std::vector<SdfPredicateExpression::FnArg>. When invoked, it must attempt to bind the arguments passed in the vector and return a bound PredicateFunction object. If the arguments are invalid, return an empty PredicateFunction.

Definition at line 311 of file predicateLibrary.h.

◆ operator=() [1/2]

SdfPredicateLibrary & operator= ( SdfPredicateLibrary< DomainType > &&  other)
default

Move-assignment from an other library.

◆ operator=() [2/2]

SdfPredicateLibrary & operator= ( SdfPredicateLibrary< DomainType > const &  other)
inline

Copy-assignment from an other library.

Definition at line 267 of file predicateLibrary.h.

Friends And Related Function Documentation

◆ SdfLinkPredicateExpression

SdfPredicateProgram< DomainType > SdfLinkPredicateExpression ( SdfPredicateExpression const &  expr,
SdfPredicateLibrary< DomainType > const &  lib 
)
friend

Link expr with lib and return a callable program that evaluates expr on given objects of the DomainType.

If linking expr and lib fails, issue a TF_RUNTIME_ERROR with a message, and return an empty program.

Definition at line 165 of file predicateProgram.h.


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