oaChangeSet.h

Go to the documentation of this file.
00001 // ****************************************************************************
00002 // ****************************************************************************
00003 // oaChangeSet.h
00004 //
00005 // This file contains the definition of the change set which is used in the CMS
00006 // system.
00007 //
00008 //  oaChangeSetBase
00009 //      The oaChangeSet class manages a sequential set of tracked changes. It
00010 //      also manages object referenes. This base class defines the interface.
00011 //
00012 //  oaChangeSet
00013 //      The oaChangeSet class manages a sequential set of tracked changes. It
00014 //      also manages object referenes.
00015 //
00016 //  oaChangeSetVisitor
00017 //      oaChangeSet classes supports visitor pattern for various actions on
00018 //      them. This is the interface for the visitor, which is capable of
00019 //      visitting concrete oaChangeSet nodes. It can be derived to define
00020 //      specific actions. It is also a composite visitor, since it should be
00021 //      paired with related visitors such as oaChangeRecVisitor and srVisitor.
00022 //
00023 // ****************************************************************************
00024 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00025 // Integration Initiative, this material may not be copied, modified,
00026 // re-published, uploaded, executed, or distributed in any way, in any medium,
00027 // in whole or in part, without prior written permission from Cadence.
00028 //
00029 //                Copyright 2007-2009 Cadence Design Systems, Inc.
00030 //                           All Rights Reserved.
00031 //
00032 //  $Author: icftcm $
00033 //  $Revision: #1 $
00034 //  $Date: 2007/04/25
00035 //  $State:$
00036 // ****************************************************************************
00037 // ****************************************************************************
00038 
00039 
00040 
00041 #if !defined(oaChangeSet_P)
00042 #define oaChangeSet_P
00043 
00044 
00045 
00046 // ****************************************************************************
00047 // Nested includes
00048 // ****************************************************************************
00049 #include "oaCMAttr.h"
00050 #include "oaCMProtocol.h"
00051 #include "oaChangeMgr.h"
00052 #include "oaChangeRec.h"
00053 
00054 
00055 
00056 // *****************************************************************************
00057 // Declare and define types in the OpenAccess namespace.
00058 // *****************************************************************************
00059 BEGIN_OA_NAMESPACE
00060 
00061 
00062 
00063 // *****************************************************************************
00064 // Forward Public Class Declarations
00065 // *****************************************************************************
00066 class oaChangeSetVisitor;
00067 class oaChangeSetPvt;
00068 
00069 
00070 
00071 // ****************************************************************************
00072 // oaChangeSetBase
00073 // ****************************************************************************
00074 class OA_CM_DLL_API oaChangeSetBase {
00075 public:
00076     virtual                                     ~oaChangeSetBase();
00077 
00078     virtual oaHierChangeRec                     *getCurrentChangeRec(oaCMDatabaseRef::SPtr database) = 0;
00079     virtual oaHierChangeRec                     *beginChangeRec(oaCMDatabaseRef::SPtr database) = 0;
00080     virtual void                                endChangeRec(oaCMDatabaseRef::SPtr database) = 0;
00081 
00082     virtual void                                addChangeRec(oaLeafChangeRec *lcr) = 0;
00083     virtual void                                rollBackChangeRecs(oaCMDatabaseRef::SPtr    dbRef,
00084                                                                    oaMarkerChangeRec        *target = NULL,
00085                                                                    oaBoolean                inclusive = false) = 0;
00086     virtual bool                                removeChangeRec(oaCMDatabaseRef::SPtr       dbRef,
00087                                                                 oaLeafChangeRec             *rec) = 0;
00088     virtual void                                passivateRefs(oaCMDatabaseRef::SPtr dbRef) = 0;
00089 
00090     virtual oaSetAttributeChangeRec             *allocSetAttributeChangeRec(sr::srAttributeBase::SPtr value) = 0;
00091     virtual oaUnsetAttributeChangeRec           *allocUnsetAttributeChangeRec(oaCMObjectRef::SPtr   owner,
00092                                                                               sd::sdAttribute       *attr) = 0;
00093     virtual oaCreate1to1RelationshipChangeRec   *allocCreate1to1RelationshipChangeRec(sr::sr1to1Relationship::SPtr value) = 0;
00094     virtual oaCreate1toNRelationshipChangeRec   *allocCreate1toNRelationshipChangeRec(sr::sr1toNRelationship::SPtr value) = 0;
00095     virtual oaDestroy1to1RelationshipChangeRec  *allocDestroy1to1RelationshipChangeRec(sr::sr1to1Relationship::SPtr value) = 0;
00096     virtual oaDestroy1toNRelationshipChangeRec  *allocDestroy1toNRelationshipChangeRec(sr::sr1toNRelationship::SPtr value) = 0;
00097 
00098     virtual oaCreateObjectChangeRec             *allocCreateObjectChangeRec(oaCMObjectRef::SPtr         object,
00099                                                                             oaCMObjectStateEntry::SPtr  state) = 0;
00100     virtual oaDestroyObjectChangeRec            *allocDestroyObjectChangeRec(oaCMObjectRef::SPtr object) = 0;
00101     virtual oaConvertObjectChangeRec            *allocConvertObjectChangeRec(oaCMObjectRef::SPtr    object,
00102                                                                              oaCMObjectRef::SPtr    newObject) = 0;
00103     virtual oaHierChangeRec                     *allocHierChangeRec() = 0;
00104 
00105     virtual oaMarkerChangeRec                   *findLastMarkerChangeRec(oaMarkerChangeRecTypeEnum  typeIn,
00106                                                                          oaCMDatabaseRef::SPtr      dbRef) = 0;
00107     virtual oaConvertObjectChangeRec            *findLastConvertObjectChangeRec(oaHierChangeRec *hcr) const = 0;
00108     virtual oaExportMarkerChangeRec             *allocExportMarkerChangeRec(oaMarkerChangeRecTypeEnum   typeIn,
00109                                                                             oaCMDatabaseRef::SPtr       dbRef) = 0;
00110     virtual oaTransientMarkerChangeRec          *allocTransientMarkerChangeRec(oaMarkerChangeRecTypeEnum    typeIn,
00111                                                                                oaCMDatabaseRef::SPtr        dbRef) = 0;
00112     virtual oaMarkerChangeRec                   *cloneMarkerChangeRec(oaExportMarkerChangeRec &cr) = 0;
00113     virtual oaMarkerChangeRec                   *cloneMarkerChangeRec(oaTransientMarkerChangeRec &cr) = 0;
00114 
00115     virtual oaCMDatabaseRef::SPtr               findDatabaseRef(void *obj) const = 0;
00116     virtual oaCMDatabaseRef::SPtr               allocDatabaseRef(void               *obj,
00117                                                                  const sd::sdObject *sd,
00118                                                                  oaBoolean          isNew = false) = 0;
00119     virtual oaCMObjectIDRef::SPtr               findObjectIDRef(oaCMDatabaseRef::SPtr   database,
00120                                                                 void                    *obj) const = 0;
00121     virtual oaCMObjectIDRef::SPtr               allocObjectIDRef(oaCMDatabaseRef::SPtr  database,
00122                                                                  void                   *obj,
00123                                                                  const sd::sdObject     *sd,
00124                                                                  oaBoolean              isNew = false,
00125                                                                  oaCMObjectRef::SPtr    scope = NULL) = 0;
00126     virtual oaCMObjectStateRef::SPtr            findObjectStateRef(oaCMDatabaseRef::SPtr    database,
00127                                                                    void                     *obj) const = 0;
00128     virtual oaCMObjectStateRef::SPtr            allocObjectStateRef(oaCMDatabaseRef::SPtr   database,
00129                                                                     void                    *obj,
00130                                                                     const sd::sdObject      *sd,
00131                                                                     oaBoolean               isNew = false,
00132                                                                     oaCMObjectRef::SPtr     scope = NULL) = 0;
00133 
00134     virtual oaCMObjectStateEntry::SPtr          allocObjectStateEntry(oaCMDatabaseRef::SPtr                     database,
00135                                                                       const sd::sdObject                        *def,
00136                                                                       const sr::srObjectState::AttributeMap     &attributes,
00137                                                                       const sr::srObjectState::RelationshipMap  &relationships) = 0;
00138     virtual oaCMStringEntry::SPtr               findStringEntry(oaCMDatabaseRef::SPtr   database,
00139                                                                 const oaString          &string) = 0;
00140     virtual oaCMStringEntry::SPtr               allocStringEntry(oaCMDatabaseRef::SPtr  database,
00141                                                                  const oaString         &string) = 0;
00142 
00143     virtual void                                accept(oaChangeSetVisitor *visitor) = 0;
00144     virtual void                                accept(oaChangeRecVisitor   *visitor,
00145                                                        oaTimeStamp          minAge = 0) = 0;
00146 
00147     virtual void                                getName(oaString &name) const = 0;
00148 
00149     virtual oaBoolean                           isActive() const = 0;
00150     virtual void                                setActive(oaBoolean state) = 0;
00151 
00152     virtual oaBoolean                           isExported() const = 0;
00153     virtual void                                setExported() = 0;
00154     virtual oaTimeStamp                         getTimeStamp() const = 0;
00155 
00156     virtual oaChangeRec                         *allocAttributeChangeRec(sr::srAttributeBase::SPtr      value,
00157                                                                          sd::sdAttributeActionType      action,
00158                                                                          sd::sdAttributeContainerType   type) = 0;
00159     virtual oaChangeRec                         *allocRelationshipChangeRec(sr::srRelationshipBase::SPtr    value,
00160                                                                             sd::sdRelationshipActionType    action,
00161                                                                             sd::sdRelationshipContainerType type) = 0;
00162 
00163 protected:
00164                                                 oaChangeSetBase(const oaString &name);
00165 };
00166 
00167 
00168 
00169 // ****************************************************************************
00170 // oaChangeSet
00171 // ****************************************************************************
00172 class OA_CM_DLL_API oaChangeSet : public oaChangeSetBase {
00173 public:
00174                                                     oaChangeSet(const oaString &name);
00175                                                     ~oaChangeSet();
00176 
00177     virtual oaHierChangeRec                         *getCurrentChangeRec(oaCMDatabaseRef::SPtr database);
00178     virtual oaHierChangeRec                         *beginChangeRec(oaCMDatabaseRef::SPtr database);
00179     virtual void                                    endChangeRec(oaCMDatabaseRef::SPtr database);
00180 
00181     virtual void                                    addChangeRec(oaLeafChangeRec *lcr);
00182     virtual void                                    rollBackChangeRecs(oaCMDatabaseRef::SPtr    dbRef,
00183                                                                        oaMarkerChangeRec        *target = NULL,
00184                                                                        oaBoolean                inclusive = false);
00185     virtual bool                                    removeChangeRec(oaCMDatabaseRef::SPtr       dbRef,
00186                                                                     oaLeafChangeRec             *rec);
00187     virtual void                                    passivateRefs(oaCMDatabaseRef::SPtr dbRef);
00188 
00189     virtual oaSetAttributeChangeRec                 *allocSetAttributeChangeRec(sr::srAttributeBase::SPtr value);
00190     virtual oaUnsetAttributeChangeRec               *allocUnsetAttributeChangeRec(oaCMObjectRef::SPtr   owner,
00191                                                                                   sd::sdAttribute       *attr);
00192     virtual oaCreate1to1RelationshipChangeRec       *allocCreate1to1RelationshipChangeRec(sr::sr1to1Relationship::SPtr value);
00193     virtual oaCreate1toNRelationshipChangeRec       *allocCreate1toNRelationshipChangeRec(sr::sr1toNRelationship::SPtr value);
00194     virtual oaDestroy1to1RelationshipChangeRec      *allocDestroy1to1RelationshipChangeRec(sr::sr1to1Relationship::SPtr value);
00195     virtual oaDestroy1toNRelationshipChangeRec      *allocDestroy1toNRelationshipChangeRec(sr::sr1toNRelationship::SPtr value);
00196 
00197     virtual oaCreateObjectChangeRec                 *allocCreateObjectChangeRec(oaCMObjectRef::SPtr         object,
00198                                                                                 oaCMObjectStateEntry::SPtr  state);
00199     virtual oaDestroyObjectChangeRec                *allocDestroyObjectChangeRec(oaCMObjectRef::SPtr object);
00200     virtual oaConvertObjectChangeRec                *allocConvertObjectChangeRec(oaCMObjectRef::SPtr    object,
00201                                                                                  oaCMObjectRef::SPtr    newObject);
00202     virtual oaHierChangeRec                         *allocHierChangeRec();
00203 
00204     virtual oaMarkerChangeRec                       *findLastMarkerChangeRec(oaMarkerChangeRecTypeEnum  typeIn,
00205                                                                              oaCMDatabaseRef::SPtr      dbRef);
00206     virtual oaConvertObjectChangeRec                *findLastConvertObjectChangeRec(oaHierChangeRec *hcr) const;
00207     virtual oaExportMarkerChangeRec                 *allocExportMarkerChangeRec(oaMarkerChangeRecTypeEnum   typeIn,
00208                                                                                 oaCMDatabaseRef::SPtr       dbRef);
00209     virtual oaTransientMarkerChangeRec              *allocTransientMarkerChangeRec(oaMarkerChangeRecTypeEnum    typeIn,
00210                                                                                    oaCMDatabaseRef::SPtr        dbRef);
00211     virtual oaMarkerChangeRec                       *cloneMarkerChangeRec(oaExportMarkerChangeRec &cr);
00212     virtual oaMarkerChangeRec                       *cloneMarkerChangeRec(oaTransientMarkerChangeRec &cr);
00213 
00214     virtual oaCMDatabaseRef::SPtr                   findDatabaseRef(void *obj) const;
00215     virtual oaCMDatabaseRef::SPtr                   allocDatabaseRef(void               *obj,
00216                                                                      const sd::sdObject *sd,
00217                                                                      oaBoolean          isNew = false);
00218 
00219     virtual oaCMObjectIDRef::SPtr                   findObjectIDRef(oaCMDatabaseRef::SPtr   database,
00220                                                                     void                    *obj) const;
00221     virtual oaCMObjectIDRef::SPtr                   allocObjectIDRef(oaCMDatabaseRef::SPtr  database,
00222                                                                      void                   *obj,
00223                                                                      const sd::sdObject     *sd,
00224                                                                      oaBoolean              isNew = false,
00225                                                                      oaCMObjectRef::SPtr    scope = NULL);
00226 
00227     virtual oaCMObjectStateRef::SPtr                findObjectStateRef(oaCMDatabaseRef::SPtr    database,
00228                                                                        void                     *obj) const;
00229     virtual oaCMObjectStateRef::SPtr                allocObjectStateRef(oaCMDatabaseRef::SPtr   database,
00230                                                                         void                    *obj,
00231                                                                         const sd::sdObject      *sd,
00232                                                                         oaBoolean               isNew = false,
00233                                                                         oaCMObjectRef::SPtr     scope = NULL);
00234 
00235     virtual oaCMStringEntry::SPtr                   findStringEntry(oaCMDatabaseRef::SPtr   database,
00236                                                                     const oaString          &string);
00237     virtual oaCMStringEntry::SPtr                   allocStringEntry(oaCMDatabaseRef::SPtr  database,
00238                                                                      const oaString         &string);
00239 
00240     virtual oaCMObjectStateEntry::SPtr              allocObjectStateEntry(oaCMDatabaseRef::SPtr                     database,
00241                                                                           const sd::sdObject                        *def,
00242                                                                           const sr::srObjectState::AttributeMap     &attributes,
00243                                                                           const sr::srObjectState::RelationshipMap  &relationships);
00244 
00245     virtual void                                    accept(oaChangeSetVisitor *visitor);
00246     virtual void                                    accept(oaChangeRecVisitor   *visitor,
00247                                                            oaTimeStamp          minAge = 0);
00248 
00249     virtual void                                    getName(oaString &name) const;
00250     virtual oaTimeStamp                             getTimeStamp() const;
00251 
00252     virtual oaBoolean                               isActive() const;
00253     virtual void                                    setActive(oaBoolean state);
00254 
00255     virtual oaBoolean                               isExported() const;
00256     virtual void                                    setExported();
00257 
00258     oaCMDatabaseTbl::DatabaseRefConstIter           beginDatabaseRefs() const;
00259     oaCMDatabaseTbl::DatabaseRefConstIter           endDatabaseRefs() const;
00260 
00261     oaCMObjectRefTbl::ObjectRefConstIter            beginObjectRefs(oaCMDatabaseRef::SPtr database) const;
00262     oaCMObjectRefTbl::ObjectRefConstIter            endObjectRefs(oaCMDatabaseRef::SPtr database) const;
00263 
00264     oaCMObjectStateTbl::ObjectStateEntryConstIter   beginObjectStates(oaCMDatabaseRef::SPtr database) const;
00265     oaCMObjectStateTbl::ObjectStateEntryConstIter   endObjectStates(oaCMDatabaseRef::SPtr database) const;
00266 
00267     oaCMStringTbl::StringEntryConstIter             beginStrings(oaCMDatabaseRef::SPtr database) const;
00268     oaCMStringTbl::StringEntryConstIter             endStrings(oaCMDatabaseRef::SPtr database) const;
00269 
00270     virtual oaChangeRec                             *allocAttributeChangeRec(sr::srAttributeBase::SPtr      value,
00271                                                                              sd::sdAttributeActionType      action,
00272                                                                              sd::sdAttributeContainerType   type);
00273     virtual oaChangeRec                             *allocRelationshipChangeRec(sr::srRelationshipBase::SPtr    value,
00274                                                                                 sd::sdRelationshipActionType    action,
00275                                                                                 sd::sdRelationshipContainerType type);
00276 
00277 protected:
00278     oaChangeSetPvt                                  *m_impl;
00279 };
00280 
00281 
00282 
00283 // ****************************************************************************
00284 // oaChangeSetVisitor Interface
00285 // ****************************************************************************
00286 class OA_CM_DLL_API oaChangeSetVisitor {
00287 public:
00288     virtual void            visit(oaChangeSet *node) = 0;
00289 };
00290 
00291 
00292 
00293 END_OA_NAMESPACE
00294 
00295 #endif

Return to top of page