Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2022 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : *
19 : * @file IStateObserver.h
20 : *
21 : * This file comprises the class definition of IStateObserver.
22 : * An interface, which allows to subscribe for application state change notifications
23 : */
24 :
25 : #ifndef RIALTO_SERVERMANAGER_SERVICE_I_STATE_OBSERVER_H_
26 : #define RIALTO_SERVERMANAGER_SERVICE_I_STATE_OBSERVER_H_
27 :
28 : #include "SessionServerCommon.h"
29 : #include <string>
30 :
31 : namespace rialto::servermanager::service
32 : {
33 : /**
34 : * @brief Represents an interface, which allows to subscribe for application state change notifications
35 : *
36 : * Implementation of this class should be done by a client. Pointer to the IStateObserver implementation
37 : * should be passed to ServerManagerService, when it is created.
38 : */
39 : class IStateObserver
40 : {
41 : public:
42 30 : IStateObserver() = default;
43 30 : virtual ~IStateObserver() = default;
44 :
45 : IStateObserver(const IStateObserver &) = delete;
46 : IStateObserver &operator=(const IStateObserver &) = delete;
47 : IStateObserver(IStateObserver &&) = delete;
48 : IStateObserver &operator=(IStateObserver &&) = delete;
49 :
50 : /**
51 : * @brief Change state notification function
52 : *
53 : * This method should be implemented by a client. Implementation should be a client reaction state change of
54 : * RialtoSessionServer
55 : *
56 : * Function is called by RialtoServerManager, when it receives StateChangedEvent from RialtoSessionServer.
57 : *
58 : * @param[in] appId : The ID of an application, which changed its state
59 : * @param[in] state : New session server state
60 : *
61 : */
62 : virtual void stateChanged(const std::string &appId, const firebolt::rialto::common::SessionServerState &state) = 0;
63 : };
64 : } // namespace rialto::servermanager::service
65 :
66 : #endif // RIALTO_SERVERMANAGER_SERVICE_I_STATE_OBSERVER_H_
|