00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXUSERNOTIFICATION_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXUSERNOTIFICATION_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <stdio.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00045 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kset.h>
00047
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049
00050 class KFbxMessageEmitter;
00051 class KFbxNode;
00052 class KFbxUserNotificationFilteredIterator;
00053 class KFbxSdkManager;
00054 class KFbxLogFile;
00055
00061 class KFBX_DLL AccumulatorEntry
00062 {
00063 public:
00070 enum AEClass {
00071 eAE_ERROR=1,
00072 eAE_WARNING=2,
00073 eAE_INFO=4,
00074 eAE_ANY=7
00075 };
00076
00088 AccumulatorEntry(AEClass pAEClass, const KString& pName, const KString& pDescr,
00089 KString pDetail="", bool pMuteState=true);
00090
00095 AccumulatorEntry(const AccumulatorEntry& pAE, bool pSkipDetails);
00096
00098 ~AccumulatorEntry();
00099
00101 AEClass GetClass() const;
00102
00104 KString GetName() const;
00105
00107 KString GetDescription() const;
00108
00110 int GetDetailsCount() const;
00111
00116 const KString* GetDetail(int id) const;
00117
00119 bool IsMuted() const;
00120
00121 private:
00122 friend class KFbxUserNotification;
00123 KArrayTemplate<KString*>& GetDetails();
00124 void Mute(bool pState);
00125
00126 bool mMute;
00127 AEClass mAEClass;
00128 KString mName;
00129 KString mDescr;
00130 KArrayTemplate<KString*> mDetails;
00131 };
00132
00133
00139 class KFBX_DLL KFbxUserNotification
00140 {
00141 public:
00142 static KFbxUserNotification* Create(KFbxSdkManager* pManager,
00143 const KString& pLogFileName,
00144 const KString& pSessionDescription);
00145
00146 static void Destroy(KFbxSdkManager* pManager);
00147
00163 KFbxUserNotification(KFbxSdkManager* pManager,
00164 KString const& pLogFileName,
00165 KString const& pSessionDescription);
00166
00168 virtual ~KFbxUserNotification();
00169
00174 void InitAccumulator();
00175
00179 void ClearAccumulator();
00180
00192 enum AEid {
00193 eBINDPOSE_INVALIDOBJECT = 0x0000,
00194 eBINDPOSE_INVALIDROOT,
00195 eBINDPOSE_NOTALLANCESTORS_NODES,
00196 eBINDPOSE_NOTALLDEFORMING_NODES,
00197 eBINDPOSE_NOTALLANCESTORS_DEFNODES,
00198 eBINDPOSE_RELATIVEMATRIX,
00199 eFILE_IO_NOTIFICATION,
00200 eFILE_IO_NOTIFICATION_MATERIAL,
00201 eAE_START_ID
00202 };
00203
00215 int AddEntry(const int pID, const KString& pName, const KString& pDescr, AccumulatorEntry::AEClass pClass=AccumulatorEntry::eAE_WARNING);
00216
00225 int AddDetail(int pEntryId);
00226
00236 int AddDetail(int pEntryId, KString pString);
00237
00247 int AddDetail(int pEntryId, KFbxNode* pNode);
00248
00250 int GetNbEntries() const;
00251
00257 const AccumulatorEntry* GetEntry(int pEntryId) const;
00258
00264 const AccumulatorEntry* GetEntryAt(int pEntryIndex) const;
00265
00267 int GetNbDetails() const;
00268
00278 int GetDetail(int pDetailId, const AccumulatorEntry*& pAE) const;
00279
00281
00290 enum OutputSource {
00291 eACCUMULATOR_ENTRY,
00292 eSEQUENCED_DETAILS
00293 };
00294
00306 bool Output(OutputSource pOutSrc=eACCUMULATOR_ENTRY, int pIndex = -1, bool pExtraDevicesOnly = false);
00307
00316 bool OutputById(AEid pId, OutputSource pOutSrc=eACCUMULATOR_ENTRY, bool pExtraDevicesOnly = false);
00317
00327 bool Output(const KString& pName, const KString& pDescr, AccumulatorEntry::AEClass pClass, bool pExtraDevicesOnly = false);
00328
00336 bool Output(KFbxUserNotificationFilteredIterator& pAEFIter, bool pExtraDevicesOnly = false);
00337
00346 virtual void GetLogFilePath(KString& pPath);
00347
00350 inline KString GetLogFileName() { return mLogFileName; }
00352
00353 protected:
00354 class AESequence
00355 {
00356 public:
00357 AESequence(AccumulatorEntry* pAE, int pDetailId) :
00358 mAE(pAE),
00359 mDetailId(pDetailId)
00360 {
00361 };
00362
00363 AccumulatorEntry* AE() { return mAE; }
00364 int DetailId() { return mDetailId; }
00365
00366 private:
00367 AccumulatorEntry* mAE;
00368 int mDetailId;
00369 };
00370
00371 friend class KFbxUserNotificationFilteredIterator;
00372
00377 virtual bool PostTerminate();
00378
00382 virtual void AccumulatorInit();
00383
00387 virtual void AccumulatorClear();
00388
00392 virtual void OpenExtraDevices();
00393
00401 virtual bool SendToExtraDevices(bool pOutputNow, KArrayTemplate<AccumulatorEntry*>& pEntries);
00402
00410 virtual bool SendToExtraDevices(bool pOutputNow, KArrayTemplate<AESequence*>& pAESequence);
00411
00421 virtual bool SendToExtraDevices(bool pOutputNow, const AccumulatorEntry* pAccEntry, int pDetailId = -1);
00422
00423
00427 virtual void CloseExtraDevices();
00428
00430 void ResetAccumulator();
00431
00433 void ResetSequence();
00434
00439 void SendToLog(OutputSource pOutSrc, int pId);
00440
00445 void SendToLog(const AccumulatorEntry* pAccEntry, int pDetailId = -1);
00446
00447 private:
00448 KString mLogFileName;
00449 KString* mLog;
00450 KFbxLogFile* mLogFile;
00451 KFbxMessageEmitter* mLogMessageEmitter;
00452
00453 bool mProperlyInitialized;
00454 KString mSessionDescription;
00455 bool mProperlyCleaned;
00456
00457 KSet mAccuHT;
00458 KArrayTemplate<AccumulatorEntry*> mAccu;
00459
00460
00461 KArrayTemplate<AESequence*> mAESequence;
00462 KFbxSdkManager* mSdkManager;
00463 };
00464
00465 #if 0
00466
00471 class KFBX_DLL KFbxUserNotificationFILE : public KFbxUserNotification
00472 {
00473 public:
00474
00475 KFbxUserNotificationFILE(KString pFileDevice, KString pLogFileName="", KString pSessionDescription="");
00476 virtual ~KFbxUserNotificationFILE();
00477
00478 virtual void OpenExtraDevices();
00479 virtual bool SendToExtraDevices(bool pOutputNow, KArrayTemplate<AccumulatorEntry*>& pEntries);
00480 virtual bool SendToExtraDevices(bool pOutputNow, KArrayTemplate<AESequence*>& pAESequence);
00481 virtual bool SendToExtraDevices(bool pOutputNow, const AccumulatorEntry* pAccEntry, int pDetailId = -1);
00482 virtual void CloseExtraDevices();
00483
00484 private:
00485 KString mFileDevice;
00486 FILE* mFP;
00487 int mUseStream;
00488 };
00489 #endif
00490
00494 class KFBX_DLL KFbxUserNotificationFilteredIterator
00495 {
00496 public:
00509 KFbxUserNotificationFilteredIterator(KFbxUserNotification& pAccumulator,
00510 int pFilterClass,
00511 KFbxUserNotification::OutputSource pSrc = KFbxUserNotification::eSEQUENCED_DETAILS,
00512 bool pNoDetail = true);
00513
00514 virtual ~KFbxUserNotificationFilteredIterator();
00515
00517 int GetNbItems() const;
00518
00520 void Reset();
00521
00525 AccumulatorEntry* const First();
00526
00534 AccumulatorEntry* const Previous();
00535
00543 AccumulatorEntry* const Next();
00544
00545 protected:
00546
00547 virtual void BuildFilteredList(KFbxUserNotification& pAccumulator);
00548
00549 int mIterator;
00550 int mFilterClass;
00551 bool mNoDetail;
00552 KFbxUserNotification::OutputSource mAccuSrcData;
00553 KArrayTemplate<AccumulatorEntry*> mFilteredAE;
00554 };
00555
00556
00557 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00558
00559 #endif // FBXFILESDK_KFBXPLUGINS_KFBXUSERNOTIFICATION_H
00560