(file) Return to objname.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Compiler

  1 karl  1.16 //%2004////////////////////////////////////////////////////////////////////////
  2 mike  1.10 //
  3 karl  1.16 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.15 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.16 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 mike  1.10 //
 10            // Permission is hereby granted, free of charge, to any person obtaining a copy
 11 kumpf 1.12 // of this software and associated documentation files (the "Software"), to
 12            // deal in the Software without restriction, including without limitation the
 13            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 14 mike  1.10 // sell copies of the Software, and to permit persons to whom the Software is
 15            // furnished to do so, subject to the following conditions:
 16            // 
 17 kumpf 1.12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 18 mike  1.10 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 19            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 20 kumpf 1.12 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 21            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 23 mike  1.10 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 24            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25            //
 26            //==============================================================================
 27            //
 28            // Author: Bob Blair (bblair@bmc.com)
 29            //
 30            // Modified By:
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34            
 35            //
 36            // Header for a class to generate CIMValue objects from String values
 37            //
 38            //
 39            //
 40            // Make an object reference available in its parts.
 41            //
 42            // An object name has 3 parts:  namespaceType, namespaceHandle and modelPath
 43            // For example, in the object name
 44 mike  1.10 //       http://somehost:1234/a/b/c:myobj.first="top", last="cat"
 45            // the parts are
 46            //       namespaceType -- http:
 47            //       namespaceHandle -- /somehost:a/b/c
 48            //       modelPath -- myobj.first="top", last="cat"
 49            //
 50            // The namespaceHandle has two components:  host and path.
 51            // In the example above, this divides as
 52            //       host -- somehost
 53            //       path -- /a/b/c
 54            //
 55            // The host may have two components:  a host name and a port.
 56            //       host -- hostname:1234
 57            //
 58 kumpf 1.14 // The modelPath has two components as well:  className and CIMKeyBindings.
 59 mike  1.10 
 60            // In the example,
 61            //       className -- myobj
 62 kumpf 1.14 //       CIMKeyBindings -- first="top", last="cat"
 63 mike  1.10 //
 64            // This class allows you to convert among various forms of the object name:
 65            //     -- the String (as above)
 66            //     -- the decomposed pieces
 67            //     -- an instance object
 68            //     -- a reference object
 69            //
 70            // This class uses components from pegasus/Common
 71            
 72            #ifndef _PEGASUS_COMPILER_OBJNAME_H_
 73            #define _PEGASUS_COMPILER_OBJNAME_H_
 74            
 75            
 76 kumpf 1.11 #include <Pegasus/Common/CIMObjectPath.h>
 77 mike  1.10 #include <Pegasus/Common/CIMInstance.h>
 78            #include <Pegasus/Common/String.h>
 79 kumpf 1.13 #include <Pegasus/Compiler/Linkage.h>
 80 mike  1.10 
 81            PEGASUS_NAMESPACE_BEGIN
 82            
 83            class PEGASUS_COMPILER_LINKAGE namespaceHandle {
 84             private:
 85              String _Stringrep;
 86              String _host;
 87              String _path;
 88              void namespaceHandleRepToComponents(const String &rep);
 89              const String &namespaceHandleComponentsToRep();
 90             public:
 91              namespaceHandle(const String &Stringrep);
 92              namespaceHandle(const String &host, const String &path);
 93              ~namespaceHandle() {;}
 94              const String &Stringrep() { return _Stringrep == "" ? 
 95            				namespaceHandleComponentsToRep() : 
 96                _Stringrep; }
 97              const String &host() { return _host; }
 98              const String &path() { return _path; }
 99            };
100            
101 mike  1.10 class PEGASUS_COMPILER_LINKAGE modelPath {
102             private:
103              String _Stringrep;
104              String _className;
105              String _keyString;
106 kumpf 1.14   Array<CIMKeyBinding> _KeyBindings;
107 mike  1.10   void modelPathRepToComponents(const String &rep);
108              const String &modelPathComponentsToRep();
109             public:
110              modelPath(const String &Stringrep);
111              modelPath(const String &classname, const String &keyString);
112 kumpf 1.14   modelPath(const String &classname, const Array<CIMKeyBinding>&bindings);
113 mike  1.10   ~modelPath();
114 kumpf 1.14   static CIMKeyBinding::Type KeyBindingTypeOf(const String &s);
115 mike  1.10   const String &Stringrep() { return modelPathComponentsToRep(); }
116              const String &className() { return _className; }
117              const String &keyString() { return KeyBindingsToKeyString(); }
118              const String &KeyBindingsToKeyString();
119 kumpf 1.14   const Array<CIMKeyBinding>& KeyBindings() { return _KeyBindings; }
120 mike  1.10 };
121            
122            class PEGASUS_COMPILER_LINKAGE objectName {
123             private:
124              String _Stringrep;
125              String _namespaceType;
126              namespaceHandle *_namespaceHandle;
127              modelPath *_modelPath;
128 kumpf 1.11   CIMObjectPath *_reference;
129 mike  1.10   CIMInstance *_instance;
130 kumpf 1.14   Array<CIMKeyBinding> _empty;
131 mike  1.10 
132             public:
133              objectName();
134              objectName(const String &Stringrep);
135              objectName(const String &namespaceType, const String &namespaceHandle,
136                  const String &modelPath);
137              objectName(const String &namespaceType, const String &host,
138                  const String &path, const String &modelpath);
139              objectName(const String &namespaceType, const String &host,
140                  const String &path, const String &classname,
141                  const String &keyString);
142              objectName(const CIMInstance &instance);
143              ~objectName();
144              void set(const String &rep);
145              void set(const String &namespaceType, 
146            		       const String &namespaceHandle,
147            		       const String &modelPath);
148              const String &Stringrep() { return _Stringrep; }
149              const String &namespaceType() { return _namespaceType; }
150              const String &handle() const {
151                return _namespaceHandle ? _namespaceHandle->Stringrep() : String::EMPTY; }
152 mike  1.10   const String &host() const {
153                return _namespaceHandle ? _namespaceHandle->host() : String::EMPTY; }
154              const String &path() {
155                return _namespaceHandle ? _namespaceHandle->path() : String::EMPTY; }
156              const String &modelpath() {
157                return _modelPath ? _modelPath->Stringrep() : String::EMPTY; }
158              const String &className() const {
159                return _modelPath ? _modelPath->className() : String::EMPTY; }
160              const String &keyString() {
161                return _modelPath ? _modelPath->keyString() : String::EMPTY; }
162 kumpf 1.14   const Array<CIMKeyBinding> &KeyBindings() const {
163 mike  1.10     return _modelPath ? _modelPath->KeyBindings() : _empty; }
164              const CIMInstance *instance() { return _instance; }
165            };
166            
167            PEGASUS_NAMESPACE_END
168            
169            
170            #endif

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2