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

  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                     
 45 r.kieninger 1.1.2.3 struct SCMOResolutionTable
 46 r.kieninger 1.1.2.1 {
 47                         void* scmbptr;
 48                         Uint32 index;
 49                     };
 50                     
 51 r.kieninger 1.1.2.3 #define PEGASUS_ARRAY_T SCMOResolutionTable
 52 r.kieninger 1.1.2.2 # include <Pegasus/Common/ArrayInter.h>
 53                     #undef PEGASUS_ARRAY_T
 54                     
 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 thilo.boehm 1.1.2.4     // Writes a single SCMOClass to the given CIMBuffer
 72                         static void serializeClass(CIMBuffer& out, const SCMOClass& scmoClass);
 73                     
 74                         // Reads a single SCMOClass from the given CIMBuffer
 75                         static bool deserializeClass(CIMBuffer& in, SCMOClass& scmoClass);
 76                     
 77 r.kieninger 1.1.2.1 private:
 78                     
 79                     
 80                     
 81                         // This function takes and instance and adds all of its external
 82                         // references (SCMOClass and SCMOInstances) to the index tables
 83                         // For referenced SCMOInstances, the function recusively calls itself.
 84                         //
 85                         // Returns the index position at which the class for this instance was
 86                         // inserted in the class resolver table.
 87                         Uint32 _appendToResolverTables(const SCMOInstance& inst);
 88                     
 89                     
 90                         // This function adds the given instance to the instance resolver table,
 91                         // which stores the connections between instances and their external
 92                         // references.
 93                         //
 94                         // Returns the index position at which the instance was inserted in the
 95                         // instance resolver table.
 96                         Uint32 _appendToInstResolverTable(const SCMOInstance& inst, Uint32 idx);
 97                     
 98 r.kieninger 1.1.2.1 
 99                         // Adds an instance to the class resolution table.
100                         // Also adds the class to the class table when neccessary
101                         //
102                         // Returns the index position at which the instance was inserted in the
103                         // instance resolver table.
104                         Uint32 _appendToClassResolverTable(const SCMOInstance& inst);
105                     
106                     
107                         // Add the SCMOClass for the given instance to the class table.
108                         // If the class already exists in the table, it returns the index position
109                         // for this class, otherwise appends the class at the end of the table
110                         // and returns the new index position of the class.
111                         Uint32 _appendToClassTable(const SCMOInstance& inst);
112                     
113 thilo.boehm 1.1.2.4     static void _putClasses(CIMBuffer& out,Array<SCMBClass_Main*>& classTable);
114                         static bool _getClasses(CIMBuffer& in,Array<SCMBClass_Main*>& classTable);
115 r.kieninger 1.1.2.1     void _putInstances();
116                         bool _getInstances();
117                     
118                     
119                     #ifdef PEGASUS_DEBUG
120                         void _dumpTables();
121                     #endif
122                     
123                         // The Buffer for output streaming
124                         CIMBuffer& _buf;
125                     
126                         // The array of SCMOInstances to be streamed
127                         Array<SCMOInstance>& _scmoInstances;
128                     
129                         // Counters for the total number of classes and scmo instances
130                         // to be streamed. These counters increase during streaming process.
131                         Uint32 _ttlNumInstances;
132                         Uint32 _ttlNumClasses;
133                     
134                         // Index table used to resolve the absolute pointers to SCMOClasses
135                         // to a relative sequence number (index) in the stream
136 r.kieninger 1.1.2.3     Array<SCMOResolutionTable> _clsResolverTable;
137 r.kieninger 1.1.2.1 
138                         // Index table used to resolve the absolute pointers to SCMOInstances
139                         // to a relative sequence number (index) in the stream
140 r.kieninger 1.1.2.3     Array<SCMOResolutionTable> _instResolverTable;
141 r.kieninger 1.1.2.1 
142                         // Table of pointers to SCMOClasses to be streamed
143 thilo.boehm 1.1.2.4     Array<SCMBClass_Main*> _classTable;
144 r.kieninger 1.1.2.1 };
145                     
146                     PEGASUS_NAMESPACE_END
147                     
148                     #endif /* Pegasus_SCMOStreamer_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2