• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
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 HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
18 #define HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
19 
20 /*
21  * Contains common declarations that are used across the camera emulation.
22  */
23 
24 #include <hardware/camera.h>
25 #include <linux/videodev2.h>
26 
27 /* A helper class that tracks a routine execution.
28  * Basically, it dumps an enry message in its constructor, and an exit message
29  * in its destructor. Use LOGRE() macro (declared bellow) to create instances
30  * of this class at the beginning of the tracked routines / methods.
31  */
32 class HWERoutineTracker {
33  public:
34   /* Constructor that prints an "entry" trace message. */
35   explicit HWERoutineTracker(const char* name) : mName(name) {
36     ALOGV("Entering %s", mName);
37   }
38 
39   /* Destructor that prints a "leave" trace message. */
40   ~HWERoutineTracker() { ALOGV("Leaving %s", mName); }
41 
42  private:
43   /* Stores the routine name. */
44   const char* mName;
45 };
46 
47 /* Logs an execution of a routine / method. */
48 #define LOGRE() HWERoutineTracker hwertracker_##__LINE__(__FUNCTION__)
49 
50 /*
51  * min / max macros
52  */
53 
54 #define min(a, b) (((a) < (b)) ? (a) : (b))
55 #define max(a, b) (((a) > (b)) ? (a) : (b))
56 
57 #endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H */
58