Home | History | Annotate | Download | only in camera
      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 <linux/videodev2.h>
     25 #include <hardware/camera.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)
     36             : mName(name) {
     37         ALOGV("Entering %s", mName);
     38     }
     39 
     40     /* Destructor that prints a "leave" trace message. */
     41     ~HWERoutineTracker() {
     42         ALOGV("Leaving %s", mName);
     43     }
     44 
     45 private:
     46     /* Stores the routine name. */
     47     const char* mName;
     48 };
     49 
     50 /* Logs an execution of a routine / method. */
     51 #define LOGRE() HWERoutineTracker hwertracker_##__LINE__(__FUNCTION__)
     52 
     53 /*
     54  * min / max macros
     55  */
     56 
     57 #define min(a,b)    (((a) < (b)) ? (a) : (b))
     58 #define max(a,b)    (((a) > (b)) ? (a) : (b))
     59 
     60 #endif  /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H */
     61