summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-09-24 16:08:08 +0200
committerMatthias Schiffer <matthias@gamezock.de>2008-09-24 16:08:08 +0200
commit91753e0f4b2e512259c52e6258d250ef3332c053 (patch)
treed64b451b6a43ea226a8cec85fd229b0740dae502
parentbea0bb0ff40dca9e5dba55c697c30e4fffaf0f66 (diff)
downloadmad-91753e0f4b2e512259c52e6258d250ef3332c053.tar
mad-91753e0f4b2e512259c52e6258d250ef3332c053.zip
Ordne SystemBackends nach Priorit?ten
-rw-r--r--src/Common/SystemBackend.cpp3
-rw-r--r--src/Common/SystemBackend.h15
2 files changed, 16 insertions, 2 deletions
diff --git a/src/Common/SystemBackend.cpp b/src/Common/SystemBackend.cpp
index 4bbc68a..0d4b2b7 100644
--- a/src/Common/SystemBackend.cpp
+++ b/src/Common/SystemBackend.cpp
@@ -22,7 +22,8 @@
namespace Mad {
namespace Common {
-std::set<SystemBackend*> SystemBackend::backends;
+std::set<SystemBackend*, SystemBackend::Compare> SystemBackend::backends;
+
SystemBackend::UptimeInfo SystemBackend::getUptimeInfo() {
UptimeInfo ret = {0, 0};
diff --git a/src/Common/SystemBackend.h b/src/Common/SystemBackend.h
index 960082e..c531224 100644
--- a/src/Common/SystemBackend.h
+++ b/src/Common/SystemBackend.h
@@ -48,7 +48,16 @@ class SystemBackend {
};
private:
- static std::set<SystemBackend*> backends;
+ struct Compare {
+ bool operator() (const SystemBackend *b1, const SystemBackend *b2) {
+ if(b1->getPriority() == b2->getPriority())
+ return (b1 > b2);
+ else
+ return (b1->getPriority() > b2->getPriority());
+ }
+ };
+
+ static std::set<SystemBackend*, Compare> backends;
protected:
SystemBackend() {}
@@ -76,6 +85,10 @@ class SystemBackend {
return ret;
}
+ virtual int getPriority() const {
+ return 0;
+ }
+
public:
virtual ~SystemBackend() {}