Leosac  0.8.0
Open Source Access Control
Leosac::Hardware::HardwareService Class Reference

Database aware Hardware Service. More...

#include <HardwareService.hpp>

+ Inheritance diagram for Leosac::Hardware::HardwareService:
+ Collaboration diagram for Leosac::Hardware::HardwareService:

Public Member Functions

 HardwareService (const Leosac::DBServicePtr &dbservice)
 
DevicePtr find_device_by_name (const std::string &dev_name) const
 
std::string hardware_device_type (const Hardware::Device &device) const
 Return the name of real type of a device. More...
 
json serialize_device_metadata (const Hardware::DevicePtr &device) const
 Serialize as json the metadata of a device. More...
 
- Public Member Functions inherited from Leosac::ExtensibleSerializer< json, Hardware::Device, const SecurityContext & >
json serialize (const Hardware::Device &input, AdditionalArgs &&... args) const
 
void register_serializer (Callable &&callable)
 Register a serializer for T. More...
 
void unregister_serializer ()
 

Private Attributes

DBServicePtr dbservice_
 

Additional Inherited Members

- Public Types inherited from Leosac::ExtensibleSerializer< json, Hardware::Device, const SecurityContext & >
using SerializationCallable = std::function< json(const Hardware::Device &, AdditionalArgs &&...)>
 Callable type for serialization. More...
 

Detailed Description

Database aware Hardware Service.

Note
This is a core service that requires a database to function. Therefore it'll be available only if Leosac is configured to use a database.

Definition at line 39 of file HardwareService.hpp.

Constructor & Destructor Documentation

◆ HardwareService()

Leosac::Hardware::HardwareService::HardwareService ( const Leosac::DBServicePtr dbservice)
explicit

Definition at line 33 of file HardwareService.cpp.

Member Function Documentation

◆ find_device_by_name()

DevicePtr Leosac::Hardware::HardwareService::find_device_by_name ( const std::string &  dev_name) const

Definition at line 61 of file HardwareService.cpp.

◆ hardware_device_type()

std::string Leosac::Hardware::HardwareService::hardware_device_type ( const Hardware::Device device) const

Return the name of real type of a device.

Definition at line 41 of file HardwareService.cpp.

◆ serialize_device_metadata()

json Leosac::Hardware::HardwareService::serialize_device_metadata ( const Hardware::DevicePtr device) const

Serialize as json the metadata of a device.

This is useful when serializer when to describe a relationship.

Parameters
device
Returns
json object looking like: {"id": DEVICE_UUID, "type": DEVICE_TYPE}

Definition at line 50 of file HardwareService.cpp.

Member Data Documentation

◆ dbservice_

DBServicePtr Leosac::Hardware::HardwareService::dbservice_
private

Definition at line 62 of file HardwareService.hpp.


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