23 #include <boost/uuid/uuid_generators.hpp> 87 if (e == odb::callback_event::pre_persist ||
88 e == odb::callback_event::pre_update)
93 ASSERT_LOG(hwd_service,
"No hardware service.");
94 auto d = hwd_service->find_device_by_name(
name());
96 if (d && d->id() !=
id())
97 throw ModelException(
"data/attributes/name",
"Device name already used");
100 if (e == odb::callback_event::post_persist ||
101 e == odb::callback_event::post_update)
106 "Device name must be non empty");
DeviceClass
An enumeration describing the class of the device.
An exception class for general API error.
This is the header file for a generated source file, GitSHA1.cpp.
DeviceClass device_class_
uint64_t odb_version() const
ServiceRegistry & get_service_registry()
A function to retrieve the ServiceRegistry from pretty much anywhere.
const std::string & name() const
Base class for hardware devices.
Thin wrapper around boost::uuids::uuid.
Database aware Hardware Service.
virtual void validation_callback(odb::callback_event e, odb::database &) const
#define ASSERT_LOG(cond, msg)
std::shared_ptr< ServiceInterface > get_service() const
Retrieve the service instance implementing the ServiceInterface, or nullptr if no such service was re...
std::string name_
Name of an hardware device must be unique due to an implementation details.
bool enabled_
Is this device supposed to be enabled?
DeviceClass device_class() const