Merge branch 'master' into tizen
[platform/core/uifw/dali-adaptor.git] / adaptors / base / environment-options.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
2 #define __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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  */
20
21 #include <dali/integration-api/debug.h>
22
23 namespace Dali
24 {
25 namespace Internal
26 {
27 namespace Adaptor
28 {
29
30 /**
31  * Contains environment options which define settings and the ability to install a log function.
32  */
33 class EnvironmentOptions
34 {
35
36 public:
37
38   /**
39    * Constructor
40    */
41   EnvironmentOptions();
42
43   /**
44    * non-virtual destructor, not intended as a base class
45    */
46   ~EnvironmentOptions();
47
48   /**
49    * @param logFunction logging function
50    * @param logFilterOptions bitmask of the logging options defined in intergration/debug.h (e.g.
51    * @param logFrameRateFrequency frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
52    * @param logupdateStatusFrequency frequency of how often the update status is logged in number of frames
53    * @param logPerformanceLevel performance logging, 0 = disabled,  1+ =  enabled
54    * @param logPanGestureLevel pan-gesture logging, 0 = disabled,  1 = enabled
55    */
56   void SetLogOptions( const Dali::Integration::Log::LogFunction& logFunction,
57                        unsigned int logFrameRateFrequency,
58                        unsigned int logupdateStatusFrequency,
59                        unsigned int logPerformanceLevel,
60                        unsigned int logPanGestureLevel );
61
62   /**
63    * Install the log function for the current thread.
64    */
65   void InstallLogFunction() const;
66
67   /**
68    * Un-install the log function for the current thread.
69    */
70   void UnInstallLogFunction() const;
71
72   /**
73    * @return frequency of how often FPS is logged out (e.g. 0 = off, 2 = every 2 seconds).
74    */
75   unsigned int GetFrameRateLoggingFrequency() const;
76
77   /**
78    * @return frequency of how often Update Status is logged out (e.g. 0 = off, 60 = log every 60 frames = 1 second @ 60FPS).
79    */
80   unsigned int GetUpdateStatusLoggingFrequency() const;
81
82   /**
83    * @return logPerformanceLevel performance log level ( 0 = off )
84    */
85   unsigned int GetPerformanceLoggingLevel() const;
86
87   /**
88    * @return pan-gesture logging level ( 0 == off )
89    */
90   unsigned int GetPanGestureLoggingLevel() const;
91
92   /**
93    * @return pan-gesture smoothing mode ( 0 == no smoothing )
94    */
95   unsigned int GetPanGestureSmoothingMode() const;
96
97   /**
98    * @brief Sets the mode used to smooth pan gesture movement properties calculated on the Update thread
99    *
100    * @param[in] mode The smoothing mode to use
101    */
102   void SetPanGesturePredictionMode(unsigned int mode) { mPanGesturePredictionMode = mode; }
103
104 private:
105
106   unsigned int mFpsFrequency;                     ///< how often fps is logged out in seconds
107   unsigned int mUpdateStatusFrequency;            ///< how often update status is logged out in frames
108   unsigned int mPerformanceLoggingLevel;          ///< performance log level
109   unsigned int mPanGestureLoggingLevel;           ///< pan-gesture log level
110   unsigned int mPanGesturePredictionMode;         ///< prediction mode for pan gestures
111
112   Dali::Integration::Log::LogFunction mLogFunction;
113
114   // Undefined copy constructor.
115   EnvironmentOptions( const EnvironmentOptions& );
116
117   // Undefined assignment operator.
118   EnvironmentOptions& operator=( const EnvironmentOptions& );
119
120 };
121
122 } // Adaptor
123 } // Internal
124 } // Dali
125
126 #endif // __DALI_INTERNAL_ADAPTOR_ENVIRONMENT_OPTIONS_H__