Warning, file /include/opencascade/StdObjMgt_ReadData.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _StdObjMgt_ReadData_HeaderFile
0015 #define _StdObjMgt_ReadData_HeaderFile
0016
0017 #include <Standard.hxx>
0018 #include <Storage_BaseDriver.hxx>
0019 #include <NCollection_Array1.hxx>
0020
0021 class StdObjMgt_Persistent;
0022 class Standard_GUID;
0023
0024
0025
0026 class StdObjMgt_ReadData
0027 {
0028 public:
0029
0030
0031
0032 class ObjectSentry
0033 {
0034 public:
0035 explicit ObjectSentry (StdObjMgt_ReadData& theData) : myReadData (&theData)
0036 { myReadData->myDriver->BeginReadObjectData(); }
0037
0038 ~ObjectSentry ()
0039 { myReadData->myDriver->EndReadObjectData(); }
0040
0041 private:
0042 StdObjMgt_ReadData* myReadData;
0043
0044 ObjectSentry (const ObjectSentry&);
0045 ObjectSentry& operator = (const ObjectSentry&);
0046 };
0047
0048 Standard_EXPORT StdObjMgt_ReadData
0049 (const Handle(Storage_BaseDriver)& theDriver, const Standard_Integer theNumberOfObjects);
0050
0051 template <class Instantiator>
0052 void CreatePersistentObject
0053 (const Standard_Integer theRef, Instantiator theInstantiator)
0054 { myPersistentObjects (theRef) = theInstantiator(); }
0055
0056 Standard_EXPORT void ReadPersistentObject
0057 (const Standard_Integer theRef);
0058
0059 Handle(StdObjMgt_Persistent) PersistentObject
0060 (const Standard_Integer theRef) const
0061 { return myPersistentObjects (theRef); }
0062
0063 Standard_EXPORT Handle(StdObjMgt_Persistent) ReadReference();
0064
0065 template <class Persistent>
0066 StdObjMgt_ReadData& operator >> (Handle(Persistent)& theTarget)
0067 {
0068 theTarget = Handle(Persistent)::DownCast (ReadReference());
0069 return *this;
0070 }
0071
0072 StdObjMgt_ReadData& operator >> (Handle(StdObjMgt_Persistent)& theTarget)
0073 {
0074 theTarget = ReadReference();
0075 return *this;
0076 }
0077
0078 template <class Type>
0079 StdObjMgt_ReadData& ReadValue (Type& theValue)
0080 {
0081 *myDriver >> theValue;
0082 return *this;
0083 }
0084
0085 StdObjMgt_ReadData& operator >> (Standard_Character& theValue)
0086 { return ReadValue (theValue); }
0087
0088 StdObjMgt_ReadData& operator >> (Standard_ExtCharacter& theValue)
0089 { return ReadValue (theValue); }
0090
0091 StdObjMgt_ReadData& operator >> (Standard_Integer& theValue)
0092 { return ReadValue (theValue); }
0093
0094 StdObjMgt_ReadData& operator >> (Standard_Boolean& theValue)
0095 { return ReadValue (theValue); }
0096
0097 StdObjMgt_ReadData& operator >> (Standard_Real& theValue)
0098 { return ReadValue (theValue); }
0099
0100 StdObjMgt_ReadData& operator >> (Standard_ShortReal& theValue)
0101 { return ReadValue (theValue); }
0102
0103 private:
0104 Handle(Storage_BaseDriver) myDriver;
0105 NCollection_Array1<Handle(StdObjMgt_Persistent)> myPersistentObjects;
0106 };
0107
0108 Standard_EXPORT StdObjMgt_ReadData& operator >>
0109 (StdObjMgt_ReadData& theReadData, Standard_GUID& theGUID);
0110
0111 #endif