summaryrefslogtreecommitdiff
path: root/CDAL/CommDeviceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CDAL/CommDeviceManager.cpp')
-rwxr-xr-xCDAL/CommDeviceManager.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/CDAL/CommDeviceManager.cpp b/CDAL/CommDeviceManager.cpp
new file mode 100755
index 0000000..bd94651
--- /dev/null
+++ b/CDAL/CommDeviceManager.cpp
@@ -0,0 +1,56 @@
+/*
+ * CommDeviceManager.cpp
+ *
+ * Copyright (C) ST-Ericsson SA 2011
+ * Authors: Srimanta Panda <srimanta.panda@stericsson.com>,
+ * Ola Borgelin <ola.borgelin@stericsson.com>,
+ * Karin Hedlund <karin.hedlund@stericsson.com>,
+ * Markus Andersson <markus.m.andersson@stericsson.com> for ST-Ericsson.
+ * License terms: 3-clause BSD license
+ *
+ */
+
+#include "CommDeviceManager.h"
+#include "CommDevice.h"
+#include "CommException.h"
+#include "Debug.h"
+#include <vector>
+using namespace std;
+
+vector<CommDevice*> CommDeviceManager::devices_;
+
+const vector<CommDevice*>& CommDeviceManager::getAllDevices()
+{
+ return devices_;
+}
+
+void CommDeviceManager::destroyDevice(CommDevice* device)
+{
+ if (0 == device) {
+ return;
+ }
+
+ vector<CommDevice*>::iterator i = devices_.begin();
+
+ while (i != devices_.end()) {
+ if (device == *i) {
+ delete device;
+ break;
+ }
+
+ ++i;
+ }
+
+ if (i != devices_.end()) {
+ devices_.erase(i);
+ }
+}
+
+void CommDeviceManager::destroyAll()
+{
+ for (vector<CommDevice*>::iterator i = devices_.begin(); i != devices_.end(); ++i) {
+ delete *i;
+ }
+
+ devices_.clear();
+}