refactor cam::Camera::Description

This commit is contained in:
2021-06-18 16:54:07 +02:00
parent 86515e2da7
commit b6155b8d1f
3 changed files with 74 additions and 39 deletions

View File

@ -41,22 +41,46 @@ public:
{
private:
size_t hash = 0;
std::string vendor_;
std::string serial_;
std::string model_;
std::string id_;
public:
std::string vendor;
std::string serial;
std::string id;
std::string model;
size_t getHash() const
Description(std::string const vendor, const std::string model, const std::string serial, const std::string id = ""):
vendor_(vendor), serial_(serial), model_(model), id_(id)
{
//if(hash == 0)
return /*hash =*/ std::hash<std::string>{}(vendor + serial + id + model);
//return hash;
hash = std::hash<std::string>{}(vendor_ + serial_ + model_);
}
size_t getId() const
{
return hash;
}
std::string getIdString() const
{
return id_;
}
std::string getVendor() const
{
return vendor_;
}
std::string getSerial() const
{
return serial_;
}
std::string getModel() const
{
return model_;
}
bool operator==(const Description& in) const
{
return in.getHash() == getHash();
return in.getId() == getId();
}
bool operator!=(const Description& in) const
{
@ -147,6 +171,7 @@ public:
bool hasExposureAuto();
bool startAcquisition();
bool stopAcquisition();
bool setMtu(int mtu);
void getSize(unsigned int* x, unsigned int* y);
void setBayerMode(Camera::BayerMode mode);
Camera::BayerMode getBayerMode();