00001 /************************************************************************* 00002 * * 00003 * Open Physics Abstraction Layer * 00004 * Copyright (C) 2004-2005 * 00005 * Alan Fischer alan.fischer@gmail.com * 00006 * Andres Reinot andres@reinot.com * 00007 * Tyler Streeter tylerstreeter@gmail.com * 00008 * All rights reserved. * 00009 * Web: opal.sourceforge.net * 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of EITHER: * 00013 * (1) The GNU Lesser General Public License as published by the Free * 00014 * Software Foundation; either version 2.1 of the License, or (at * 00015 * your option) any later version. The text of the GNU Lesser * 00016 * General Public License is included with this library in the * 00017 * file license-LGPL.txt. * 00018 * (2) The BSD-style license that is included with this library in * 00019 * the file license-BSD.txt. * 00020 * * 00021 * This library is distributed in the hope that it will be useful, * 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * 00024 * license-LGPL.txt and license-BSD.txt for more details. * 00025 * * 00026 *************************************************************************/ 00027 00028 #ifndef OPAL_BLUEPRINT_H 00029 #define OPAL_BLUEPRINT_H 00030 00031 #include "Defines.h" 00032 #include "Solid.h" 00033 #include "Joint.h" 00034 00035 namespace opal 00036 { 00037 class SolidData; 00038 class JointData; 00039 class MotorData; 00040 class SensorData; 00041 00049 class Blueprint 00050 { 00051 public: 00052 OPAL_DECL Blueprint(); 00053 00054 OPAL_DECL virtual ~Blueprint(); 00055 00059 OPAL_DECL virtual void OPAL_CALL finalize(); 00060 00063 OPAL_DECL virtual bool OPAL_CALL isFinalized()const; 00064 00067 OPAL_DECL virtual void OPAL_CALL addSolid(SolidData* data); 00068 00071 OPAL_DECL virtual void OPAL_CALL addJoint(JointData* data); 00072 00075 OPAL_DECL virtual void OPAL_CALL addMotor(MotorData* data); 00076 00079 OPAL_DECL virtual void OPAL_CALL addSensor(SensorData* data); 00080 00082 OPAL_DECL virtual unsigned int OPAL_CALL getNumSolids()const; 00083 00085 OPAL_DECL virtual unsigned int OPAL_CALL getNumJoints()const; 00086 00088 OPAL_DECL virtual unsigned int OPAL_CALL getNumMotors()const; 00089 00091 OPAL_DECL virtual unsigned int OPAL_CALL getNumSensors()const; 00092 00094 OPAL_DECL virtual SolidData* OPAL_CALL getSolidData( 00095 unsigned int i)const; 00096 00098 OPAL_DECL virtual JointData* OPAL_CALL getJointData( 00099 unsigned int i)const; 00100 00102 OPAL_DECL virtual MotorData* OPAL_CALL getMotorData( 00103 unsigned int i)const; 00104 00106 OPAL_DECL virtual SensorData* OPAL_CALL getSensorData( 00107 unsigned int i)const; 00108 00109 private: 00113 bool solidExists(const std::string& name); 00114 00118 bool jointExists(const std::string& name); 00119 00123 bool motorExists(const std::string& name); 00124 00128 bool sensorExists(const std::string& name); 00129 00133 int getSolidIndex(const std::string& name)const; 00134 00138 int getJointIndex(const std::string& name)const; 00139 00142 void printFinalizedMessage(); 00143 00145 bool mFinalized; 00146 00148 std::vector<SolidData*> mSolidList; 00149 00151 std::vector<JointData*> mJointList; 00152 00154 std::vector<MotorData*> mMotorList; 00155 00157 std::vector<SensorData*> mSensorList; 00158 }; 00159 } 00160 00161 #endif