Viam C++ SDK current
Loading...
Searching...
No Matches
Public Member Functions | List of all members
viam::sdk::ModuleService Class Reference

Defines the gRPC receiving logic for a module. C++ module authors can construct a ModuleService and use its associated methods to write a working C++ module. See examples under src/viam/examples/modules. More...

#include <service.hpp>

+ Inheritance diagram for viam::sdk::ModuleService:

Public Member Functions

 ModuleService (std::string addr)
 Creates a new ModuleService that can serve on the provided socket.
 
 ModuleService (int argc, char **argv, const std::vector< std::shared_ptr< ModelRegistration > > &registrations)
 Creates a new ModuleService. Socket path and log level will be inferred from passed in command line arguments, and passed in model registrations will be registered and added to module.
 
void serve ()
 Starts module. serve will return when SIGINT or SIGTERM is received (this happens when the RDK shuts down).
 
void add_model_from_registry (API api, Model model)
 Adds an API/model pair to the module; both the API and model should have already been registered. If the ModuleService was constructed with a vector of ModelRegistration, the passed in models will already be registered and added.
 

Detailed Description

Defines the gRPC receiving logic for a module. C++ module authors can construct a ModuleService and use its associated methods to write a working C++ module. See examples under src/viam/examples/modules.

Constructor & Destructor Documentation

◆ ModuleService() [1/2]

viam::sdk::ModuleService::ModuleService ( std::string addr)
explicit

Creates a new ModuleService that can serve on the provided socket.

Parameters
addrAddress of socket to serve on.

◆ ModuleService() [2/2]

viam::sdk::ModuleService::ModuleService ( int argc,
char ** argv,
const std::vector< std::shared_ptr< ModelRegistration > > & registrations )
explicit

Creates a new ModuleService. Socket path and log level will be inferred from passed in command line arguments, and passed in model registrations will be registered and added to module.

Parameters
argcNumber of arguments from command line.
argvArguments from command line.
registrationsModels to register and add to the module.

Member Function Documentation

◆ add_model_from_registry()

void viam::sdk::ModuleService::add_model_from_registry ( API api,
Model model )

Adds an API/model pair to the module; both the API and model should have already been registered. If the ModuleService was constructed with a vector of ModelRegistration, the passed in models will already be registered and added.

Parameters
apiThe API to add.
modelThe model to add.

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