Patch level : 10.0

Files correlati     : authoriz
Ricompilazione Demo : [ ]
Commento            :
Migliorato conteggio utenti


git-svn-id: svn://10.65.10.50/branches/R_10_00@22431 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-09-28 08:57:06 +00:00
parent fe4305e41c
commit 195956147e

View File

@ -40,7 +40,7 @@ public:
bool Kill(TUserInfo* ui); bool Kill(TUserInfo* ui);
void KillSession(wxSocketBase& sock, int session); void KillSession(wxSocketBase& sock, int session);
size_t GetCount() const { return size(); } size_t GetCount() const;
size_t GetLicenses() const; size_t GetLicenses() const;
TUserTable(); TUserTable();
@ -48,13 +48,24 @@ public:
WX_DECLARE_HASH_SET( wxString, wxStringHash, wxStringEqual, THostSet ); WX_DECLARE_HASH_SET( wxString, wxStringHash, wxStringEqual, THostSet );
size_t TUserTable::GetCount() const
{
size_t n = 0;
for (TUsersHashMap::const_iterator it = begin(); it != end(); ++it)
{
const TUserInfo* ui = it->second;
n += (ui && ui->m_nPrograms > 0) ? 1 : 0;
}
return n;
}
size_t TUserTable::GetLicenses() const size_t TUserTable::GetLicenses() const
{ {
THostSet hsHosts; THostSet hsHosts;
for( TUsersHashMap::const_iterator it = begin(); it != end(); ++it ) for (TUsersHashMap::const_iterator it = begin(); it != end(); ++it)
{ {
TUserInfo* ui = it->second; TUserInfo* ui = it->second;
if (ui != NULL) if (ui && ui->m_nPrograms > 0)
hsHosts.insert(ui->m_strHost); hsHosts.insert(ui->m_strHost);
} }
return hsHosts.size(); return hsHosts.size();