TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Guild::LogHolder Class Reference

Public Member Functions

 LogHolder (uint32 maxRecords)
 
 ~LogHolder ()
 
uint8 GetSize () const
 
bool CanInsert () const
 
void LoadEvent (LogEntry *entry)
 
void AddEvent (SQLTransaction &trans, LogEntry *entry)
 
uint32 GetNextGUID ()
 
GuildLogGetGuildLog ()
 

Private Attributes

GuildLog m_log
 
uint32 m_maxRecords
 
uint32 m_nextGUID
 

Constructor & Destructor Documentation

Guild::LogHolder::LogHolder ( uint32  maxRecords)
inline
Definition: Guild.h:52
uint32 m_nextGUID
Definition: Guild.h:568
uint32 m_maxRecords
Definition: Guild.h:567
uint32_t uint32
Definition: g3dmath.h:168
Guild::LogHolder::~LogHolder ( )
76 {
77  // Cleanup
78  for (GuildLog::iterator itr = m_log.begin(); itr != m_log.end(); ++itr)
79  delete (*itr);
80 }
GuildLog m_log
Definition: Guild.h:566

Member Function Documentation

void Guild::LogHolder::AddEvent ( SQLTransaction trans,
LogEntry entry 
)
inline
93 {
94  // Check max records limit
95  if (m_log.size() >= m_maxRecords)
96  {
97  LogEntry* oldEntry = m_log.front();
98  delete oldEntry;
99  m_log.pop_front();
100  }
101  // Add event to list
102  m_log.push_back(entry);
103  // Save to DB
104  entry->SaveToDB(trans);
105 }
uint32 m_maxRecords
Definition: Guild.h:567
GuildLog m_log
Definition: Guild.h:566

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Guild::LogHolder::CanInsert ( ) const
inline
557 { return m_log.size() < m_maxRecords; }
uint32 m_maxRecords
Definition: Guild.h:567
GuildLog m_log
Definition: Guild.h:566

+ Here is the caller graph for this function:

GuildLog* Guild::LogHolder::GetGuildLog ( )
inline
563 { return &m_log; }
GuildLog m_log
Definition: Guild.h:566

+ Here is the caller graph for this function:

uint32 Guild::LogHolder::GetNextGUID ( )
inline
108 {
109  // Next guid was not initialized. It means there are no records for this holder in DB yet.
110  // Start from the beginning.
112  m_nextGUID = 0;
113  else
115  return m_nextGUID;
116 }
Definition: Guild.h:52
uint32 m_nextGUID
Definition: Guild.h:568
uint32 m_maxRecords
Definition: Guild.h:567
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the caller graph for this function:

uint8 Guild::LogHolder::GetSize ( ) const
inline
555 { return uint8(m_log.size()); }
uint8_t uint8
Definition: g3dmath.h:164
GuildLog m_log
Definition: Guild.h:566

+ Here is the caller graph for this function:

void Guild::LogHolder::LoadEvent ( LogEntry entry)
inline
84 {
86  m_nextGUID = entry->GetGUID();
87  m_log.push_front(entry);
88 }
Definition: Guild.h:52
uint32 m_nextGUID
Definition: Guild.h:568
GuildLog m_log
Definition: Guild.h:566
uint32_t uint32
Definition: g3dmath.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

GuildLog Guild::LogHolder::m_log
private
uint32 Guild::LogHolder::m_maxRecords
private
uint32 Guild::LogHolder::m_nextGUID
private

The documentation for this class was generated from the following files: