fbxsdk/utils/fbxusernotification.h Source File
 
 
 
fbxsdk/utils/fbxusernotification.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_UTILS_USER_NOTIFICATION_H_
00014 #define _FBXSDK_UTILS_USER_NOTIFICATION_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxarray.h>
00019 #include <fbxsdk/core/base/fbxstring.h>
00020 #include <fbxsdk/core/base/fbxset.h>
00021 
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023 
00024 class FbxLogFile;
00025 class FbxMessageEmitter;
00026 class FbxUserNotificationFilteredIterator;
00027 
00034 class FBXSDK_DLL FbxAccumulatorEntry
00035 {
00036 public:
00039     enum EClass
00040         {
00041         eError=1,    
00042         eWarning=2,  
00043         eInformation=4,     
00044         eAny=7       
00045     };
00046 
00058     FbxAccumulatorEntry(EClass pAEClass, const FbxString& pName, const FbxString& pDescr, 
00059                      FbxString pDetail="", bool pMuteState=true);
00060 
00065     FbxAccumulatorEntry(const FbxAccumulatorEntry& pAE, bool pSkipDetails);
00066 
00068     ~FbxAccumulatorEntry();
00069 
00071     EClass GetClass() const;
00072 
00074     FbxString GetName() const;
00075 
00077     FbxString    GetDescription() const;
00078 
00080     int GetDetailsCount() const;
00081 
00088     const FbxString* GetDetail(int id) const;
00089 
00091     bool IsMuted() const;
00092 
00093 private:
00094     FbxArray<FbxString*>&       GetDetails();
00095     void                                        Mute(bool pState);
00096 
00097     bool                                        mMute;
00098     EClass                                      mAEClass;
00099     FbxString                           mName;
00100     FbxString                           mDescr;
00101     FbxArray<FbxString*>        mDetails;
00102 
00103         friend class FbxUserNotification;
00104 };
00105 
00106 
00111 class FBXSDK_DLL FbxUserNotification
00112 {
00113 public:
00125     static FbxUserNotification* Create(FbxManager* pManager, 
00126                                         const FbxString& pLogFileName, 
00127                                         const FbxString& pSessionDescription);
00128 
00132     static void Destroy(FbxManager* pManager);
00133 
00149     FbxUserNotification(FbxManager* pManager,
00150                          FbxString const& pLogFileName, 
00151                          FbxString const& pSessionDescription);
00152 
00154     virtual ~FbxUserNotification();
00155 
00162     void InitAccumulator();
00163 
00167     void ClearAccumulator();
00168 
00171     enum EEntryID
00172         {
00173         eBindPoseInvalidObject,
00174         eBindPoseInvalidRoot,
00175         eBindPoseNotAllAncestorsNodes,
00176         eBindPoseNotAllDeformingNodes,
00177         eBindPoseNotAllAncestorsDefinitionNodes,
00178         eBindPoseRelativeMatrix,
00179         eEmbedMediaNotify,
00180         eFileIONotify,                                          
00181         eFileIONotifyMaterial,
00182         eFileIONotifyDXFNotSupportNurbs,
00183         eEntryStartID                                           
00184     };
00185 
00197     int AddEntry(const int pID, const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass=FbxAccumulatorEntry::eWarning);
00198 
00207     int AddDetail(int pEntryId);
00208 
00218     int AddDetail(int pEntryId, FbxString pString);
00219 
00229     int AddDetail(int pEntryId, FbxNode* pNode);
00230 
00232     int  GetNbEntries() const;
00233 
00239     const FbxAccumulatorEntry* GetEntry(int pEntryId) const;
00240 
00246     const FbxAccumulatorEntry* GetEntryAt(int pEntryIndex) const;
00247 
00249     int GetNbDetails() const;
00250 
00260     int GetDetail(int pDetailId, const FbxAccumulatorEntry*& pAE) const;
00261 
00263 
00270     enum EOutputSource
00271         {
00272         eAccumulatorEntry,     
00273         eSequencedDetails      
00274     };
00275 
00287     bool Output(EOutputSource pOutSrc=eAccumulatorEntry, int pIndex = -1, bool pExtraDevicesOnly = false);
00288 
00297     bool OutputById(EEntryID pId, EOutputSource pOutSrc=eAccumulatorEntry, bool pExtraDevicesOnly = false);
00298 
00308     bool Output(const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass, bool pExtraDevicesOnly = false);
00309 
00317     bool Output(FbxUserNotificationFilteredIterator& pAEFIter, bool pExtraDevicesOnly = false);
00318 
00322     void SetLogMessageEmitter(FbxMessageEmitter * pLogMessageEmitter);
00323 
00332     virtual void GetLogFilePath(FbxString& pPath);
00333     
00335     inline FbxString GetLogFileName() { return mLogFileName; }
00337 
00338 protected:
00342     class AESequence
00343     {
00344     public:
00345         AESequence(FbxAccumulatorEntry* pAE, int pDetailId) :
00346             mAE(pAE),
00347             mDetailId(pDetailId)
00348             {
00349             };
00350 
00352         FbxAccumulatorEntry* AE() { return mAE; }
00354         int DetailId() { return mDetailId; }
00355 
00356     private:
00357         FbxAccumulatorEntry* mAE;
00358         int mDetailId;
00359     };
00360 
00361     friend class FbxUserNotificationFilteredIterator;
00362 
00367     virtual bool PostTerminate();
00368 
00372     virtual void AccumulatorInit();
00373 
00377     virtual void AccumulatorClear();
00378 
00382     virtual void OpenExtraDevices();
00383 
00391     virtual bool SendToExtraDevices(bool pOutputNow, FbxArray<FbxAccumulatorEntry*>& pEntries);
00392 
00400     virtual bool SendToExtraDevices(bool pOutputNow, FbxArray<AESequence*>& pAESequence);
00401 
00411     virtual bool SendToExtraDevices(bool pOutputNow, const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1);
00412 
00413     
00417     virtual void CloseExtraDevices();
00418 
00420     void ResetAccumulator();
00421 
00423     void ResetSequence();
00424 
00429     void SendToLog(EOutputSource pOutSrc, int pId);
00430 
00435     void SendToLog(const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1);
00436 
00437 private:
00438     FbxString mLogFileName;
00439     FbxString* mLog;
00440     FbxLogFile* mLogFile;
00441     FbxMessageEmitter* mLogMessageEmitter;
00442 
00443     bool mProperlyInitialized;
00444     FbxString mSessionDescription;
00445     bool mProperlyCleaned;
00446 
00447     FbxSet mAccuHT;                             // The set establish a relationship between an FbxAccumulatorEntry and it's ID
00448     FbxArray<FbxAccumulatorEntry*> mAccu;  // The array defines the order the FbxAccumulatorEntry objects have been 
00449                                               // added to the accumulator (calls to AddEntry)
00450                                               // Both structures share the same pointers.
00451     FbxArray<AESequence*> mAESequence;
00452     FbxManager*             mSdkManager;
00453 };
00454 
00459 class FBXSDK_DLL FbxUserNotificationFilteredIterator
00460 {
00461 public:
00474     FbxUserNotificationFilteredIterator(FbxUserNotification& pAccumulator, 
00475             int pFilterClass,
00476             FbxUserNotification::EOutputSource pSrc = FbxUserNotification::eSequencedDetails,
00477             bool pNoDetail = true);
00478 
00479     virtual ~FbxUserNotificationFilteredIterator();
00480 
00482     int  GetNbItems() const;
00483 
00485     void Reset();
00486 
00490     FbxAccumulatorEntry* const First();
00491 
00499     FbxAccumulatorEntry* const Previous();
00500 
00508     FbxAccumulatorEntry* const Next();
00509 
00510 protected:
00511     // Called in the constructor.
00512     virtual void BuildFilteredList(FbxUserNotification& pAccumulator);
00513 
00514     int                                    mIterator;
00515     int                                    mFilterClass;
00516     bool                                mNoDetail;
00517     FbxUserNotification::EOutputSource    mAccuSrcData;
00518     FbxArray<FbxAccumulatorEntry*>    mFilteredAE;
00519 };
00520 
00521 #include <fbxsdk/fbxsdk_nsend.h>
00522 
00523 #endif /* _FBXSDK_UTILS_USER_NOTIFICATION_H_ */