Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraDriverOSX.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_CameraDriver_h_
00003 #define INCLUDED_CameraDriver_h_
00004 
00005 #include "local/DeviceDriver.h"
00006 #include "local/DataSources/CameraSourceOSX.h"
00007 #include "Shared/get_time.h"
00008 
00009 //! description of CameraDriver
00010 class CameraDriver : public virtual DeviceDriver, public virtual plist::CollectionListener {
00011 public:
00012   //! constructor, may throw a const char* on error
00013   explicit CameraDriver(const std::string& name)
00014     : DeviceDriver(autoRegisterCameraDriver,name)
00015   {
00016     if(!checkQTThreadInit()) {
00017       std::cerr << "CameraDriver: Couldn't initialize QuickTime" << std::endl;
00018       return;
00019     }
00020     
00021     updateCameraList();
00022   }
00023   
00024   ~CameraDriver() {}
00025   
00026   virtual std::string getClassName() const { return autoRegisterCameraDriver; }
00027   
00028   virtual void getImageSources(std::map<std::string,DataSource*>& sources) {
00029     sources.clear();
00030     for(const_iterator it=begin(); it!=end(); ++it) {
00031       if(it->first==".type")
00032         continue;
00033       if(CameraSource * ds = dynamic_cast<CameraSource*>(it->second))
00034         sources[it->first]=ds;
00035       else
00036         std::cerr << "WARNING CameraDriver entry " << it->first << " is not actually a CameraSource!!!" << std::endl;
00037     }
00038   }
00039   
00040 protected:
00041   //! converts from pascal-format string to c-format string
00042   static std::string p2c(unsigned char pascalStr[]) {
00043     unsigned char len = *pascalStr++;
00044     return std::string(reinterpret_cast<char*>(pascalStr),len);
00045   }
00046   
00047   static void dumpLiteral(OSType t);
00048   
00049   void updateCameraList();
00050   
00051 private:
00052   //! holds the class name, set via registration with the DeviceDriver registry
00053   static const std::string autoRegisterCameraDriver;
00054 };
00055 
00056 /*! @file
00057  * @brief 
00058  * @author Ethan Tira-Thompson (ejt) (Creator)
00059  *
00060  * $Author: ejt $
00061  * $Name: tekkotsu-4_0 $
00062  * $Revision: 1.2 $
00063  * $State: Exp $
00064  * $Date: 2007/09/14 21:29:03 $
00065  */
00066 
00067 #endif

Tekkotsu Hardware Abstraction Layer 4.0
Generated Thu Nov 22 01:00:53 2007 by Doxygen 1.5.4