1 //===-- FormatCache.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_FormatCache_h_
11 #define lldb_FormatCache_h_
17 // Other libraries and framework includes
19 #include "lldb/lldb-public.h"
20 #include "lldb/Core/ConstString.h"
21 #include "lldb/Host/Mutex.h"
22 #include "lldb/DataFormatters/FormatClasses.h"
24 namespace lldb_private {
31 bool m_format_cached : 1;
32 bool m_summary_cached : 1;
33 bool m_synthetic_cached : 1;
34 bool m_validator_cached : 1;
36 lldb::TypeFormatImplSP m_format_sp;
37 lldb::TypeSummaryImplSP m_summary_sp;
38 lldb::SyntheticChildrenSP m_synthetic_sp;
39 lldb::TypeValidatorImplSP m_validator_sp;
42 Entry (lldb::TypeFormatImplSP);
43 Entry (lldb::TypeSummaryImplSP);
44 Entry (lldb::SyntheticChildrenSP);
45 Entry (lldb::TypeValidatorImplSP);
46 Entry (lldb::TypeFormatImplSP,lldb::TypeSummaryImplSP,lldb::SyntheticChildrenSP,lldb::TypeValidatorImplSP);
60 lldb::TypeFormatImplSP
63 lldb::TypeSummaryImplSP
66 lldb::SyntheticChildrenSP
69 lldb::TypeValidatorImplSP
73 SetFormat (lldb::TypeFormatImplSP);
76 SetSummary (lldb::TypeSummaryImplSP);
79 SetSynthetic (lldb::SyntheticChildrenSP);
82 SetValidator (lldb::TypeValidatorImplSP);
84 typedef std::map<ConstString,Entry> CacheMap;
88 uint64_t m_cache_hits;
89 uint64_t m_cache_misses;
92 GetEntry (const ConstString& type);
98 GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp);
101 GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp);
104 GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp);
107 GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& summary_sp);
110 SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp);
113 SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp);
116 SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp);
119 SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& synthetic_sp);
133 return m_cache_misses;
136 } // namespace lldb_private
138 #endif // lldb_FormatCache_h_