fbxsdk/utils/fbxusernotification.h Source File

fbxusernotification.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_UTILS_USER_NOTIFICATION_H_
14 #define _FBXSDK_UTILS_USER_NOTIFICATION_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
21 
22 #include <fbxsdk/fbxsdk_nsbegin.h>
23 
24 class FbxLogFile;
25 class FbxMessageEmitter;
27 
35 {
36 public:
39  enum EClass
40  {
41  eError=1,
42  eWarning=2,
43  eInformation=4,
44  eAny=7
45  };
46 
58  FbxAccumulatorEntry(EClass pAEClass, const FbxString& pName, const FbxString& pDescr,
59  FbxString pDetail="", bool pMuteState=true);
60 
65  FbxAccumulatorEntry(const FbxAccumulatorEntry& pAE, bool pSkipDetails);
66 
69 
71  EClass GetClass() const;
72 
74  FbxString GetName() const;
75 
77  FbxString GetDescription() const;
78 
80  int GetDetailsCount() const;
81 
88  const FbxString* GetDetail(int id) const;
89 
91  bool IsMuted() const;
92 
93 private:
94  FbxArray<FbxString*>& GetDetails();
95  void Mute(bool pState);
96 
97  bool mMute;
98  EClass mAEClass;
99  FbxString mName;
100  FbxString mDescr;
101  FbxArray<FbxString*> mDetails;
102 
103  friend class FbxUserNotification;
104 };
105 
106 
112 {
113 public:
125  static FbxUserNotification* Create(FbxManager* pManager,
126  const FbxString& pLogFileName,
127  const FbxString& pSessionDescription);
128 
132  static void Destroy(FbxManager* pManager);
133 
150  FbxString const& pLogFileName,
151  FbxString const& pSessionDescription);
152 
154  virtual ~FbxUserNotification();
155 
162  void InitAccumulator();
163 
167  void ClearAccumulator();
168 
171  enum EEntryID
172  {
183  eEntryStartID
184  };
185 
197  int AddEntry(const int pID, const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass=FbxAccumulatorEntry::eWarning);
198 
207  int AddDetail(int pEntryId);
208 
218  int AddDetail(int pEntryId, FbxString pString);
219 
229  int AddDetail(int pEntryId, FbxNode* pNode);
230 
232  int GetNbEntries() const;
233 
239  const FbxAccumulatorEntry* GetEntry(int pEntryId);
240 
246  const FbxAccumulatorEntry* GetEntryAt(int pEntryIndex) const;
247 
249  int GetNbDetails() const;
250 
260  int GetDetail(int pDetailId, const FbxAccumulatorEntry*& pAE) const;
261 
263 
271  {
273  eSequencedDetails
274  };
275 
287  bool Output(EOutputSource pOutSrc=eAccumulatorEntry, int pIndex = -1, bool pExtraDevicesOnly = false);
288 
297  bool OutputById(EEntryID pId, EOutputSource pOutSrc=eAccumulatorEntry, bool pExtraDevicesOnly = false);
298 
308  bool Output(const FbxString& pName, const FbxString& pDescr, FbxAccumulatorEntry::EClass pClass, bool pExtraDevicesOnly = false);
309 
317  bool Output(FbxUserNotificationFilteredIterator& pAEFIter, bool pExtraDevicesOnly = false);
318 
322  void SetLogMessageEmitter(FbxMessageEmitter * pLogMessageEmitter);
323 
332  virtual void GetLogFilePath(FbxString& pPath);
333 
335  inline FbxString GetLogFileName() { return mLogFileName; }
337 
338 protected:
343  {
344  public:
345  AESequence(FbxAccumulatorEntry* pAE, int pDetailId) :
346  mAE(pAE),
347  mDetailId(pDetailId)
348  {
349  };
350 
352  FbxAccumulatorEntry* AE() { return mAE; }
354  int DetailId() { return mDetailId; }
355 
356  private:
357  FbxAccumulatorEntry* mAE;
358  int mDetailId;
359  };
360 
362 
367  virtual bool PostTerminate();
368 
372  virtual void AccumulatorInit();
373 
377  virtual void AccumulatorClear();
378 
382  virtual void OpenExtraDevices();
383 
391  virtual bool SendToExtraDevices(bool pOutputNow, FbxArray<FbxAccumulatorEntry*>& pEntries);
392 
400  virtual bool SendToExtraDevices(bool pOutputNow, FbxArray<AESequence*>& pAESequence);
401 
411  virtual bool SendToExtraDevices(bool pOutputNow, const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1);
412 
413 
417  virtual void CloseExtraDevices();
418 
420  void ResetAccumulator();
421 
423  void ResetSequence();
424 
429  void SendToLog(EOutputSource pOutSrc, int pId);
430 
435  void SendToLog(const FbxAccumulatorEntry* pAccEntry, int pDetailId = -1);
436 
437 private:
438  FbxString mLogFileName;
439  FbxString* mLog;
440  FbxLogFile* mLogFile;
441  FbxMessageEmitter* mLogMessageEmitter;
442 
443  bool mProperlyInitialized;
444  FbxString mSessionDescription;
445  bool mProperlyCleaned;
446 
447  FbxMultiMap mAccuHT; // The set establish a relationship between an FbxAccumulatorEntry and it's ID
448  FbxArray<FbxAccumulatorEntry*> mAccu; // The array defines the order the FbxAccumulatorEntry objects have been
449  // added to the accumulator (calls to AddEntry)
450  // Both structures share the same pointers.
451  FbxArray<AESequence*> mAESequence;
452  FbxManager* mSdkManager;
453 };
454 
460 {
461 public:
475  int pFilterClass,
477  bool pNoDetail = true);
478 
480 
482  int GetNbItems() const;
483 
485  void Reset();
486 
490  FbxAccumulatorEntry* const First();
491 
499  FbxAccumulatorEntry* const Previous();
500 
508  FbxAccumulatorEntry* const Next();
509 
510 protected:
511  // Called in the constructor.
512  virtual void BuildFilteredList(FbxUserNotification& pAccumulator);
513 
516  bool mNoDetail;
519 };
520 
521 #include <fbxsdk/fbxsdk_nsend.h>
522 
523 #endif /* _FBXSDK_UTILS_USER_NOTIFICATION_H_ */
EOutputSource
Specify send what kind of data to output device.
FBX SDK environment definition.
FbxAccumulatorEntry * AE()
Return the entry object the detail belongs to.
SDK object manager.
Definition: fbxmanager.h:56
FbxString GetLogFileName()
Returns the log file name.
Utility class to manipulate strings.
Definition: fbxstring.h:66
This class accumulates user notifications and sends them to any device opened by the derived classes...
FbxUserNotification::EOutputSource mAccuSrcData
This class iterates through the accumulated messages depending on the configuration flags (filter)...
FbxArray< FbxAccumulatorEntry * > mFilteredAE
AESequence(FbxAccumulatorEntry *pAE, int pDetailId)
Identify one detail in all accumulator entries by record the entry object and its detail id...
Represents an element in the scene graph.
Definition: fbxnode.h:72
Details in the recorded order.
Warning message entry.
EClass
Category of the accumulator entry.
This class defines one entry object held by the FbxUserNotification class.
EEntryID
IDs for pre-defined message entries.
#define FBXSDK_DLL
Definition: fbxarch.h:173
this is generic for reader and writer to log notifications.
int DetailId()
Return the detail id in the entry object.
Class to manipulate a map that can contain multiple times the same key.
Definition: fbxmultimap.h:22