ProcedureDeclaration Class Reference

#include <Pt/JsonRpc/ProcedureDeclaration.h>

Maps parameter names to positional indices for named parameters. More...

Public Member Functions

 ProcedureDeclaration ()
 Default constructor.
 
void setParamName (std::size_t index, const std::string &name)
 Register a parameter name at a positional index.
 
int getParamIndex (const std::string &name) const
 Lookup positional index by parameter name. More...
 
const std::string & getParamName (std::size_t index) const
 Lookup parameter name by positional index. More...
 
std::size_t paramCount () const
 Returns the number of named parameters.
 
bool hasNames () const
 Returns true if any parameter names are registered.
 

Detailed Description

JSON-RPC 2.0 allows parameters to be passed as a JSON object with named keys. The ProcedureDeclaration maps each name to its positional index so the Responder can dispatch named parameters to the correct Composer.

Member Function Documentation

◆ getParamIndex()

int getParamIndex ( const std::string &  name) const
Returns
The index, or -1 if not found.

◆ getParamName()

const std::string& getParamName ( std::size_t  index) const
Returns
The name, or an empty string if index is out of range.