24 #ifndef __OdGsFilerV100Impl_H__
25 #define __OdGsFilerV100Impl_H__
71 for (
OdUInt32 nb = 0; nb < nBytes; nb++)
85 operator const void*()
const {
return this; }
119 typedef std::map<OdUInt32, AbstractTyp>
RegsMap;
124 template<OdUInt32 nBytes>
struct Procs
127 typedef std::map<ProcTyp, ProcTyp>
RegMap;
129 static void makeSubst(
void *pPlace,
const void *pSubstitution)
140 if (pPlace && pSubstitution)
142 runSubst(pPlace, pSubstitution, pAct);
151 if (itReg != pRegMap->end())
153 runSubst(pPlace, itReg->second, pAct);
155 pRegMap->erase(itReg);
158 else if (pSubstitution)
162 if (itSub != pSubMap->end())
164 for (
OdInt32 n = 0; n < itSub->second.m_nVoids; n++)
165 runSubst(itSub->second.at(n)->m_pVoid, pSubstitution, itSub->second.at(n)->m_pAct);
167 pSubMap->erase(itSub);
174 if (pRegMap && pSubMap)
178 if ((itReg != pRegMap->end()) && (itSub != pSubMap->end()))
180 for (
OdInt32 n = 0; n < itSub->second.m_nVoids; n++)
181 runSubst(itSub->second.at(n)->m_pVoid, itReg->second, itSub->second.at(n)->m_pAct);
185 if (itReg != pRegMap->end())
186 pRegMap->erase(itReg);
187 if (itSub != pSubMap->end())
188 pSubMap->erase(itSub);
196 if (itReg != pRegMap->end())
197 pRegMap->erase(itReg);
202 if (itSub != pSubMap->end())
203 pSubMap->erase(itSub);
211 if (pRegMap && pSubMap)
213 OD_TYPENAME RegMap::iterator itReg = pRegMap->begin();
214 while (itReg != pRegMap->end())
216 OD_TYPENAME SubstMap::iterator itSub = pSubMap->find(itReg->first);
217 if (itSub != pSubMap->end())
219 for (
OdInt32 n = 0; n < itSub->second.m_nVoids; n++)
220 runSubst(itSub->second.at(n)->m_pVoid, itReg->second, itSub->second.at(n)->m_pAct);
227 if (pRegMap) {
delete pRegMap; impl.
m_regs[nBytes].m_pContainer =
NULL; }
228 if (pSubMap) {
delete pSubMap; impl.
m_substs[nBytes].m_pContainer =
NULL; }
242 subst(impl, pValue,
NULL,
NULL, pSubstitution,
false);
254 if (itReg != pRegMap->end())
256 runSubst(pPlace, itReg->second, pAct);
265 pMap[*(
const ProcTyp*)pValue].add(pPlace, pAct);
268 subst(impl, pValue, pPlace, pAct,
NULL,
false);
279 if (it != pRegMap->end())
285 if (it != pSubMap->end())
291 if (pRegMap) {
delete pRegMap; impl.
m_regs[nBytes].m_pContainer =
NULL; }
292 if (pSubMap) {
delete pSubMap; impl.
m_substs[nBytes].m_pContainer =
NULL; }
300 OdRxObjectSubstitutionActuator() { }
301 virtual void applySubstitution(
void *pPlace,
const void *pValue, SetPtrFunc pSetFunc)
307 } g_rxObjectActuator;
330 kOpenedForWrite = (1 << 0),
332 kLastFlag = kOpenedForWrite
373 , m_nCurSection(kEOFSection)
374 , m_nCurSectionSize(0)
#define GS_TOOLKIT_EXPORT
OdSmartPtr< OdGsFilerDbLinker > OdGsFilerDbLinkerPtr
bool operator>=(const OdString &s1, const OdString &s2)
bool operator<=(const OdString &s1, const OdString &s2)
bool operator<(const OdString &s1, const OdString &s2)
bool operator>(const OdString &s1, const OdString &s2)
#define SETBIT(flags, bit, value)
#define GETBIT(flags, bit)
virtual OdUInt64 stubToDbHandle(OdDbStub *pStub) const =0
virtual OdDbBaseDatabase * getDatabase() const =0
virtual OdDbStub * handleToDbStub(OdUInt64 nHandle) const =0
virtual OdBinaryData getDbHash(const OdDbBaseDatabase *pDb) const
virtual OdDbBaseDatabase * getDatabase(OdDbStub *pStub) const =0
virtual ~OdGsFilerDbLinker()
virtual void wrHandle(OdDbStub *pHandle)
virtual void wrSectionEnd(Section section)
virtual void setReadSections(OdUInt64 nSections)
virtual OdDbStub * rdHandle() const
virtual OdRxObjectPtr rdClass() const
std::map< OdString, OdRxObjectPtr > ArbDataMap
virtual bool checkDbHash(const OdDbBaseDatabase *pDb)
virtual OdDbBaseDatabase * getDatabase() const
virtual bool setStream(OdStreamBuf *pStream, bool bWrite=false)
virtual void skipSection() const
virtual bool hasArbitraryData(const OdChar *pName) const
virtual bool isWriteSection(Section section) const
OdUInt32 headerTestChunk() const
virtual void unregisterPtr(const void *pPtr)
virtual void wrEOFSection()
OdSmartPtr< OdGsFiler_SubstitutorImpl > m_subst
virtual void wrRawData(const void *pData, OdUInt32 nDataSize)
virtual Section rdSection() const
virtual OdRxObjectPtr getArbitraryData(const OdChar *pName) const
virtual void wrDbHash(const OdDbBaseDatabase *pDb)
OdGsFilerDbLinkerPtr m_pLinker
virtual void setArbitraryData(const OdChar *pName, OdRxObject *pObject)
std::set< const void * > RegPtrsSet
virtual void setWriteSection(Section section, bool bSet)
virtual void rdBackSection() const
virtual void wrClass(OdRxObject *pObj)
virtual void rdRawData(void *pData, OdUInt32 nDataSize) const
virtual OdRxObjectPtr getSubstitutor() const
virtual Section curSection() const
OdUInt64 m_nSectionsToWrite
virtual void setVersion(OdUInt32 nVersion)
virtual void setSubstitutor(OdRxObject *pSubst)
virtual void wrSectionBegin(Section section)
virtual void setDatabase(const OdDbBaseDatabase *pDb)
virtual void clearArbitraryData()
virtual void clearRegisteredPtrs()
virtual bool isPtrRegistered(const void *pPtr) const
virtual OdUInt32 version() const
virtual bool isReadSection(Section section) const
virtual void setReadSection(Section section, bool bSet)
virtual Substitutor * subst() const
virtual bool checkEOF() const
virtual void makeSubstitutions(bool bClear=true) const
virtual void registerPtr(const void *pPtr)
OdUInt64 m_nSectionsToRead
void setWriting(bool bSet)
virtual void setWriteSections(OdUInt64 nSections)
OdUInt32 m_nCurSectionSize
OdStack< WrSectionData > m_sectionStack
virtual OdStreamBufPtr getStream() const
static OdSmartPtr< TInterface > createObject()
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)
virtual void applySubstitution(void *pPlace, const void *pValue, SetPtrFunc pSetFunc)
virtual void clearSubstitutions(const void *pValue=NULL, OdUInt32 size=0)=0
static int compare(const DataTyp &t1, const DataTyp &t2)
std::map< ProcTyp, VoidArry > SubstMap
static void subst(OdGsFiler_SubstitutorImpl &impl, const void *pValue, void *pPlace, OdGsFiler::SubstitutionActuator *pAct, const void *pSubstitution, bool bClear)
std::map< ProcTyp, ProcTyp > RegMap
static void clear(OdGsFiler_SubstitutorImpl &impl, const void *pValue)
OdGsFiler_SubstitutorImpl::DataTyp< nBytes > ProcTyp
static void reg(OdGsFiler_SubstitutorImpl &impl, const void *pValue, const void *pSubstitution, bool bRegister, bool bImmediate)
static void runSubst(void *pPlace, const void *pSubstitution, OdGsFiler::SubstitutionActuator *pActuator)
static void req(OdGsFiler_SubstitutorImpl &impl, void *pPlace, OdGsFiler::SubstitutionActuator *pAct, const void *pValue, bool bRegister, bool bImmediate)
static void makeSubst(void *pPlace, const void *pSubstitution)
void add(void *pVoid, OdGsFiler::SubstitutionActuator *pAct)
bool contains(void *pVoid)
OdGsFiler::SubstitutionActuator * m_pAct
~OdGsFiler_SubstitutorImpl()
std::map< OdUInt32, AbstractTyp > SubstsMap
virtual void requestSubstitution(void *pPlace, OdGsFiler::SubstitutionActuator *pActuator, const void *pValue, OdUInt32 size=sizeof(OdIntPtr), bool bRegister=true, bool bImmediate=true)
virtual void requestSubstitution(OdBaseObjectPtr *pPlace, const void *pValue, bool bRegister=true, bool bImmediate=true)
virtual void registerSubstitution(const void *pValue, const void *pSubstitution, OdUInt32 size=sizeof(OdIntPtr), bool bRegister=true, bool bImmediate=false)
virtual void runSubstitutions(const void *pValue=NULL, OdUInt32 size=0, bool bClear=true)
std::map< OdUInt32, AbstractTyp > RegsMap
virtual void requestSubstitution(void *pPlace, const void *pValue, OdUInt32 size=sizeof(OdIntPtr), bool bRegister=true, bool bImmediate=true)
virtual void clearSubstitutions(const void *pValue=NULL, OdUInt32 size=0)
static OdGsFiler::SubstitutionActuator g_defActuator
OdGsFiler::Section m_type
WrSectionData(OdGsFiler::Section section, OdUInt32 tell)