Webdar 1.0.0
Web user interface to libdar
actor.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// webdar - a web server and interface program to libdar
3// Copyright (C) 2013-2025 Denis Corbin
4//
5// This file is part of Webdar
6//
7// Webdar is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// Webdar is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with Webdar. If not, see <http://www.gnu.org/licenses/>
19//
20//----
21// to contact the author: dar.linux@free.fr
22/*********************************************************************/
23
24#ifndef ACTOR_HPP
25#define ACTOR_HPP
26
27 // C system header files
28#include "my_config.h"
29extern "C"
30{
31
32}
33
34 // C++ system header files
35#include <string>
36
37 // webdar headers
38#include "reference.hpp"
39
49
51
54class actor : public reference
55{
56public:
57 actor() = default;
58 actor(const actor & ref) = default;
59 actor(actor && ref) noexcept(false) = default;
60 actor & operator = (const actor & ref) = default;
61 actor & operator = (actor && ref) noexcept(false);
62 virtual ~actor() {};
63
65 virtual void on_event(const std::string & event_name) = 0;
66};
67
68// Note: both class actor and events inherit from the same class "reference"
69// It is possible that a class inherit from both actor and events, being an
70// actor with certain peers and a events for other peers. Having non virtual
71// inheritance for actor and events in relation to class reference would not
72// be a problem, as it would lead such object to have two parent reference
73// objects one containing the peer with which it is actor, and another with
74// which it is event. However, as both type of relation are forever, having
75// a single base for both roles is possible. It also reduces a bit memory
76// requirement.
77
78#endif
class of object that are pointed/triggered to by others
Definition: actor.hpp:55
virtual void on_event(const std::string &event_name)=0
implementation in inherited class of the action triggered by the event given in argument
class reference gives a mean to link objects by a peering method
Definition: reference.hpp:47