/* -------------------------------------------------------------------------- */ /* Copyright 2002-2022, OpenNebula Project, OpenNebula Systems */ /* */ /* 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. */ /* -------------------------------------------------------------------------- */ #ifndef VIRTUAL_ROUTER_H_ #define VIRTUAL_ROUTER_H_ #include "PoolObjectSQL.h" #include "Template.h" #include "ObjectCollection.h" #include "VirtualMachineTemplate.h" #include "AuthRequest.h" /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ struct RequestAttributes; /** * The VirtualRouter class. */ class VirtualRouter : public PoolObjectSQL { public: virtual ~VirtualRouter() = default; /** * Function to print the VirtualRouter object into a string in XML format * @param xml the resulting XML string * @return a reference to the generated string */ std::string& to_xml(std::string& xml) const override; int add_vmid(int vmid) { return vms.add(vmid); } int del_vmid(int vmid) { return vms.del(vmid); } bool has_vmids() const { return vms.size() > 0; } /** * Returns a copy of the VM IDs set */ const std::set& get_vms() const { return vms.get_collection(); } // ------------------------------------------------------------------------ // Template Contents // ------------------------------------------------------------------------ /** * Factory method for VirtualRouter templates */ std::unique_ptr