Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef VISU_ColoredPrs3dCache_i_HeaderFile
00029 #define VISU_ColoredPrs3dCache_i_HeaderFile
00030
00031 #include "VISU_I.hxx"
00032
00033 #include "VISU_ColoredPrs3dFactory.hh"
00034
00035 #include "SALOME_GenericObjPointer.hh"
00036
00037 namespace VISU
00038 {
00039 class Result_i;
00040 class ColoredPrs3d_i;
00041 class ColoredPrs3dHolder_i;
00042
00043 struct TPrs3dPtr: SALOME::GenericObjPtr<ColoredPrs3d_i>
00044 {
00045 typedef SALOME::GenericObjPtr<ColoredPrs3d_i> TSuperClass;
00046
00048 TPrs3dPtr():
00049 TSuperClass()
00050 {}
00051
00053 TPrs3dPtr(ColoredPrs3d_i* thePointer):
00054 TSuperClass(thePointer)
00055 {}
00056
00061 TPrs3dPtr(const TPrs3dPtr& thePointer):
00062 TSuperClass(thePointer)
00063 {}
00064
00065
00070 TPrs3dPtr&
00071 operator=(const TPrs3dPtr& thePointer)
00072 {
00073 TSuperClass::operator=(thePointer);
00074 return *this;
00075 }
00076
00081 TPrs3dPtr&
00082 operator=(ColoredPrs3d_i* thePointer)
00083 {
00084 TSuperClass::operator=(thePointer);
00085 return *this;
00086 }
00087
00089 ColoredPrs3d_i*
00090 get() const
00091 {
00092 ColoredPrs3d_i* aColoredPrs3d = TSuperClass::get();
00093
00094 if(aColoredPrs3d)
00095 aColoredPrs3d->InitFromRestoringState();
00096 return aColoredPrs3d;
00097 }
00098 };
00099
00100 typedef std::deque<TPrs3dPtr> TLastVisitedPrsList;
00101
00102 typedef std::string THolderEntry;
00103 typedef std::map<THolderEntry,TLastVisitedPrsList> TColoredPrs3dHolderMap;
00104
00109 class VISU_I_EXPORT ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache,
00110 public virtual SALOME::GenericObj_i,
00111 public virtual RemovableObject_i
00112 {
00113 ColoredPrs3dCache_i();
00114 ColoredPrs3dCache_i(const ColoredPrs3dCache_i&);
00115 public:
00116
00118 explicit
00119 ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy,
00120 bool thePublishInStudy = true);
00121
00122 virtual
00123 ~ColoredPrs3dCache_i();
00124
00125
00127 virtual
00128 VISU::ColoredPrs3dHolder_ptr
00129 CreateHolder(VISU::VISUType theType,
00130 const VISU::ColoredPrs3dHolder::BasicInput& theInput);
00131
00132
00134 virtual
00135 VISU::ColoredPrs3dCache::EnlargeType
00136 GetRequiredMemory(VISU::VISUType theType,
00137 const VISU::ColoredPrs3dHolder::BasicInput& theInput,
00138 CORBA::Float& theRequiredMemory);
00139
00140
00142 virtual
00143 void
00144 SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode);
00145
00146 virtual
00147 VISU::ColoredPrs3dCache::MemoryMode
00148 GetMemoryMode();
00149
00150
00152 virtual
00153 void
00154 SetLimitedMemory(CORBA::Float theMemorySize);
00155
00156 virtual
00157 CORBA::Float
00158 GetLimitedMemory();
00159
00160 virtual
00161 CORBA::Float
00162 GetMemorySize();
00163
00164 virtual
00165 CORBA::Float
00166 GetDeviceMemorySize();
00167
00168
00169 virtual
00170 VISU::VISUType
00171 GetType()
00172 {
00173 return VISU::TCOLOREDPRS3DCACHE;
00174 }
00175
00176 virtual
00177 void
00178 RemoveFromStudy();
00179
00180 static
00181 std::string
00182 GetFolderName();
00183
00184 virtual
00185 const char*
00186 GetComment() const;
00187
00188 virtual
00189 void
00190 ToStream(std::ostringstream&);
00191
00192 virtual
00193 Storable*
00194 Restore(SALOMEDS::SObject_ptr theSObject,
00195 const Storable::TRestoringMap& theMap);
00196
00197 static
00198 Storable*
00199 StorableEngine(SALOMEDS::SObject_ptr theSObject,
00200 const Storable::TRestoringMap& theMap,
00201 const std::string& thePrefix,
00202 CORBA::Boolean theIsMultiFile);
00203
00204
00206 static
00207 VISU::ColoredPrs3dCache_i*
00208 GetInstance_i(SALOMEDS::Study_ptr theStudy);
00209
00210 static
00211 VISU::ColoredPrs3dCache_ptr
00212 GetInstance(SALOMEDS::Study_ptr theStudy);
00213
00215 VISU::ColoredPrs3d_i*
00216 CreateColoredPrs3d(VISU::VISUType theType,
00217 VISU::ColoredPrs3dHolder::BasicInput theInput);
00218
00220 VISU::ColoredPrs3d_i*
00221 RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d,
00222 const std::string& theHolderEntry);
00223
00225 VISU::ColoredPrs3d_i*
00226 CreatePrs(VISU::VISUType theType,
00227 VISU::ColoredPrs3dHolder::BasicInput theInput,
00228 VISU::ColoredPrs3dHolder_i* theHolder);
00229
00230 TLastVisitedPrsList&
00231 GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder);
00232
00233 TPrs3dPtr
00234 GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder);
00235
00236 bool
00237 UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder,
00238 VISU::ColoredPrs3d_i* thePrs,
00239 const VISU::ColoredPrs3dHolder::BasicInput& theInput,
00240 VISU::View3D_ptr theView3D);
00241
00243 void
00244 RemoveHolder(VISU::ColoredPrs3dHolder_i* theHolder);
00245
00246 public:
00247 static const std::string myComment;
00248
00249 protected:
00250
00251 virtual int
00252 IsPossible(VISU::VISUType theType,
00253 const VISU::ColoredPrs3dHolder::BasicInput& theInput,
00254 float& theMemoryToClear,
00255 const std::string theHolderEntry);
00256
00257 TPrs3dPtr
00258 FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList,
00259 const VISU::ColoredPrs3dHolder::BasicInput& theInput);
00260
00261
00262 void
00263 ClearCache(float theMemory = 0);
00264
00265 bool
00266 ClearMemory(CORBA::Float theRequiredMemory,
00267 const std::string& theHolderEntry);
00268
00269 void
00270 PrintCache();
00271
00272 private:
00273 CORBA::Float myLimitedMemory;
00274 VISU::ColoredPrs3dCache::MemoryMode myMemoryMode;
00275
00276 TColoredPrs3dHolderMap myHolderMap;
00277 };
00278
00279
00280
00281 }
00282
00283 #endif