1 r.kieninger 1.1.2.1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // 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 //
10 // 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 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 r.kieninger 1.1.2.1 // 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 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_SCMOStreamer_h
33 #define Pegasus_SCMOStreamer_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/ArrayInternal.h>
37 #include <Pegasus/Common/SCMO.h>
38 #include <Pegasus/Common/SCMOInstance.h>
39 #include <Pegasus/Common/CIMBuffer.h>
40 #include <Pegasus/Common/Array.h>
41
42 PEGASUS_NAMESPACE_BEGIN
43 r.kieninger 1.1.2.1
44
|
55 r.kieninger 1.1.2.1
56 class PEGASUS_COMMON_LINKAGE SCMOStreamer
57 {
58 public:
59
60 SCMOStreamer(CIMBuffer& out, Array<SCMOInstance>& x);
61
62 // Writes the list of SCMOInstances stored in this instance of SCMOStreamer
63 // to the output buffer, including their referenced Classes and Instances
64 void serialize();
65
66 // Reads a list of SCMOInstances from the input buffer and stores them in
67 // this instance of SCMOStreamer, including their referenced Classes and
68 // Instances
69 bool deserialize();
70
71 private:
72
73
74
75 // This function takes and instance and adds all of its external
76 r.kieninger 1.1.2.1 // references (SCMOClass and SCMOInstances) to the index tables
77 // For referenced SCMOInstances, the function recusively calls itself.
78 //
79 // Returns the index position at which the class for this instance was
80 // inserted in the class resolver table.
81 Uint32 _appendToResolverTables(const SCMOInstance& inst);
82
83
84 // This function adds the given instance to the instance resolver table,
85 // which stores the connections between instances and their external
86 // references.
87 //
88 // Returns the index position at which the instance was inserted in the
89 // instance resolver table.
90 Uint32 _appendToInstResolverTable(const SCMOInstance& inst, Uint32 idx);
91
92
93 // Adds an instance to the class resolution table.
94 // Also adds the class to the class table when neccessary
95 //
96 // Returns the index position at which the instance was inserted in the
97 r.kieninger 1.1.2.1 // instance resolver table.
98 Uint32 _appendToClassResolverTable(const SCMOInstance& inst);
99
100
101 // Add the SCMOClass for the given instance to the class table.
102 // If the class already exists in the table, it returns the index position
103 // for this class, otherwise appends the class at the end of the table
104 // and returns the new index position of the class.
105 Uint32 _appendToClassTable(const SCMOInstance& inst);
106
107 void _putClasses();
108 bool _getClasses();
109 void _putInstances();
110 bool _getInstances();
111
112
113 #ifdef PEGASUS_DEBUG
114 void _dumpTables();
115 #endif
116
117 // The Buffer for output streaming
118 r.kieninger 1.1.2.1 CIMBuffer& _buf;
119
120 // The array of SCMOInstances to be streamed
121 Array<SCMOInstance>& _scmoInstances;
122
123 // Counters for the total number of classes and scmo instances
124 // to be streamed. These counters increase during streaming process.
125 Uint32 _ttlNumInstances;
126 Uint32 _ttlNumClasses;
127
128 // Index table used to resolve the absolute pointers to SCMOClasses
129 // to a relative sequence number (index) in the stream
|