fbxstatistics.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /****************************************************************************************
  2. Copyright (C) 2015 Autodesk, Inc.
  3. All rights reserved.
  4. Use of this software is subject to the terms of the Autodesk license agreement
  5. provided at the time of installation or download, or which otherwise accompanies
  6. this software in either electronic or hard copy form.
  7. ****************************************************************************************/
  8. //! \file fbxstatistics.h
  9. #ifndef _FBXSDK_FILEIO_STATISTICS_H_
  10. #define _FBXSDK_FILEIO_STATISTICS_H_
  11. #include <fbxsdk/fbxsdk_def.h>
  12. #include <fbxsdk/core/base/fbxarray.h>
  13. #include <fbxsdk/core/base/fbxstring.h>
  14. #include <fbxsdk/fbxsdk_nsbegin.h>
  15. /** This class is a basic class to get the quantity of items.
  16. * User processes the statistics raw data by deriving FbxStatistics class and overrides \c AddItem method.
  17. * When overriding \c AddItem method, User must store item's name and item's count by pair which means
  18. * The index of one item's name in array \c mItemName is the same as the index of this item's count in array \c mItemCount.
  19. *
  20. * \code Here is a code snippet to show how it used.
  21. * //Define my own statistics class.
  22. * class MyStatistics : public FbxStatistics
  23. * {
  24. * public:
  25. virtual bool AddItem(FbxString& pItemName, int pItemCount)
  26. {
  27. mItemName.Add( FbxSdkNew< FbxString >(pItemName) );
  28. mItemCount.Add( pItemCount);
  29. return true;
  30. };
  31. * };
  32. *
  33. * FbxManager* lSdkManager = FbxManager::Create();
  34. * FbxScene* lScene = FbxScene::Create( lSdkManager, "Scene");
  35. * FbxNode* lNode1 = FbxNode::Create(lScene, "Node1");
  36. * FbxNode* lNode2 = FbxNode::Create(lScene, "Node2");
  37. * FbxNode* lNode3 = FbxNode::Create(lScene, "Node3");
  38. * FbxNode* lNode4 = FbxNode::Create(lScene, "Node4");
  39. * lScene.AddNode(lNode1);
  40. * lScene.AddNode(lNode2);
  41. * lScene.AddNode(lNode3);
  42. * MyStatistics lStatistics;
  43. * lStatistics.AddItem("Node_Count", lScene.GetNodeCount() );
  44. * FbxString lItemName;
  45. * int lItemCount;
  46. * if( lStatistics.GetItemPair( 0, lItemName, lItemCount))
  47. * {
  48. * //do something
  49. * }
  50. * \endcode
  51. * \nosubgrouping
  52. */
  53. class FBXSDK_DLL FbxStatistics
  54. {
  55. public:
  56. /// \name Constructor and Destructor.
  57. //@{
  58. FbxStatistics();
  59. virtual ~FbxStatistics();
  60. //@}
  61. //! Reset the statistics.
  62. void Reset();
  63. //! Get the number of items.
  64. int GetNbItems() const;
  65. /** Get the statistics information by pair.
  66. * \param pNum The index of statistics data to be got.
  67. * \param pItemName Output the item's name.
  68. * \param pItemCount Output the item's count.
  69. * \return \c True if successful, \c False otherwise.
  70. */
  71. bool GetItemPair(int pNum, FbxString& pItemName, int& pItemCount) const;
  72. /** Assignment operator.
  73. * \param pStatistics FbxStatistics assigned to this one.
  74. */
  75. FbxStatistics& operator=(const FbxStatistics& pStatistics);
  76. protected:
  77. /** virtual function to define the process of the incoming statistics data.
  78. * \param pItemName The item's name
  79. * \param pItemCount The item's count.
  80. * \return False.
  81. */
  82. virtual bool AddItem(FbxString& /*pItemName*/, int /*pItemCount*/) { return false; };
  83. //! An array to store item's name.
  84. FbxArray<FbxString*> mItemName;
  85. //! An array to store item's count.
  86. FbxArray<int> mItemCount;
  87. };
  88. #include <fbxsdk/fbxsdk_nsend.h>
  89. #endif /* _FBXSDK_FILEIO_STATISTICS_H_ */