HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyArg.h File Reference
#include "pxr/pxr.h"
#include "pxr/base/tf/api.h"
#include <hboost/python/dict.hpp>
#include <hboost/python/tuple.hpp>
#include <string>
#include <vector>
+ Include dependency graph for pyArg.h:

Go to the source code of this file.

Classes

class  TfPyArg
 

Typedefs

typedef std::vector< TfPyArgTfPyArgs
 

Functions

TF_API std::pair
< hboost::python::tuple,
hboost::python::dict > 
TfPyProcessOptionalArgs (const hboost::python::tuple &args, const hboost::python::dict &kwargs, const TfPyArgs &expectedArgs, bool allowExtraArgs=false)
 
TF_API std::string TfPyCreateFunctionDocString (const std::string &functionName, const TfPyArgs &requiredArguments=TfPyArgs(), const TfPyArgs &optionalArguments=TfPyArgs(), const std::string &description=std::string())
 

Typedef Documentation

typedef std::vector<TfPyArg> TfPyArgs

Definition at line 73 of file pyArg.h.

Function Documentation

TF_API std::string TfPyCreateFunctionDocString ( const std::string functionName,
const TfPyArgs requiredArguments = TfPyArgs(),
const TfPyArgs optionalArguments = TfPyArgs(),
const std::string description = std::string() 
)

Create a doc string for a function with the given functionName, requiredArguments and optionalArguments. An extra description may also be supplied.

TF_API std::pair<hboost::python::tuple, hboost::python::dict> TfPyProcessOptionalArgs ( const hboost::python::tuple &  args,
const hboost::python::dict &  kwargs,
const TfPyArgs expectedArgs,
bool  allowExtraArgs = false 
)

Helper function for processing optional arguments given as a tuple of positional arguments and a dictionary of keyword arguments.

This function will match the given positional arguments in args with the ordered list of allowed arguments in optionalArgs. Arguments that are matched up in this way will be stored as (name, value) pairs and merged with kwargs in the returned dictionary.

If allowExtraArgs is false, any unrecognized keyword or positional arguments will cause a Python TypeError to be emitted. Otherwise, unmatched arguments will be added to the returned tuple or dict.