00001 #ifndef SAVE_STATUS_H_ 00002 #define SAVE_STATUS_H_ 00003 00004 #include "base/cleancontainers.h" 00005 #include <string> 00006 00007 00008 using namespace std; 00009 00010 /** @ingroup ftk 00011 @{ 00012 00013 00014 */ 00015 00016 00017 /// This structure is used by the SaveStatus class. It contains save status flags. 00018 struct SaveFlag { 00019 bool _initSave; 00020 bool _saved; 00021 bool _notSaved; 00022 bool _requestRestore; 00023 bool _requestRestoreFailed; 00024 bool _restoreBegun; 00025 bool _initRestore; 00026 bool _restored; 00027 bool _notRestored; 00028 }; 00029 00030 00031 typedef map<string, SaveFlag> SAVE_MAP; 00032 00033 typedef map<string, SaveFlag>::iterator SAVE_MAP_ITR; 00034 00035 00036 /** The SaveStatus class handles the status flags that are set by the RTI Federate 00037 Ambassador during the Federation save and restore process. This class is used 00038 by the TimeManager class. 00039 */ 00040 class SaveStatus 00041 { 00042 public: 00043 /** This method initiates the Federation save process. 00044 @param saveLabel A string label that identifies the synchronization point. 00045 @return The success if the registration call succeeded and false if a 00046 registration point with the samelable already exists. 00047 */ 00048 bool initiateSave(string saveLabel); 00049 00050 00051 /** Get the flag that indicates save registration success. 00052 @param saveLabel A string label that identifies the synchronization point. 00053 @return the registered flag if it is set and false if the flag is not set. 00054 */ 00055 bool initSaveFlagGet(string saveLabel); 00056 00057 00058 /** Get the flag that indicates the success of the save. 00059 @param saveLabel A string label that identifies the synchronization point. 00060 @return the saved flag if it is set and false if it is not set. 00061 */ 00062 bool savedFlagGet(string saveLabel); 00063 00064 00065 /** Get the flag that indicates the save failed. 00066 @param saveLabel A string label that identifies the synchronization point. 00067 @return the notSaved flag if it is set and false if it is not set. 00068 */ 00069 bool notSavedFlagGet(string saveLabel); 00070 00071 00072 /** Get the flag that indicates the restore succeeded. 00073 @param saveLabel A string label that identifies the synchronization point. 00074 @return the restoreSucceeded flag if it is set and false if it is not set. 00075 */ 00076 bool requestRestoreFlagGet(string saveLabel); 00077 00078 00079 /** Get the flag that indicates the restore failed. 00080 @param saveLabel A string label that identifies the synchronization point. 00081 @return the restoreSucceeded flag if it is set and false if it is not set. 00082 */ 00083 bool requestRestoreFailedFlagGet(string saveLabel); 00084 00085 00086 /** Get the flag that indicates synchronization restore begun. 00087 @param saveLabel A string label that identifies the synchronization point. 00088 @return the restoreBegun flag if it is set and false if it is not set. 00089 */ 00090 bool restoreBegunFlagGet(string saveLabel); 00091 00092 00093 /** Get the flag that indicates synchronization restore initiated. 00094 @param saveLabel A string label that identifies the synchronization point. 00095 @return the initRestoreflag if it is set and false if it is not set. 00096 */ 00097 bool initRestoreFlagGet(string saveLabel); 00098 00099 00100 /** Get the flag that indicates the synchronization has been restored. 00101 @param saveLabel A string label that identifies the synchronization point. 00102 @return the restored flag if it is set and false if it is not set. 00103 */ 00104 bool restoredFlagGet(string saveLabel); 00105 00106 00107 /** Get the flag that indicates the synchronization has NOT been restored. 00108 @param saveLabel A string label that identifies the synchronization point. 00109 @return the notRestored flag if it is set and false if it is not set. 00110 */ 00111 bool notRestoredFlagGet(string saveLabel); 00112 00113 00114 /** Set the initiate synchronization point save flag. 00115 @param saveLabel A string label that identifies the synchronization point. 00116 @param flag The initiateSave flag. 00117 */ 00118 void initSaveFlagSet(string saveLabel, bool flag); 00119 00120 00121 /** Set the synchronization saved flag. 00122 @param saveLabel A string label that identifies the synchronization point. 00123 @param flag The saved flag. 00124 */ 00125 void savedFlagSet(string saveLabel, bool flag); 00126 00127 00128 /** Set the synchronization not saved flag. 00129 @param saveLabel A string label that identifies the synchronization point. 00130 @param flag The notSaved flag. 00131 */ 00132 void notSavedFlagSet(string saveLabel, bool flag); 00133 00134 00135 /** Set the requestRestore flag. 00136 @param saveLabel A string label that identifies the synchronization point. 00137 @param flag The requestRestore flag. 00138 */ 00139 void requestRestoreFlagSet(string saveLabel, bool flag); 00140 00141 00142 /** Set the requestRestoreFailed flag. 00143 @param saveLabel A string label that identifies the synchronization point. 00144 @param flag The requestRestoreFailed flag. 00145 */ 00146 void requestRestoreFailedFlagSet(string saveLabel, bool flag); 00147 00148 00149 /** Set the restoreBegun flag. 00150 @param saveLabel A string label that identifies the synchronization point. 00151 @param flag The restoreBegun flag. 00152 */ 00153 void restoreBegunFlagSet(string saveLabel, bool flag); 00154 00155 00156 /** Set the initRestore flag. 00157 @param saveLabel A string label that identifies the synchronization point. 00158 @param flag The initRestore flag. 00159 */ 00160 void initRestoreFlagSet(string saveLabel, bool flag); 00161 00162 00163 /** Set the restored flag. 00164 @param saveLabel A string label that identifies the synchronization point. 00165 @param flag The restored flag. 00166 */ 00167 void restoredFlagSet(string saveLabel, bool flag); 00168 00169 00170 /** Set the notRestored flag. 00171 @param saveLabel A string label that identifies the synchronization point. 00172 @param flag The notRestored flag. 00173 */ 00174 void notRestoredFlagSet(string saveLabel, bool flag); 00175 00176 00177 /** The reset method clears the saveFlag map. 00178 */ 00179 void reset(); 00180 00181 private: 00182 SAVE_MAP _saveMap; 00183 00184 }; 00185 00186 /** 00187 @} 00188 */ 00189 00190 #endif // SAVE_STATUS_H_ 00191