00001 /******************************************************************************* 00002 * Copyright (c) 2006 International Business Machines Corporation 00003 * All rights reserved. This program and the accompanying materials 00004 * are made available under the terms of the Common Public License v1.0 00005 * which accompanies this distribution, and is available at 00006 * http://www.opensource.org/licenses/cpl1.0.php 00007 * 00008 * Contributors: 00009 * Douglas Sprague, Joel Wheeler - initial API and implementation 00010 * 00011 *****************************************************************************/ 00012 00013 #ifndef STILVectorEvent_H 00014 #define STILVectorEvent_H 00015 00016 #include "stilcom.h" 00017 #include "stilcomstr.h" 00018 00019 #include "stilevent.h" 00020 #include "stiltimeexpr.h" 00021 #include "stileventlist.h" 00022 #include "stiltimelist.h" 00023 00024 #define MAX_EVENT_LENGTH 100 00025 00026 //--------------------------------------------------------------------------- 00032 //--------------------------------------------------------------------------- 00033 class STILVectorEvent { 00034 00035 public: 00036 // - Default Constructor to create and initialize a STILVectorEvent object 00037 STILVectorEvent(); 00038 00039 // - Copy Constructor 00040 STILVectorEvent(const STILVectorEvent &); 00041 00042 // - Destructor which frees storage associated with the STILVectorEvent 00043 ~STILVectorEvent(); 00044 00045 // - The assignment operator 00046 STILVectorEvent& operator=(const STILVectorEvent &); 00047 00048 // - The equality operator 00049 bool operator==(const STILVectorEvent& ) const; 00050 // - The less than operator 00051 // This will need to be changed (in .cpp) if the event times are also 00052 // supposed to be stored with this object- for now assume that they aren't 00053 bool operator<(const STILVectorEvent& ) const; 00054 00055 // - Initialize this object 00056 void init(); 00057 00058 // - Get the number of events 00059 LONG getCount() const; 00060 00061 // - Get the specified vector event or time value (indexing starts at 1, not 0) 00062 STILEvent getEvent(LONG) const; 00063 const STILTimeExpr getTime(LONG) const; 00064 00065 // - Set the specified vector event or time value 00066 void addEvent(STILEvent); 00067 void addTime(const STILTimeExpr&); 00068 00069 // - Set/Get the base WFC for where this vector event originated 00070 void setWFC(const char c); 00071 const char getWFC() const; 00072 00073 // For testing: print the vector events 00074 void print() const; 00075 00076 private: 00077 00078 // - There can be a list of events and times corresponding to 00079 // one vector event 00080 // For example, P could translate to U/D/X 00081 STILEventList m_eventList; 00082 STILTimeList m_timeList; 00083 00084 char m_WFC; // The original WFC, before it is mapped to events and times 00085 00086 }; 00087 00088 //-------------------------------------------------------------------------- 00096 //-------------------------------------------------------------------------- 00097 // - Set/Get the base WFC for where this vector event originated 00098 inline void STILVectorEvent::setWFC(const char c) { m_WFC = c; } 00099 00100 //-------------------------------------------------------------------------- 00108 //-------------------------------------------------------------------------- 00109 inline const char STILVectorEvent::getWFC() const { return m_WFC; } 00110 00111 //-------------------------------------------------------------------------- 00119 //-------------------------------------------------------------------------- 00120 inline STILEvent STILVectorEvent::getEvent(LONG en) const { return m_eventList[en-1]; } 00121 00122 //-------------------------------------------------------------------------- 00130 //-------------------------------------------------------------------------- 00131 inline const STILTimeExpr STILVectorEvent::getTime(LONG t) const { return m_timeList[t-1]; } 00132 00133 //-------------------------------------------------------------------------- 00141 //-------------------------------------------------------------------------- 00142 inline LONG STILVectorEvent::getCount() const { return m_eventList.getCount(); } 00143 00144 #endif