The MAUVE Toolchain
AbstractResource.hpp
1 /*
2  * Copyright 2017 ONERA
3  *
4  * This file is part of the MAUVE Runtime project.
5  *
6  * MAUVE Runtime is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License version 3 as
8  * published by the Free Software Foundation.
9  *
10  * MAUVE Runtime is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with MAUVE. If not, see <https://www.gnu.org/licenses/lgpl-3.0>.
17  */
18 #ifndef MAUVE_RUNTIME_ABSTRACT_RESOURCE_HPP
19 #define MAUVE_RUNTIME_ABSTRACT_RESOURCE_HPP
20 
21 #include "Configurable.hpp"
22 #include "WithName.hpp"
23 #include "WithAbstractShell.hpp"
24 #include "WithAbstractCore.hpp"
25 #include "WithAbstractInterface.hpp"
26 
27 #include <string>
28 
29 namespace mauve {
30  namespace runtime {
31 
32  class Service;
33 
38  : virtual public Configurable
39  , virtual public WithName
40  , virtual public WithAbstractShell
41  , virtual public WithAbstractCore
42  , virtual public WithAbstractInterface
43  {
44  public:
45  AbstractResource() = delete;
49  AbstractResource(std::string const & name);
53  AbstractResource(AbstractResource const & other) = delete;
54  virtual ~AbstractResource() noexcept = 0;
55 
57  std::string name() const override final { return _name; };
59  std::string type_name() const;
60 
62  virtual bool is_empty () const = 0;
63 
65  virtual bool clear() = 0;
66 
67  virtual int get_service_index(const Service* service) const = 0;
68 
69  private:
70  std::string _name;
71  };
72  }
73 }
74 
75 #endif
virtual bool is_empty() const =0
Check if the resource is empty.
std::string type_name() const
Get resource type name.
Trait for objects with an abstract Core.
Definition: WithAbstractCore.hpp:27
Object with a name.
Definition: WithName.hpp:27
The MAUVE namespace.
Definition: tracing.hpp:24
Configurable trait.
Definition: Configurable.hpp:25
A Service.
Definition: Service.hpp:30
Trait for objects with an abstract Interface.
Definition: WithAbstractInterface.hpp:27
virtual bool clear()=0
Clear the resource.
Trait for objects with an abstract Shell.
Definition: WithAbstractShell.hpp:27
std::string name() const overridefinal
Get resource name.
Definition: AbstractResource.hpp:57
Abstract Resource class.
Definition: AbstractResource.hpp:37