00001 //###################################################################### 00002 // 00003 // GraspIt! 00004 // Copyright (C) 2002-2009 Columbia University in the City of New York. 00005 // All rights reserved. 00006 // 00007 // GraspIt! is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // GraspIt! is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with GraspIt!. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Author(s): Hao Dang and Matei T. Ciocarlie 00021 // 00022 // $Id: graspit_db_model.h,v 1.10 2010/08/11 02:45:37 cmatei Exp $ 00023 // 00024 //###################################################################### 00025 00030 #ifndef _GRASPIT_DB_MODEL_ENTRY_H_ 00031 #define _GRASPIT_DB_MODEL_ENTRY_H_ 00032 00033 #include "DBPlanner/model.h" 00034 00035 class World; 00036 class GraspableBody; 00037 00040 class GraspitDBModel : public db_planner::Model{ 00041 protected: 00043 GraspableBody* mGraspableBody; 00045 bool mGeometryLoaded; 00046 00048 virtual int loadGeometry(); 00049 public: 00050 GraspitDBModel() : mGraspableBody(NULL), mGeometryLoaded(false){} 00051 ~GraspitDBModel(); 00053 int load(World* w); 00055 void unload(); 00057 bool geometryLoaded() const {return mGeometryLoaded;} 00059 GraspableBody* getGraspableBody() const { return mGraspableBody; } 00060 }; 00061 00063 class GraspitDBModelAllocator : public db_planner::ModelAllocator 00064 { 00065 public: 00066 GraspitDBModelAllocator(){} 00067 db_planner::Model* Get() const { 00068 return new GraspitDBModel(); 00069 } 00070 }; 00071 00072 namespace db_planner {class DatabaseManager;} 00073 00075 00076 class GeomGraspitDBModel : public GraspitDBModel 00077 { 00078 private: 00080 db_planner::DatabaseManager *mManager; 00082 virtual int loadGeometry(); 00083 public: 00085 GeomGraspitDBModel(db_planner::DatabaseManager* manager) : GraspitDBModel(), mManager(manager) {} 00086 }; 00087 00089 class GeomGraspitDBModelAllocator : public db_planner::ModelAllocator 00090 { 00091 private: 00093 db_planner::DatabaseManager *mManager; 00094 public: 00096 GeomGraspitDBModelAllocator(db_planner::DatabaseManager *manager) : mManager(manager) {} 00097 00099 db_planner::Model* Get() const { 00100 return new GeomGraspitDBModel(mManager); 00101 } 00102 }; 00103 00104 #endif