gwnavruntime/kernel/SF_MemItem.h Source File

SF_MemItem.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #ifndef INC_KY_KERNEL_MEM_ITEM_H
8 #define INC_KY_KERNEL_MEM_ITEM_H
9 
13 
14 namespace Kaim {
15 
16 
17 // Image data, part of MemItem
18 struct MemItemExtra : public RefCountBase<MemItemExtra, Stat_Default_Mem>
19 {
20  UInt32 ImageId;
21  UInt32 AtlasId;
22  SInt32 AtlasRectTop;
23  SInt32 AtlasRectBottom;
24  SInt32 AtlasRectLeft;
25  SInt32 AtlasRectRight;
26 
27  MemItemExtra(UInt32 imageId) : ImageId(imageId), AtlasId(0),
28  AtlasRectTop(0), AtlasRectBottom(0), AtlasRectLeft(0), AtlasRectRight(0) { }
29 
30  // Serialization
31  void Read(File& str, UInt32 version);
32  void Write(File& str, UInt32 version) const;
33 };
34 
35 
36 // This struct is used for sending the memory report
37 // It is a tree structure with each node corresponding to a heap
38 //
39 struct MemItem : public RefCountBase<MemItem, Stat_Default_Mem>
40 {
41  StringLH Name;
42  UInt32 Value;
43  bool HasValue;
44  bool StartExpanded;
45  UInt32 ID;
46  Ptr<MemItemExtra> ImageExtraData;
47  ArrayLH< Ptr<MemItem> > Children;
48 
49  MemItem(UInt32 id) : Value(0), HasValue(false), StartExpanded(false), ID(id) { }
50 
51  void SetValue(UInt32 memValue);
52  MemItem* AddChild(UInt32 id, const char* name);
53  MemItem* AddChild(UInt32 id, const char* name, UInt32 memValue);
54  MemItem* SearchForName(const char* name);
55  UInt32 SumValues(const char* name) const;
56  UInt32 GetValue(const char* name) const;
57  UInt32 GetMaxId() const;
58 
59  // operators
60  MemItem& operator=(const MemItem& rhs);
61  MemItem& operator/=(unsigned numFrames);
62  MemItem& operator*=(unsigned num);
63  bool Merge(const MemItem& other);
64 
65  // Serialization
66  void Read(File& str, UInt32 version);
67  void Write(File& str, UInt32 version) const;
68  void ToString(StringBuffer* report, UByte indent = 0) const;
69  void ToXml(StringBuffer* report, UByte indent = 0) const;
70 };
71 
72 } // namespace Kaim
73 
74 #endif
std::uint8_t UByte
uint8_t
Definition: SF_Types.h:134
std::int32_t SInt32
int32_t
Definition: SF_Types.h:131
std::uint32_t UInt32
uint32_t
Definition: SF_Types.h:137
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17