00001 /****************************************************************************************/ 00002 /* TKARRAY.H */ 00003 /* */ 00004 /* Author: Stephen Balkum */ 00005 /* Description: Time-keyed events interface. */ 00006 /* */ 00007 /* The contents of this file are subject to the Genesis3D Public License */ 00008 /* Version 1.01 (the "License"); you may not use this file except in */ 00009 /* compliance with the License. You may obtain a copy of the License at */ 00010 /* http://www.genesis3d.com */ 00011 /* */ 00012 /* Software distributed under the License is distributed on an "AS IS" */ 00013 /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See */ 00014 /* the License for the specific language governing rights and limitations */ 00015 /* under the License. */ 00016 /* */ 00017 /* The Original Code is Genesis3D, released March 25, 1999. */ 00018 /* Genesis3D Version 1.1 released November 15, 1999 */ 00019 /* Copyright (C) 1999 WildTangent, Inc. All Rights Reserved */ 00020 /* */ 00021 /****************************************************************************************/ 00022 #ifndef GE_TKEVENTS_H 00023 #define GE_TKEVENTS_H 00024 /* TKEvents 00025 (Time-Keyed-Events) 00026 This module is designed primarily to support motion.c 00027 00028 geTKEvents is a sorted array of times with an identifying descriptor. 00029 The descriptors are stored as strings in a separate, packed buffer. 00030 00031 Error conditions are reported to errorlog 00032 */ 00033 00034 #include "basetype.h" 00035 #include "vfile.h" 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 typedef struct geTKEvents geTKEvents; 00042 typedef geFloat geTKEvents_TimeType; 00043 00044 geTKEvents* GENESISCC geTKEvents_Create(void); 00045 // Creates a new event array. 00046 00047 void GENESISCC geTKEvents_Destroy(geTKEvents** pEvents); 00048 // Destroys array. 00049 00050 geBoolean GENESISCC geTKEvents_Insert(geTKEvents* pEvents, geTKEvents_TimeType tKey, const char* pEventData); 00051 // Inserts the new key and corresponding data. 00052 00053 geBoolean GENESISCC geTKEvents_Delete(geTKEvents* pEvents, geTKEvents_TimeType tKey); 00054 // Deletes the key 00055 00056 geTKEvents* GENESISCC geTKEvents_CreateFromFile( 00057 geVFile* pFile); // stream positioned at array data 00058 // Creates a new array from the given stream. 00059 00060 geBoolean GENESISCC geTKEvents_WriteToFile( 00061 const geTKEvents* pEvents, // sorted array to write 00062 geVFile* pFile); // stream positioned for writing 00063 // Writes the array to the given stream. 00064 00065 geBoolean GENESISCC geTKEvents_WriteToBinaryFile( 00066 const geTKEvents* pEvents, // sorted array to write (in binary format) 00067 geVFile* pFile); // stream positioned for writing 00068 // Writes the array to the given stream. 00069 //--------------------------------------------------------------------------- 00070 // Event Iteration 00071 00072 void GENESISCC geTKEvents_SetupIterator( 00073 geTKEvents* pEvents, // Event list to iterate 00074 geTKEvents_TimeType StartTime, // Inclusive search start 00075 geTKEvents_TimeType EndTime); // Non-inclusive search stop 00076 // For searching or querying the array for events between two times 00077 // times are compaired [StartTime,EndTime), '[' is inclusive, ')' is 00078 // non-inclusive. This prepares the PathGetNextEvent() function. 00079 00080 geBoolean GENESISCC geTKEvents_GetNextEvent( 00081 geTKEvents* pEvents, // Event list to iterate 00082 geTKEvents_TimeType *pTime, // Return time, if found 00083 const char **ppEventString); // Return data, if found 00084 // Iterates from StartTime to EndTime as setup in geTKEvents_CreateIterator() 00085 // and for each event between these times [StartTime,EndTime) 00086 // this function will return Time and EventString returned for that event 00087 // and the iterator will be positioned for the next search. When there 00088 // are no more events in the range, this function will return GE_FALSE (Time 00089 // will be 0 and ppEventString will be empty). 00090 00091 GENESISAPI geBoolean GENESISCC geTKEvents_GetExtents( 00092 geTKEvents *Events, 00093 geTKEvents_TimeType *FirstEventTime, // time of first event 00094 geTKEvents_TimeType *LastEventTime); // time of last event 00095 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 00100 00101 00102 #endif // __TKEVENTS_H__
1.3.2