1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| // Client.h: interface for the CClient class.
//
//////////////////////////////////////////////////////////////////////
#ifndef CLIENT_INCLUDED
#define CLIENT_INCLUDED
// Include XML wrapper framework
#include "XmlParser.h"
// stl includes
#include <string>
#include <map>
//CMachine
// La classe suivant décrit un client, en donnant les informations fournies par Condor
class CClient
{
public:
CClient();
~CClient();
enum
{
PROPERTY_NONE,
PROPERTY_NAME,
PROPERTY_STATE,
PROPERTY_ACTIVITY,
PROPERTY_OPSYS,
PROPERTY_MEMORY
};
const std::string& GetClientName() const { return m_clientName; }
void SetClientName(const std::string& clientName) { m_clientName = clientName; }
const std::string& GetClientState() const { return m_clientState; }
void SetClientState(const std::string& clientState) { m_clientState = clientState; }
const std::string& GetClientActivity() const { return m_clientActivity; }
void SetClientActivity(const std::string& clientActivity) { m_clientActivity = clientActivity; }
const std::string& GetClientOpsys() const { return m_clientOpsys; }
void SetClientOpsys(const std::string& clientOpsys) { m_clientOpsys = clientOpsys; }
const std::string& GetClientMemory() const { return m_clientMemory; }
void SetClientMemory(const std::string& clientMemory) { m_clientMemory = clientMemory; }
std::string ToString() const;
private:
std::string m_clientName;
std::string m_clientState;
std::string m_clientActivity;
std::string m_clientOpsys;
std::string m_clientMemory;
};
//CPool
// La classe suivante décrit un pool de machines
class CPool : public IXmlElementHandler
{
public:
CPool();
~CPool();
// IXmlElementHandler virtual overrides
virtual void OnXmlStartElement(const CXmlElement& xmlElement);
virtual void OnXmlElementData(const std::string& elementData, int depth);
virtual void OnXmlEndElement(const CXmlElement& xmlElement);
virtual void OnXmlError(int line, int column, const std::string& errorText, unsigned long errorCode);
virtual bool OnXmlAbortParse(const CXmlElement& xmlElement);
// Build the pool from an xml file
bool BuildFromXml(std::string& xmlPath);
// Pool management (appeler ces fonctions pour la mise a jour des CListCtrl)
const CClient* FindCient(const std::string& clientName) const;
int GetClientCount() const;
void DeleteClients();
private:
// Used during parsing
bool m_foundPool;
CClient* m_currClient;
int m_currClientProperty;
// XML parser (wrapper class for SAX2)
CXmlParser* m_xmlParser;
// Map keyed on Client Name.
std::map<std::string,CClient*> m_clients;
}
#endif // !defined(AFX_MACHINE_H__E90BF8C6_43DA_4CD5_8921_0C9D68BEF76F__INCLUDED_) |