From: <mk...@us...> - 2003-10-09 23:50:51
|
Update of /cvsroot/csp/APPLICATIONS/CSPSim/Source In directory sc8-pr-cvs1:/tmp/cvs-serv19750 Added Files: Tag: systems System.cpp Log Message: --- NEW FILE: System.cpp --- // Combat Simulator Project - FlightSim Demo // Copyright (C) 2003 The Combat Simulator Project // http://csp.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** * @file System.cpp * * Vehicle systems base classes and infrastructure. * **/ #include <System.h> #include <DataRecorder.h> #include <PhysicsModel.h> #include <Controller.h> SIMDATA_REGISTER_INTERFACE(SystemsModel) void System::setModel(SystemsModel *model) { assert(m_Model == 0 || model == 0); m_Model = model; if (model != 0) { Bus::Ref bus = model->getBus(); registerChannels(bus.get()); } } void SystemsModel::setDataRecorder(DataRecorder *recorder) { if (!recorder) return; // TODO pass recorder to subsystems } simdata::Ref<PhysicsModel> SystemsModel::getPhysicsModel() const { return m_PhysicsModel; } simdata::Ref<Controller> SystemsModel::getController() const { return m_Controller; } void SystemsModel::postCreate() { System::postCreate(); if (m_PhysicsModel.valid()) { CSP_LOG(OBJECT, DEBUG, "Adding PhysicsModel (" << m_PhysicsModel->getClassName() << ")"); addChild(m_PhysicsModel.get()); } if (m_Controller.valid()) { CSP_LOG(OBJECT, DEBUG, "Adding Controller (" << m_Controller->getClassName() << ")"); addChild(m_Controller.get()); } } void SystemsModel::serialize(simdata::Archive &archive) { System::serialize(archive); archive(m_PhysicsModel); // XXX temporarily disabled (no controller classes yet) //archive(m_Controller); } void SystemsModel::getInfo(InfoList &info) { accept(new InfoVisitor(info)); } |