/** * PANDA 3D SOFTWARE * Copyright (c) Carnegie Mellon University. All rights reserved. * * All use of this software is subject to the terms of the revised BSD * license. You should have received a copy of this license along * with this source code in a file named "LICENSE." * * @file physxObjectCollection.I * @author enn0x * @date 2009-11-08 */ /** * */ template INLINE unsigned int PhysxObjectCollection:: size() const { return _objects.size(); } /** * */ template INLINE void PhysxObjectCollection:: add(PT(T) object) { _objects.push_back(object); } /** * */ template INLINE void PhysxObjectCollection:: remove(PT(T) object) { typename pvector::iterator it; it = find(_objects.begin(), _objects.end(), object); if (it != _objects.end()) { _objects.erase(it); } else { physx_cat.warning() << "object not found in collection" << endl; } } /** * Returns the n-th PhysxObject in the collection. The operator [] is maybe a * more convenient way to access objects from the collection. */ template INLINE T *PhysxObjectCollection:: get(unsigned int index) const { nassertr(index < _objects.size(), NULL); return _objects[index]; } /** * Returns the n-th PhysxObject in the collection. This is the same as the * get() method. */ template INLINE T *PhysxObjectCollection:: operator [] (unsigned int index) const { nassertr(index < _objects.size(), NULL); return _objects[index]; } /** * */ template INLINE void PhysxObjectCollection:: ls() const { ls(nout); } /** * */ template INLINE void PhysxObjectCollection:: ls(ostream &out, int indent_level) const { for (unsigned int i=0; i < size(); i++) { get(i)->ls(out, indent_level + 2); } }