aride_parameter_ardev.h

00001 /* -- 2007-05-07 -- 
00002  *  ardev - an augmented reality library for robot developers
00003  *  Copyright 2005-2007 - Toby Collett (ardev _at_ plan9.net.nz)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00018  *
00019  */
00020 #ifndef ARIDE_PARAMETER_ARDEV_H
00021 #define ARIDE_PARAMETER_ARDEV_H
00022 
00023 #include <qobject.h>
00024 #include <qlineedit.h>
00025 #include <qcheckbox.h>
00026 
00027 #include "aride_parameter.h"
00028 #include "mainwindow.h"
00029 #include "aride_exception.h"
00030 
00031 class aride_object;
00032 
00033 // ARDev Object Types (ie Camera, Capture etc)
00034 
00035 template<class T, ArideSection Section>
00036 class ARObjectParameter : public StringParameter
00037 {
00038         public:
00039                 ARObjectParameter(QString _Name, QString _Description, QString _DefaultValue="") : StringParameter(_Name,_Description,_DefaultValue) {Type=GetArideSectionTypeName(Section);};
00040                 ~ARObjectParameter() {};
00041         
00042                 T GetClass() 
00043                 {
00044                         if (Value == "")
00045                                 throw aride_exception(ARIDE_CLASS_NOT_FOUND, __FILE__, __LINE__);
00046                         aride_object * temp = theMainWindow->GetObjectByName(Value);
00047                         if (temp == NULL)
00048                                 throw aride_exception(ARIDE_CLASS_NOT_FOUND, __FILE__, __LINE__);
00049                         if (temp->Section == Section)
00050                                 return reinterpret_cast<T> (temp->Handler);
00051                         throw aride_exception(ARIDE_CLASS_NOT_FOUND, __FILE__, __LINE__);
00052                 };      
00053                 
00054                 virtual void ExternalNameChange(const QString & OldName, const QString & NewName) 
00055                 {
00056                         if (Value == OldName)
00057                                 fromString(NewName);
00058                 }
00059 };
00060 
00061 template <class T>
00062 class ArideObjectHandler;
00063 
00064 typedef ArideObjectHandler<CameraObject> CameraObjectHandler;
00065 typedef ArideObjectHandler<CaptureObject> CaptureObjectHandler;
00066 typedef ArideObjectHandler<OutputObject> OutputObjectHandler;
00067 typedef ArideObjectHandler<PositionObject> PositionObjectHandler;
00068 //typedef ArideObjectHandler<RenderObject> RenderObjectHandler;
00069 
00070 class RenderObjectHandler;
00071 /*typedef CameraObjectHandler;
00072 typedef CaptureObjectHandler;
00073 typedef OutputObjectHandler;
00074 typedef PositionObjectHandler;*/
00075 
00076 typedef ARObjectParameter<CameraObjectHandler*,ARIDE_CAMERA> CameraObjectParameter;
00077 typedef ARObjectParameter<CaptureObjectHandler*,ARIDE_CAPTURE> CaptureObjectParameter;
00078 typedef ARObjectParameter<OutputObjectHandler*,ARIDE_OUTPUT> OutputObjectParameter;
00079 typedef ARObjectParameter<PositionObjectHandler*,ARIDE_POSITION> PositionObjectParameter;
00080 typedef ARObjectParameter<RenderObjectHandler*,ARIDE_RENDER> RenderObjectParameter;
00081 
00082 
00083 #endif

SourceForge.net Logo Generated on Sat May 12 15:25:43 2007 for ardev by doxygen 1.5.1