Panda3D
Loading...
Searching...
No Matches
physicsObjectCollection.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physicsObjectCollection.h
10 * @author joswilso
11 * @date 2006-07-12
12 */
13
14#ifndef PHYSICSOBJECTCOLLECTION_H
15#define PHYSICSOBJECTCOLLECTION_H
16
17#include "pandabase.h"
18#include "physicsObject.h"
19#include "pointerToArray.h"
20
21/**
22 * This is a set of zero or more PhysicsObjects. It's handy for returning
23 * from functions that need to return multiple PhysicsObjects.
24 */
25class EXPCL_PANDA_PHYSICS PhysicsObjectCollection {
26PUBLISHED:
29 void operator = (const PhysicsObjectCollection &copy);
31
32 void add_physics_object(PT(PhysicsObject) physics_object);
33 bool remove_physics_object(PT(PhysicsObject) physics_object);
34 void add_physics_objects_from(const PhysicsObjectCollection &other);
35 void remove_physics_objects_from(const PhysicsObjectCollection &other);
36 void remove_duplicate_physics_objects();
37 bool has_physics_object(PT(PhysicsObject) physics_object) const;
38 void clear();
39
40 bool is_empty() const;
41 int get_num_physics_objects() const;
42 PT(PhysicsObject) get_physics_object(int index) const;
43 MAKE_SEQ(get_physics_objects, get_num_physics_objects, get_physics_object);
44 PT(PhysicsObject) operator [] (int index) const;
45 int size() const;
46 INLINE void operator += (const PhysicsObjectCollection &other);
47 INLINE PhysicsObjectCollection operator + (const PhysicsObjectCollection &other) const;
48
49 void output(std::ostream &out) const;
50 void write(std::ostream &out, int indent_level = 0) const;
51
52private:
53 typedef PTA(PT(PhysicsObject)) PhysicsObjects;
54 PhysicsObjects _physics_objects;
55};
56
57/*
58INLINE ostream &operator << (ostream &out, const PhysicsObjectCollection &col) {
59 col.output(out);
60 return out;
61}
62*/
64
65#endif
This is a set of zero or more PhysicsObjects.
A body on which physics will be applied.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.