Browse Source

collection operator +

David Rose 17 years ago
parent
commit
fbc38a3e01

+ 23 - 0
panda/src/event/asyncTaskCollection.I

@@ -21,3 +21,26 @@
 INLINE AsyncTaskCollection::
 INLINE AsyncTaskCollection::
 ~AsyncTaskCollection() {
 ~AsyncTaskCollection() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: AsyncTaskCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void AsyncTaskCollection::
+operator += (const AsyncTaskCollection &other) {
+  add_tasks_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: AsyncTaskCollection::operator +
+//       Access: Published
+//  Description: Returns a AsyncTaskCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE AsyncTaskCollection AsyncTaskCollection::
+operator + (const AsyncTaskCollection &other) const {
+  AsyncTaskCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/event/asyncTaskCollection.h

@@ -50,6 +50,8 @@ PUBLISHED:
   void remove_task(int index);
   void remove_task(int index);
   AsyncTask *operator [] (int index) const;
   AsyncTask *operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const AsyncTaskCollection &other);
+  INLINE AsyncTaskCollection operator + (const AsyncTaskCollection &other) const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
   void write(ostream &out, int indent_level = 0) const;

+ 2 - 2
panda/src/ode/Sources.pp

@@ -38,7 +38,7 @@
     odePlane2dJoint.I odePlane2dJoint.h \
     odePlane2dJoint.I odePlane2dJoint.h \
     odeSliderJoint.I odeSliderJoint.h \
     odeSliderJoint.I odeSliderJoint.h \
     odeUniversalJoint.I odeUniversalJoint.h \
     odeUniversalJoint.I odeUniversalJoint.h \
-    odeJointCollection.h \
+    odeJointCollection.I odeJointCollection.h \
     odeSimpleSpace.I odeSimpleSpace.h \
     odeSimpleSpace.I odeSimpleSpace.h \
     odeHashSpace.I odeHashSpace.h \
     odeHashSpace.I odeHashSpace.h \
     odeQuadTreeSpace.I odeQuadTreeSpace.h \
     odeQuadTreeSpace.I odeQuadTreeSpace.h \
@@ -99,7 +99,7 @@
     odePlane2dJoint.I odePlane2dJoint.h \
     odePlane2dJoint.I odePlane2dJoint.h \
     odeSliderJoint.I odeSliderJoint.h \
     odeSliderJoint.I odeSliderJoint.h \
     odeUniversalJoint.I odeUniversalJoint.h \
     odeUniversalJoint.I odeUniversalJoint.h \
-    odeJointCollection.h \
+    odeJointCollection.I odeJointCollection.h \
     odeSimpleSpace.I odeSimpleSpace.h \
     odeSimpleSpace.I odeSimpleSpace.h \
     odeHashSpace.I odeHashSpace.h \
     odeHashSpace.I odeHashSpace.h \
     odeQuadTreeSpace.I odeQuadTreeSpace.h \
     odeQuadTreeSpace.I odeQuadTreeSpace.h \

+ 46 - 0
panda/src/ode/odeJointCollection.I

@@ -0,0 +1,46 @@
+// Filename: odeJointCollection.I
+// Created by:  drose (10Nov08)
+//
+////////////////////////////////////////////////////////////////////
+//
+// 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."
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeJointCollection::Destructor
+//       Access: Published
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE OdeJointCollection::
+~OdeJointCollection() {
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeJointCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void OdeJointCollection::
+operator += (const OdeJointCollection &other) {
+  add_joints_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeJointCollection::operator +
+//       Access: Published
+//  Description: Returns a OdeJointCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE OdeJointCollection OdeJointCollection::
+operator + (const OdeJointCollection &other) const {
+  OdeJointCollection a(*this);
+  a += other;
+  return a;
+}

+ 5 - 1
panda/src/ode/odeJointCollection.h

@@ -26,7 +26,7 @@ PUBLISHED:
   OdeJointCollection();
   OdeJointCollection();
   OdeJointCollection(const OdeJointCollection &copy);
   OdeJointCollection(const OdeJointCollection &copy);
   void operator = (const OdeJointCollection &copy);
   void operator = (const OdeJointCollection &copy);
-  INLINE ~OdeJointCollection() {};
+  INLINE ~OdeJointCollection();
 
 
   void add_joint(const OdeJoint &joint);
   void add_joint(const OdeJoint &joint);
   bool remove_joint(const OdeJoint &joint);
   bool remove_joint(const OdeJoint &joint);
@@ -42,10 +42,14 @@ PUBLISHED:
   MAKE_SEQ(get_joints, get_num_joints, get_joint);
   MAKE_SEQ(get_joints, get_num_joints, get_joint);
   OdeJoint operator [] (int index) const;
   OdeJoint operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const OdeJointCollection &other);
+  INLINE OdeJointCollection operator + (const OdeJointCollection &other) const;
   
   
 private:  
 private:  
   typedef PTA(OdeJoint) Joints;
   typedef PTA(OdeJoint) Joints;
   Joints _joints;
   Joints _joints;
 };
 };
 
 
+#include "odeJointCollection.I"
+
 #endif
 #endif

+ 2 - 0
panda/src/parametrics/parametricCurveCollection.h

@@ -54,12 +54,14 @@ PUBLISHED:
 
 
   INLINE int get_num_curves() const;
   INLINE int get_num_curves() const;
   INLINE ParametricCurve *get_curve(int index) const;
   INLINE ParametricCurve *get_curve(int index) const;
+  MAKE_SEQ(get_curves, get_num_curves, get_curve);
 
 
   ParametricCurve *get_xyz_curve() const;
   ParametricCurve *get_xyz_curve() const;
   ParametricCurve *get_hpr_curve() const;
   ParametricCurve *get_hpr_curve() const;
   ParametricCurve *get_default_curve() const;
   ParametricCurve *get_default_curve() const;
   int get_num_timewarps() const;
   int get_num_timewarps() const;
   ParametricCurve *get_timewarp_curve(int n) const;
   ParametricCurve *get_timewarp_curve(int n) const;
+  MAKE_SEQ(get_timewarp_curves, get_num_timewarps, get_timewarp_curve);
 
 
   INLINE float get_max_t() const;
   INLINE float get_max_t() const;
 
 

+ 23 - 0
panda/src/pgraph/internalNameCollection.I

@@ -21,3 +21,26 @@
 INLINE InternalNameCollection::
 INLINE InternalNameCollection::
 ~InternalNameCollection() {
 ~InternalNameCollection() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: InternalNameCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void InternalNameCollection::
+operator += (const InternalNameCollection &other) {
+  add_names_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: InternalNameCollection::operator +
+//       Access: Published
+//  Description: Returns a InternalNameCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE InternalNameCollection InternalNameCollection::
+operator + (const InternalNameCollection &other) const {
+  InternalNameCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/pgraph/internalNameCollection.h

@@ -43,6 +43,8 @@ PUBLISHED:
   MAKE_SEQ(get_names, get_num_names, get_name);
   MAKE_SEQ(get_names, get_num_names, get_name);
   InternalName *operator [] (int index) const;
   InternalName *operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const InternalNameCollection &other);
+  INLINE InternalNameCollection operator + (const InternalNameCollection &other) const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
   void write(ostream &out, int indent_level = 0) const;

+ 23 - 0
panda/src/pgraph/materialCollection.I

@@ -21,3 +21,26 @@
 INLINE MaterialCollection::
 INLINE MaterialCollection::
 ~MaterialCollection() {
 ~MaterialCollection() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: MaterialCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void MaterialCollection::
+operator += (const MaterialCollection &other) {
+  add_materials_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: MaterialCollection::operator +
+//       Access: Published
+//  Description: Returns a MaterialCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE MaterialCollection MaterialCollection::
+operator + (const MaterialCollection &other) const {
+  MaterialCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/pgraph/materialCollection.h

@@ -44,6 +44,8 @@ PUBLISHED:
   Material *get_material(int index) const;
   Material *get_material(int index) const;
   Material *operator [] (int index) const;
   Material *operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const MaterialCollection &other);
+  INLINE MaterialCollection operator + (const MaterialCollection &other) const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
   void write(ostream &out, int indent_level = 0) const;

+ 23 - 0
panda/src/pgraph/nodePathCollection.I

@@ -22,6 +22,29 @@ INLINE NodePathCollection::
 ~NodePathCollection() {
 ~NodePathCollection() {
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: NodePathCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void NodePathCollection::
+operator += (const NodePathCollection &other) {
+  add_paths_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: NodePathCollection::operator +
+//       Access: Published
+//  Description: Returns a NodePathCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE NodePathCollection NodePathCollection::
+operator + (const NodePathCollection &other) const {
+  NodePathCollection a(*this);
+  a += other;
+  return a;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePathCollection::ls
 //     Function: NodePathCollection::ls
 //       Access: Published
 //       Access: Published

+ 2 - 0
panda/src/pgraph/nodePathCollection.h

@@ -47,6 +47,8 @@ PUBLISHED:
   MAKE_SEQ(get_paths, get_num_paths, get_path);
   MAKE_SEQ(get_paths, get_num_paths, get_path);
   NodePath operator [] (int index) const;
   NodePath operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const NodePathCollection &other);
+  INLINE NodePathCollection operator + (const NodePathCollection &other) const;
 
 
   // Handy operations on many NodePaths at once.
   // Handy operations on many NodePaths at once.
   INLINE void ls() const;
   INLINE void ls() const;

+ 23 - 0
panda/src/pgraph/textureCollection.I

@@ -21,3 +21,26 @@
 INLINE TextureCollection::
 INLINE TextureCollection::
 ~TextureCollection() {
 ~TextureCollection() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextureCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void TextureCollection::
+operator += (const TextureCollection &other) {
+  add_textures_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextureCollection::operator +
+//       Access: Published
+//  Description: Returns a TextureCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE TextureCollection TextureCollection::
+operator + (const TextureCollection &other) const {
+  TextureCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/pgraph/textureCollection.h

@@ -45,6 +45,8 @@ PUBLISHED:
   MAKE_SEQ(get_textures, get_num_textures, get_texture);
   MAKE_SEQ(get_textures, get_num_textures, get_texture);
   Texture *operator [] (int index) const;
   Texture *operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const TextureCollection &other);
+  INLINE TextureCollection operator + (const TextureCollection &other) const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
   void write(ostream &out, int indent_level = 0) const;

+ 23 - 0
panda/src/pgraph/textureStageCollection.I

@@ -21,3 +21,26 @@
 INLINE TextureStageCollection::
 INLINE TextureStageCollection::
 ~TextureStageCollection() {
 ~TextureStageCollection() {
 }
 }
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextureStageCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void TextureStageCollection::
+operator += (const TextureStageCollection &other) {
+  add_texture_stages_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: TextureStageCollection::operator +
+//       Access: Published
+//  Description: Returns a TextureStageCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE TextureStageCollection TextureStageCollection::
+operator + (const TextureStageCollection &other) const {
+  TextureStageCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/pgraph/textureStageCollection.h

@@ -45,6 +45,8 @@ PUBLISHED:
   MAKE_SEQ(get_texture_stages, get_num_texture_stages, get_texture_stage);
   MAKE_SEQ(get_texture_stages, get_num_texture_stages, get_texture_stage);
   TextureStage *operator [] (int index) const;
   TextureStage *operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const TextureStageCollection &other);
+  INLINE TextureStageCollection operator + (const TextureStageCollection &other) const;
 
 
   void sort();
   void sort();
 
 

+ 23 - 0
panda/src/physics/physicsObjectCollection.I

@@ -12,6 +12,7 @@
 //
 //
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PhysicsObjectCollection::Destructor
 //     Function: PhysicsObjectCollection::Destructor
 //       Access: Published
 //       Access: Published
@@ -21,3 +22,25 @@ INLINE PhysicsObjectCollection::
 ~PhysicsObjectCollection() {
 ~PhysicsObjectCollection() {
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::operator +=
+//       Access: Published
+//  Description: Appends the other list onto the end of this one.
+////////////////////////////////////////////////////////////////////
+INLINE void PhysicsObjectCollection::
+operator += (const PhysicsObjectCollection &other) {
+  add_physics_objects_from(other);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysicsObjectCollection::operator +
+//       Access: Published
+//  Description: Returns a PhysicsObjectCollection representing the
+//               concatenation of the two lists.
+////////////////////////////////////////////////////////////////////
+INLINE PhysicsObjectCollection PhysicsObjectCollection::
+operator + (const PhysicsObjectCollection &other) const {
+  PhysicsObjectCollection a(*this);
+  a += other;
+  return a;
+}

+ 2 - 0
panda/src/physics/physicsObjectCollection.h

@@ -46,6 +46,8 @@ PUBLISHED:
   MAKE_SEQ(get_physics_objects, get_num_physics_objects, get_physics_object);
   MAKE_SEQ(get_physics_objects, get_num_physics_objects, get_physics_object);
   PT(PhysicsObject) operator [] (int index) const;
   PT(PhysicsObject) operator [] (int index) const;
   int size() const;
   int size() const;
+  INLINE void operator += (const PhysicsObjectCollection &other);
+  INLINE PhysicsObjectCollection operator + (const PhysicsObjectCollection &other) const;
 
 
   void output(ostream &out) const;
   void output(ostream &out) const;
   void write(ostream &out, int indent_level = 0) const;
   void write(ostream &out, int indent_level = 0) const;