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
98
99
100
101
102
103
104
105
|
/*###############################################################################
# Linux Management Providers (LMP), System Memory provider package
# Copyright (C) 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
#
# This program is being developed under the "OpenDRIM" project.
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#################################################################################
#################################################################################
# To contributors, please leave your contact information in this section
# AND comment your changes in the source code.
#
# Modified by <Author(s)>, <Affiliation>, <Year>
###############################################################################*/
#include "cmpiOpenDRIM_MemoryCapabilities.h"
#include "OpenDRIM_MemoryCapabilitiesAccess.h"
#include <iostream>
#define ToString(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << instance.value; os << endl
#define ToStringInt(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << (long) instance.value; os << endl
#define ToStringRef(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << instance.value.toString(); os << endl
#define ToStringArray(name, value, condition) os << (string) " " + name + (string) "=["; for (size_t i = 0; i < instance.value.size(); i++) { os << instance.value[i]; if (i < instance.value.size()-1) os << ","; } os << "]" << endl
#define ToStringArrayInt(name, value, condition) os << (string) " " + name + (string) "=["; for (size_t i = 0; i < instance.value.size(); i++) { os << (long) instance.value[i]; if (i < instance.value.size()-1) os << ","; } os << "]" << endl
#define ToStringRefArray(name, value, condition) os << (string) " " + name + (string) "=["; for (size_t i = 0; i < instance.value.size(); i++) { os << instance.value[i].toString(); if (i < instance.value.size()-1) os << ","; } os << "]" << endl
ostream& operator<<(ostream& os, OpenDRIM_MemoryCapabilities& instance) {
os << " [OpenDRIM_MemoryCapabilities]" << endl;
ToStringRef("ManagedElement", ManagedElement, ManagedElement_isNULL);
ToStringRef("Capabilities", Capabilities, Capabilities_isNULL);
ToStringArrayInt("Characteristics", Characteristics, Characteristics_isNULL);
os << " [\\OpenDRIM_MemoryCapabilities]" << endl;
return os;
}
int main() {
string errorMessage;
int errorCode = SystemMemory_OpenDRIM_MemoryCapabilities_load(NULL, errorMessage);
if (errorCode != OK) {
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
return -1;
}
cout << endl << "[enumInstances]" << endl;
vector<OpenDRIM_MemoryCapabilities> instances;
errorCode = SystemMemory_OpenDRIM_MemoryCapabilities_retrieve(NULL, NULL, instances, NULL, errorMessage, "ei");
if (errorCode != OK) {
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
return -1;
}
vector<OpenDRIM_MemoryCapabilities>::iterator it = instances.begin();
for (; it != instances.end(); ++it) {
cout << *it;
}
cout << "[\\enumInstances]" << endl;
cout << endl << "[enumInstanceNames & getInstance]" << endl;
instances.clear();
errorCode = SystemMemory_OpenDRIM_MemoryCapabilities_retrieve(NULL, NULL, instances, NULL, errorMessage, "ein");
if (errorCode != OK) {
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
return -1;
}
it = instances.begin();
for (; it != instances.end(); ++it) {
errorCode = SystemMemory_OpenDRIM_MemoryCapabilities_getInstance(NULL, NULL, *it, NULL, errorMessage);
if (errorCode != OK) {
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
return -1;
}
cout << *it;
}
cout << "[\\enumInstanceNames & getInstance]" << endl;
cout << endl;
errorCode = SystemMemory_OpenDRIM_MemoryCapabilities_unload(errorMessage);
if (errorCode != OK) {
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
return -1;
}
return 0;
}
|