/** * @file memory_entry.hpp * @brief J Library Memory Entry ヘッダファイル。 * @copyright 2001 - 2024 Nomura Kei * @depends * j.hpp * j/memory_mark.hpp */ #ifndef J_MEMORY_ENTRY_HPP #define J_MEMORY_ENTRY_HPP #include <ostream> #include <j.hpp> #include <j/memory_mark.hpp> namespace j { /** * メモリエントリ。 */ struct MemoryEntry { int size; //!< メモリサイズ MemoryMark mark; //!< メモリ状態 const char *file; //!< メモリ確保ファイル名 const char *func; //!< メモリ確保関数名 int line; //!< メモリ確保行番号 MemoryEntry *_prev; //!< 前の管理メモリポインタ MemoryEntry *_next; //!< 次の管理メモリポインタ void *_padding[2]; //!< パディング void *_data; //!< データ // メモリエントリ情報出力 void dump(std::ostream &os, int bytes, bool binary, bool ascii, int maxColumn, bool noEndl = false) const; private: // カラム数取得 int getColumn(int bytes, bool binary, bool ascii, int maxColumn) const; void printBase(std::ostream &os, int column) const; void printBinary(std::ostream &os, int bytes) const; void printAscii(std::ostream &os, int bytes) const; const char *getSizeStr() const; }; } // namespace j #endif // J_MEMORY_ENTRY_HPP