Request¶
- class Request¶
Bases:
pybind11_object
This the request that will transit on the network.
Example request decoding an image on a specific form. First parameter : Height of the image. Second parameter : Width of the image. Thirs parameter : Bitmap of the image (not compress).
Here is the header of the vpRequestImage class.
#ifndef vpRequestImage_H #define vpRequestImage_H #include <visp3/core/vpImage.h> #include <visp3/core/vpRequest.h> class vpRequestImage : public vpRequest { private: vpImage<unsigned char> *I; public: vpRequestImage(); vpRequestImage(vpImage<unsigned char> *); virtual ~vpRequestImage(); virtual void encode(); virtual void decode(); }; #endif
Here is the definition of the vpRequestImage class.
#include <vpRequestImage.h> vpRequestImage::vpRequestImage(){ request_id = "image"; } vpRequestImage::vpRequestImage(vpImage<unsigned char> *Im){ request_id = "image"; I = Im; } vpRequestImage::~vpRequestImage(){} void vpRequestImage::encode(){ clear(); unsigned int h = I->getHeight(); unsigned int w = I->getWidth(); addParameterObject(&h); addParameterObject(&w); addParameterObject(I->bitmap,h*w*sizeof(unsigned char)); } void vpRequestImage::decode(){ if(listOfParams.size() == 3){ unsigned int w, h; memcpy((void*)&h, (void*)listOfParams[0].c_str(), sizeof(unsigned int)); memcpy((void*)&w, (void*)listOfParams[1].c_str(), sizeof(unsigned int)); I->resize(h,w); memcpy((void*)I->bitmap,(void*)listOfParams[2].c_str(),w*h*sizeof(unsigned char)); } }
Note
See vpClient
Note
See vpServer
Note
See vpNetwork
Methods
Overloaded function.
Clear the parameters of the request.
Get the ID of the request.
Change the ID of the request.
Get the number of parameters.
Inherited Methods
Operators
__doc__
__module__
Attributes
__annotations__
- __init__(*args, **kwargs)¶
- addParameter(*args, **kwargs)¶
Overloaded function.
addParameter(self: visp._visp.core.Request, params: str) -> None
Add a message as parameter of the request.
Note
See vpNetwork::addParameterObject()
- Parameters:
- params
Array of characters representing the message to add.
addParameter(self: visp._visp.core.Request, params: str) -> None
Add a message as parameter of the request.
Note
See vpNetwork::addParameterObject()
- Parameters:
- params
std::string representing the message to add.
addParameter(self: visp._visp.core.Request, listOfparams: list[str]) -> None
Add messages as parameters of the request. Each message corresponds to one parameter.
Note
See vpNetwork::addParameterObject()
- Parameters:
- listOfparams
Array of std::string representing the messages to add.