client-cpp  0.10.0
KaaClientContext.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef KAACLIENTCONTEXT_H
18 #define KAACLIENTCONTEXT_H
19 
20 #include "IKaaClientContext.hpp"
21 #include <kaa/ClientStatus.hpp>
22 #include <kaa/KaaClientContext.hpp>
23 
25 #include <kaa/logging/ILogger.hpp>
28 
29 namespace kaa {
30 
32 {
33 public:
35  ILogger &logger,
36  IExecutorContext &executorContext,
37  IKaaClientStateStoragePtr state = nullptr,
38  KaaClientStateListenerPtr stateListener = std::make_shared<KaaClientStateListener>())
39  : properties_(properties),
40  logger_(logger),
41  executorContext_(executorContext),
42  state_(state),
43  stateListener_(stateListener) {}
44 
45  virtual KaaClientProperties &getProperties() { return properties_; }
46  virtual ILogger &getLogger() { return logger_; }
47  virtual IKaaClientStateStorage &getStatus() { return *state_; }
48  virtual IExecutorContext &getExecutorContext() { return executorContext_; }
49  virtual KaaClientStateListener &getClientStateListener() { return *stateListener_; }
50  void setStatus(IKaaClientStateStoragePtr status) { state_ = status; }
51 
52 private:
53  KaaClientProperties &properties_;
54  ILogger &logger_;
55  IExecutorContext &executorContext_;
57  KaaClientStateListenerPtr stateListener_;
58 };
59 
60 }
61 
62 
63 #endif // KAACLIENTCONTEXT_H
KaaClientContext(KaaClientProperties &properties, ILogger &logger, IExecutorContext &executorContext, IKaaClientStateStoragePtr state=nullptr, KaaClientStateListenerPtr stateListener=std::make_shared< KaaClientStateListener >())
virtual KaaClientProperties & getProperties()
std::shared_ptr< KaaClientStateListener > KaaClientStateListenerPtr
void setStatus(IKaaClientStateStoragePtr status)
virtual IKaaClientStateStorage & getStatus()
virtual ILogger & getLogger()
std::shared_ptr< IKaaClientStateStorage > IKaaClientStateStoragePtr
virtual IExecutorContext & getExecutorContext()
Notifies about Kaa client state changes and errors.
virtual KaaClientStateListener & getClientStateListener()