Rename DSL: deviceSpec => deviceAttachmentSpec
This language is used broadly to specify how to attach (and thus also how to detach) devices to/from Salmanoff. The next bit of work we'll do is split off the DSL parsing from the management of the list of parsed binary attached spec objects. We'll be creating a PipeDeviceAttachmentParser, and later on when we support URDF, we'll create a URDFDeviceAttachmentParser.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#ifndef SENSORDEVICESPEC_H
|
||||
#define SENSORDEVICESPEC_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
namespace smo {
|
||||
namespace device {
|
||||
|
||||
class DeviceAttachmentSpec
|
||||
{
|
||||
public:
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, const DeviceAttachmentSpec& spec)
|
||||
{
|
||||
os << spec.stringify();
|
||||
return os;
|
||||
}
|
||||
|
||||
bool operator==(const DeviceAttachmentSpec& other) const
|
||||
{
|
||||
return deviceIdentifier == other.deviceIdentifier &&
|
||||
sensorType == other.sensorType &&
|
||||
provider == other.provider &&
|
||||
deviceSelector == other.deviceSelector;
|
||||
}
|
||||
|
||||
public:
|
||||
std::string deviceIdentifier;
|
||||
char sensorType;
|
||||
std::string implexor;
|
||||
std::string api;
|
||||
std::vector<std::pair<std::string,std::string>> apiParams;
|
||||
std::string provider;
|
||||
std::vector<std::pair<std::string,std::string>> providerParams;
|
||||
std::string deviceSelector;
|
||||
|
||||
std::string stringify() const
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "Device Identifier: " << deviceIdentifier
|
||||
<< ", Sensor Type: " << sensorType
|
||||
<< ", Implexor: " << implexor << ", API: " << api
|
||||
<< ", API Params: (";
|
||||
for (const auto& param : apiParams)
|
||||
{
|
||||
os << param.first;
|
||||
if (!param.second.empty()) {
|
||||
os << "=" << param.second;
|
||||
}
|
||||
os << " ";
|
||||
}
|
||||
os << "), Provider: " << provider << ", Provider Params: (";
|
||||
for (const auto& param : providerParams)
|
||||
{
|
||||
os << param.first;
|
||||
if (!param.second.empty()) {
|
||||
os << "=" << param.second;
|
||||
}
|
||||
os << " ";
|
||||
}
|
||||
os << "), Device Selector: " << deviceSelector << std::endl;
|
||||
|
||||
return os.str();
|
||||
}
|
||||
};
|
||||
|
||||
class InteroceptorDevAttachmentSpec : public DeviceAttachmentSpec
|
||||
{
|
||||
};
|
||||
|
||||
class ExtrospectorDevAttachmentSpec : public DeviceAttachmentSpec
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
} // namespace smo
|
||||
|
||||
#endif // SENSORDEVICESPEC_H
|
||||
Reference in New Issue
Block a user