/* * Copyright (C) 2018 "IoT.bzh" * Author Loïc Collignon * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "role.hpp" #include "jsonc_utils.hpp" role_t::role_t(std::string uid, std::string name, std::string description, std::string stream, int priority) : uid_{uid} , name_{name} , description_{description} , stream_{stream} , priority_{priority} { } role_t::role_t(json_object* j) { jcast(uid_, j, "uid"); jcast(name_, j, "name"); jcast(description_, j, "description"); jcast(priority_, j, "priority"); jcast(stream_, j, "stream"); jcast_array(interrupts_, j, "interrupts"); } role_t& role_t::operator<<(json_object* j) { jcast(uid_, j, "uid"); jcast(name_, j, "name"); jcast(description_, j, "description"); jcast(priority_, j, "priority"); jcast(stream_, j, "stream"); jcast_array(interrupts_, j, "interrupts"); return *this; } std::string role_t::uid() const { return uid_; } std::string role_t::name() const { return name_; } std::string role_t::description() const { return description_; } std::string role_t::stream() const { return stream_; } int role_t::priority() const { return priority_; } std::string role_t::device_uri() const { return device_uri_; } void role_t::uid(std::string v) { uid_ = v; } void role_t::name(std::string v) { name_ = v; } void role_t::description(std::string v) { description_ = v; } void role_t::stream(std::string v) { stream_ = v; } void role_t::priority(int v) { priority_ = v; } void role_t::device_uri(std::string v) { device_uri_ = v; } const std::vector& role_t::interrupts() const { return interrupts_; }