BVB Source Codes

mars Show active_logic.h Source code

Return Download mars: download active_logic.h Source code - Download mars Source code - Type:.h
  1. // Tencent is pleased to support the open source community by making Mars available.
  2. // Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
  3.  
  4. // Licensed under the MIT License (the "License"); you may not use this file except in
  5. // compliance with the License. You may obtain a copy of the License at
  6. // http://opensource.org/licenses/MIT
  7.  
  8. // Unless required by applicable law or agreed to in writing, software distributed under the License is
  9. // distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  10. // either express or implied. See the License for the specific language governing permissions and
  11. // limitations under the License.
  12.  
  13. /*
  14.  * active_logic.h
  15.  *
  16.  *  Created on: 2012-8-22
  17.  *      Author: yerungui
  18.  */
  19.  
  20. #ifndef MMCOMM_SRC_ACTIVE_LOGIC_H_
  21. #define MMCOMM_SRC_ACTIVE_LOGIC_H_
  22.  
  23. #include "boost/signals2.hpp"
  24.  
  25. #include "mars/comm/alarm.h"
  26. #include "mars/comm/thread/mutex.h"
  27. #include "mars/comm/singleton.h"
  28.  
  29. class ActiveLogic
  30. {
  31. public:
  32.     SINGLETON_INTRUSIVE(ActiveLogic, new ActiveLogic, delete);
  33.     boost::signals2::signal<void (bool _isForeground)> SignalForeground;
  34.     boost::signals2::signal<void (bool _isactive)> SignalActive;
  35.  
  36. public:
  37.     ActiveLogic();
  38.     virtual ~ActiveLogic();
  39.  
  40.     void OnForeground(bool _isforeground);
  41.     bool IsActive() const;
  42.  
  43.     bool IsForeground() const;
  44.     uint64_t LastForegroundChangeTime() const;
  45.  
  46. private:
  47.     void __OnInActive();
  48.  
  49. private:
  50.     bool   isforeground_;
  51.     bool   isactive_;
  52.     Alarm  alarm_;
  53.     uint64_t lastforegroundchangetime_;
  54. };
  55.  
  56. #endif // MMCOMM_SRC_ACTIVE_LOGIC_H_
  57.  
downloadactive_logic.h Source code - Download mars Source code
Related Source Codes/Software:
Hero - Elegant transition library for iOS & tvOS 2017-06-09
deep-photo-styletransfer - Code and data for paper "Deep Photo Style Transfer... 2017-06-09
mastodon - A GNU Social-compatible microblogging server ... 2017-06-09
plyr - A simple HTML5, YouTube and Vimeo player ... 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
Public-APIs - 2017-06-09
lottie-ios - An iOS library to natively render After Effects ve... 2017-06-09
Awesome-Hacking - A collection of various awesome lists for hackers,... 2017-06-09
algorithms - Minimal examples of data structures and algorithms... 2017-06-10
lectures - Oxford Deep NLP 2017 course 2017-06-10
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top