1
/*###############################################################################
2
# Linux Management Providers (LMP), Physical Asset provider package
3
# Copyright (C) 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
5
# This program is being developed under the "OpenDRIM" project.
6
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
7
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
9
# This program is free software; you can redistribute it and/or
10
# modify it under the terms of the GNU General Public License
11
# as published by the Free Software Foundation; version 2
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
#################################################################################
24
#################################################################################
25
# To contributors, please leave your contact information in this section
26
# AND comment your changes in the source code.
28
# Modified by <Author(s)>, <Affiliation>, <Year>
29
###############################################################################*/
31
#include "cmpiOpenDRIM_ComputerSystemPackage.h"
32
#include "OpenDRIM_ComputerSystemPackageAccess.h"
36
#define ToString(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << instance.value; os << endl
37
#define ToStringInt(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << (long) instance.value; os << endl
38
#define ToStringRef(name, value, condition) os << (string) " " + name + (string) "="; instance.condition ? os << "NULL" : os << instance.value.toString(); os << endl
39
#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
40
#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
41
#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
43
ostream& operator<<(ostream& os, OpenDRIM_ComputerSystemPackage& instance) {
44
os << " [OpenDRIM_ComputerSystemPackage]" << endl;
45
ToStringRef("Antecedent", Antecedent, Antecedent_isNULL);
46
ToStringRef("Dependent", Dependent, Dependent_isNULL);
47
ToString("PlatformGUID", PlatformGUID, PlatformGUID_isNULL);
48
os << " [\\OpenDRIM_ComputerSystemPackage]" << endl;
56
int errorCode = PhysicalAsset_OpenDRIM_ComputerSystemPackage_load(NULL, errorMessage);
57
if (errorCode != OK) {
58
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
62
cout << endl << "[enumInstances]" << endl;
63
vector<OpenDRIM_ComputerSystemPackage> instances;
65
errorCode = PhysicalAsset_OpenDRIM_ComputerSystemPackage_retrieve(NULL, NULL, instances, NULL, errorMessage, "ei");
66
if (errorCode != OK) {
67
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
71
vector<OpenDRIM_ComputerSystemPackage>::iterator it = instances.begin();
72
for (; it != instances.end(); ++it) {
76
cout << "[\\enumInstances]" << endl;
77
cout << endl << "[enumInstanceNames & getInstance]" << endl;
80
errorCode = PhysicalAsset_OpenDRIM_ComputerSystemPackage_retrieve(NULL, NULL, instances, NULL, errorMessage, "ein");
81
if (errorCode != OK) {
82
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
86
it = instances.begin();
87
for (; it != instances.end(); ++it) {
88
errorCode = PhysicalAsset_OpenDRIM_ComputerSystemPackage_getInstance(NULL, NULL, *it, NULL, errorMessage);
89
if (errorCode != OK) {
90
cout << "ERROR " << errorCode << ": " << errorMessage << endl;
96
cout << "[\\enumInstanceNames & getInstance]" << endl;
99
errorCode = PhysicalAsset_OpenDRIM_ComputerSystemPackage_unload(errorMessage);
100
if (errorCode != OK) {
101
cout << "ERROR " << errorCode << ": " << errorMessage << endl;