1 h.sterling 1.1 //%2005////////////////////////////////////////////////////////////////////////
2 //
3 // 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 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 //
12 // Permission is hereby granted, free of charge, to any person obtaining a copy
13 // of this software and associated documentation files (the "Software"), to
14 // deal in the Software without restriction, including without limitation the
15 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 // sell copies of the Software, and to permit persons to whom the Software is
17 // furnished to do so, subject to the following conditions:
18 //
19 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
20 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
21 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 h.sterling 1.1 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
23 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
25 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //==============================================================================
29 //
30 // Author: Chip Vincent (cvincent@us.ibm.com)
31 //
32 // Modified By: Yi Zhou, Hewlett-Packard Company(yi_zhou@hp.com)
33 // Mike Day, IBM (mdday@us.ibm.com)
34 // Adrian Schuur, IBM (schuur@de.ibm.com)
35 // Heather Sterling, IBM (hsterl@us.ibm.com)
36 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39 #ifndef Pegasus_ConsumerModule_h
40 #define Pegasus_ConsumerModule_h
41
42 #include <Pegasus/Common/Config.h>
43 h.sterling 1.1 #include <Pegasus/Common/String.h>
44 #include <Pegasus/Common/System.h>
45 #include <Pegasus/Common/IPC.h>
46
47 #include <Pegasus/Provider/CIMProvider.h>
48 #include <Pegasus/Provider/CIMIndicationConsumerProvider.h>
49
50 #include <Pegasus/DynListener/Linkage.h>
51
52 PEGASUS_NAMESPACE_BEGIN
53
54 // The ConsumerModule class represents the physical module, as defined by the
55 // operation, that contains a provider. This class effectively encapsulates the
56 // "physical" portion of a consumer.
57 //
58 // There can be multiple "logical" consumers in memory, but there is only one "physical" consumer.
59 // This class keeps track of how many logical consumers are using it.
60
61
62 class PEGASUS_DYNLISTENER_LINKAGE ConsumerModule
63 {
64 h.sterling 1.1 friend class ConsumerManager;
65
66 public:
67 virtual ~ConsumerModule(void);
68 const String & getFileName(void) const;
69 CIMIndicationConsumerProvider* load(const String & consumerName, const String & libraryPath);
70 void unloadModule(void);
71
72 protected:
73 String _libraryPath;
74 AtomicInt _ref_count;
75 DynamicLibraryHandle _libraryHandle;
76
77 private:
78 ConsumerModule();
79 const String & getConsumerName(void) const;
80 virtual CIMIndicationConsumerProvider* getConsumer(void) const;
81
82 String _consumerName;
83 CIMIndicationConsumerProvider* _consumer;
84 };
85 h.sterling 1.1
86 inline const String & ConsumerModule::getFileName(void) const
87 {
88 return(_libraryPath);
89 }
90
91 inline const String & ConsumerModule::getConsumerName(void) const
92 {
93 return(_consumerName);
94 }
95
96 inline CIMIndicationConsumerProvider* ConsumerModule::getConsumer(void) const
97 {
98 return(_consumer);
99 }
100
101 PEGASUS_NAMESPACE_END
102
103 #endif
|