1 martin 1.4 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.5 //
|
3 martin 1.4 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.5 //
|
10 martin 1.4 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.5 //
|
17 martin 1.4 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.5 //
|
20 martin 1.4 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.5 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.4 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.5 //
|
28 martin 1.4 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.2 //
30 //%////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/WsmServer/WsmSelectorSet.h>
34 #include "WsmEndpointReference.h"
35
36 PEGASUS_NAMESPACE_BEGIN
37
38 WsmEndpointReference::WsmEndpointReference()
39 {
40 selectorSet = new WsmSelectorSet;
41 }
42
43 WsmEndpointReference::~WsmEndpointReference()
44 {
45 delete selectorSet;
46 }
47
48 WsmEndpointReference::WsmEndpointReference(const WsmEndpointReference& epr)
49 : address(epr.address),
50 kumpf 1.2 resourceUri(epr.resourceUri)
51 {
52 if (epr.selectorSet)
53 {
54 selectorSet = new WsmSelectorSet;
55 selectorSet->selectors = epr.selectorSet->selectors;
56 }
57 else
58 {
59 selectorSet = 0;
60 }
61 }
62
|
63 kumpf 1.3 const String& WsmEndpointReference::getNamespace() const
64 {
65 if (selectorSet)
66 {
67 for (Uint32 i = 0; i < selectorSet->selectors.size(); i++)
68 {
69 if (selectorSet->selectors[i].type == WsmSelector::VALUE &&
70 selectorSet->selectors[i].name == "__cimnamespace")
71 {
72 return selectorSet->selectors[i].value;
73 }
74 }
75 }
76
77 return String::EMPTY;
78 }
79
|
80 kumpf 1.2 WsmEndpointReference& WsmEndpointReference::operator=(
81 const WsmEndpointReference& epr)
82 {
83 if (this != &epr)
84 {
85 address = epr.address;
86 resourceUri = epr.resourceUri;
87
88 delete selectorSet;
89 if (epr.selectorSet)
90 {
91 selectorSet = new WsmSelectorSet;
92 selectorSet->selectors = epr.selectorSet->selectors;
93 }
94 else
95 {
96 selectorSet = 0;
97 }
98 }
99
100 return *this;
101 kumpf 1.2 }
102
|
103 kumpf 1.3 Boolean operator==(
104 const WsmEndpointReference& epr1,
105 const WsmEndpointReference& epr2)
106 {
107 if (epr1.address != epr2.address ||
108 epr1.resourceUri != epr2.resourceUri ||
109 (epr1.selectorSet && !epr2.selectorSet) ||
110 (!epr1.selectorSet && epr2.selectorSet))
111 {
112 return false;
113 }
114
115 if (epr1.selectorSet && epr2.selectorSet)
116 {
117 return *epr1.selectorSet == *epr2.selectorSet;
118 }
119
120 return true;
121 }
122
123 Boolean operator!=(
124 kumpf 1.3 const WsmEndpointReference& epr1,
125 const WsmEndpointReference& epr2)
126 {
127 return !(epr1 == epr2);
128 }
129
|
130 kumpf 1.2 PEGASUS_NAMESPACE_END
|