00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Side Effects Software Inc. 00008 * 477 Richmond Street West, Suite 1001 00009 * Toronto, Ontario 00010 * Canada M5V 3E7 00011 * 416-504-9876 00012 */ 00013 00014 #ifndef __SIM_ObjectArray_h__ 00015 #define __SIM_ObjectArray_h__ 00016 00017 #include "SIM_API.h" 00018 #include <UT/UT_PtrArraySorted.h> 00019 00020 class SIM_Object; 00021 class SIM_ObjectAtTime; 00022 class SIM_ConstObjectArray; 00023 class SIM_DataFilter; 00024 00025 /// Holds pointers to a number of SIM_Object objects. 00026 class SIM_API SIM_ObjectArray : 00027 public UT_PtrArraySorted<SIM_Object *> 00028 { 00029 public: 00030 SIM_ObjectArray(); 00031 virtual ~SIM_ObjectArray(); 00032 00033 /// This function returns a pointer the the SIM_Object with the 00034 /// specified object id. If the object id is not found, it returns 00035 /// null. 00036 SIM_Object *findObjectById(int objectid) const; 00037 00038 /// This function returns the index within the array of the object 00039 /// with the specified id. 00040 int findPositionById(int objectid) const; 00041 00042 /// Fills an array with all the objects in this array that match the 00043 /// supplied filter. 00044 void filter(const SIM_DataFilter &filter, 00045 SIM_ObjectArray &filtered) const; 00046 /// Fills an array with all the objects in this array that match the 00047 /// supplied filter. 00048 void filterConst(const SIM_DataFilter &filter, 00049 SIM_ConstObjectArray &filtered) const; 00050 00051 /// This function is used for sorting the objects in the array. 00052 /// It compares objects using the object id values. 00053 static int compareObjectId(SIM_Object * const *, 00054 SIM_Object * const *); 00055 }; 00056 00057 /// Holds pointers to a number of const SIM_Object objects. 00058 class SIM_API SIM_ConstObjectArray : 00059 public UT_PtrArraySorted<const SIM_Object *> 00060 { 00061 public: 00062 SIM_ConstObjectArray(); 00063 virtual ~SIM_ConstObjectArray(); 00064 00065 /// An assignment operator to copy a SIM_ObjectArray into a 00066 /// SIM_ConstObjectArray. 00067 const SIM_ConstObjectArray &operator=(const SIM_ObjectArray &src); 00068 00069 /// This function returns a pointer the the SIM_Object with the 00070 /// specified object id. If the object id is not found, it returns 00071 /// null. 00072 const SIM_Object *findObjectById(int objectid) const; 00073 00074 /// This function returns the index within the array of the object 00075 /// with the specified id. 00076 int findPositionById(int objectid) const; 00077 00078 /// Fills an array with all the objects in this array that match the 00079 /// supplied filter. 00080 void filterConst(const SIM_DataFilter &filter, 00081 SIM_ConstObjectArray &filtered) const; 00082 00083 /// This function is used for sorting the objects in the array. 00084 /// It compares objects using the object id values. 00085 static int compareConstObjectId(const SIM_Object * const *, 00086 const SIM_Object * const *); 00087 }; 00088 00089 class SIM_API SIM_ObjectAtTimeArray : 00090 public UT_PtrArraySorted<SIM_ObjectAtTime *> 00091 { 00092 public: 00093 SIM_ObjectAtTimeArray(int objectid); 00094 virtual ~SIM_ObjectAtTimeArray(); 00095 00096 int getObjectId() const; 00097 00098 /// This function is used for sorting the objects in the array. 00099 /// It compares objects using the object id values. 00100 static int compareObjectTimes(SIM_ObjectAtTime * const *, 00101 SIM_ObjectAtTime * const *); 00102 00103 private: 00104 int myObjectId; 00105 }; 00106 00107 class SIM_API SIM_ObjectAtTimeMatrix : 00108 public UT_PtrArraySorted<SIM_ObjectAtTimeArray *> 00109 { 00110 public: 00111 SIM_ObjectAtTimeMatrix(); 00112 virtual ~SIM_ObjectAtTimeMatrix(); 00113 00114 void deleteAllEntries(); 00115 00116 /// Returns the total number of SIM_ObjectAtTime entries in all the 00117 /// arrays stored in this matrix. 00118 int fullCount() const; 00119 00120 /// Finds or creates a SIM_ObjectAtTimeArray for the object, and adds 00121 /// the specified entry to the array. 00122 void addObjectAtTime(SIM_ObjectAtTime *objectattime); 00123 00124 /// This function is used for sorting the objects in the array. 00125 /// It compares objects using the object id values. 00126 static int compareObjectId(SIM_ObjectAtTimeArray * const *, 00127 SIM_ObjectAtTimeArray * const *); 00128 00129 }; 00130 00131 00132 #endif 00133
1.5.9