GDataController.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 - 2005 by Raphael Langerhorst                      *
00003  *   raphael-langerhorst@gmx.at                                            *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GDATACONTROLLER_H
00026 #define GDATACONTROLLER_H
00027 
00028 #include <QObject>
00029 
00030 #include <GElement.h>
00031 #include <GElementID.h>
00032 #include <GElementInfluence.h>
00033 #include <GVector3.h>
00034 
00035 #include <GWorldData.h>
00036 
00037 #include <QList>
00038 
00039 namespace GWE
00040 {
00041 
00050 class GDataController : public QObject, public GCS::GWorldData
00051 {
00052   Q_OBJECT
00053   
00054   public:
00055   
00059     GDataController(QObject *parent = 0)
00060       : QObject(parent),
00061         GCS::GWorldData()
00062       {}
00063       
00067     virtual ~GDataController()
00068       {}
00069       
00070     // ELEMENT MANAGEMENT //
00071     
00072     //read is already declared as abstract in GCS::GWorldData
00073     
00082     virtual GCS::GElement* open(const GCS::GElementID& ) = 0;
00083     
00089     virtual GCS::GElement* getOpenElement(const GCS::GElementID& ) = 0;
00090 
00094     virtual QList<GCS::GElementID> getListOfOpenElements() = 0;
00095 
00099     virtual QList<GCS::GElementID> getListOfAllElements() = 0;
00100     
00105     virtual bool isPrimaryElement(const GCS::GElementID&) const {return true;}
00106     
00107     public slots:
00108       
00109     // ELEMENT MANAGEMENT - THESE ROUTINES CAN ACT AS SLOTS //
00110   
00119     virtual bool add(GCS::GElement*) = 0;
00120     
00126     virtual bool writeOpenElementToStorage(const GCS::GElementID& ) = 0;
00127     
00134     virtual bool close(const GCS::GElementID& ) = 0;
00135     
00146     virtual bool postDelete(const GCS::GElementID& ) = 0;
00147 
00152     virtual void shutdown() = 0;
00153     
00154   signals:
00155   
00156     // SIGNALS INTERESTING FOR DATA MANAGEMENT (DB,...) //
00157     
00158     //@todo I think it's better to emit with const GCS::GElementID&, except for added maybe
00159     
00164     void elementAdded(const GCS::GElementID& );
00165     
00174     void elementUpdated(const GCS::GElementID& );
00175   
00180     void elementOpened(const GCS::GElementID& );
00181     
00187     void elementClosed(const GCS::GElementID& );
00188     
00193     void elementDeleted(const GCS::GElementID& );
00194 };
00195 
00196 }
00197 
00198 #endif //GDATACONTROLLER_H

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7