7 #ifndef __data_WeakRecordAV_h__ 8 #define __data_WeakRecordAV_h__ 41 bool isValid(
void)
const;
42 FE_UWORD idr(
void)
const;
49 void demandSerialNumber(
void)
const;
52 T &accessAttribute(FE_UWORD aLocator)
const;
54 void *rawAttribute(FE_UWORD aLocator)
const;
64 void cacheSerialNumber(
void);
65 I32 readSerialNumber(
void)
const;
68 FE_UWORD m_arrayIndex;
73 class WeakRecordAVInfo :
public BaseType::Info
76 virtual String print(
void *instance);
77 virtual IWORD output(std::ostream &ostrm,
void *instance, t_serialMode mode);
78 virtual void input(std::istream &istrm,
void *instance, t_serialMode mode);
79 virtual IWORD iosize(
void);
80 virtual bool getConstruct(
void);
81 virtual void construct(
void *instance);
82 virtual void destruct(
void *instance);
85 inline WeakRecordAV::WeakRecordAV(I32):
86 m_arrayIndex(RecordAV::ms_invalidIndex),
92 inline WeakRecordAV::WeakRecordAV(
const RecordAV& other)
96 m_hpLayout = other.
layout();
97 m_arrayIndex = other.m_arrayIndex;
103 m_arrayIndex = RecordAV::ms_invalidIndex;
108 inline WeakRecordAV::WeakRecordAV(
const WeakRecordAV &other)
112 m_hpLayout = other.m_hpLayout;
113 m_arrayIndex = other.m_arrayIndex;
114 m_serialLocator = other.m_serialLocator;
115 m_serialNumber = other.m_serialNumber;
119 m_arrayIndex = RecordAV::ms_invalidIndex;
124 inline WeakRecordAV::~WeakRecordAV(
void)
128 inline WeakRecordAV::operator
RecordAV(
void)
133 record.set(m_arrayIndex, m_hpLayout);
138 inline I32 WeakRecordAV::readSerialNumber(
void)
const 140 #ifdef FE_AV_FASTITER_ENABLE 141 if(!m_hpLayout->existenceCheck(m_serialLocator, m_arrayIndex))
143 feLog(
"WeakRecordAV::readSerialNumber failed %d %d\n",
144 m_serialLocator, m_arrayIndex);
148 return accessAttribute<int>(m_serialLocator);
153 return m_hpLayout.raw();
160 m_hpLayout = other.m_hpLayout;
161 m_arrayIndex = other.m_arrayIndex;
162 m_serialLocator = other.m_serialLocator;
163 m_serialNumber = other.m_serialNumber;
168 inline bool WeakRecordAV::operator==(
const WeakRecordAV &other)
const 170 if (m_hpLayout != other.m_hpLayout) {
return false; }
171 return (m_arrayIndex == other.m_arrayIndex);
174 inline bool WeakRecordAV::operator!=(
const WeakRecordAV &other)
const 176 if (m_hpLayout != other.m_hpLayout) {
return true; }
177 return (m_arrayIndex != other.m_arrayIndex);
182 if(m_arrayIndex != RecordAV::ms_invalidIndex)
184 if(m_serialNumber<0 || m_serialNumber==readSerialNumber())
189 const_cast<WeakRecordAV*
>(
this)->m_arrayIndex=RecordAV::ms_invalidIndex;
196 inline void WeakRecordAV::set(FE_UWORD aArrayIndex,
sp<LayoutAV> &aLayout)
198 m_arrayIndex = aArrayIndex;
199 m_hpLayout = aLayout;
202 #ifdef FE_MAKE_RECORD_FOR_WEAKRECORD 204 record.set(aArrayIndex, aLayout);
210 if(isValid() && m_serialNumber<0)
212 feLog(
"WeakRecordAV::set layout \"%s\" SN %d" 213 " doesn't support \":SN\" attribute -> refusing assignment\n",
214 m_hpLayout->name().c_str(),m_serialNumber);
216 m_arrayIndex=RecordAV::ms_invalidIndex;
223 inline T &WeakRecordAV::accessAttribute(FE_UWORD aLocator)
const 226 const FE_UWORD &avIndex = layout()->locatorTable()[aLocator];
228 TypeVector<T> &typeVector =
dynamic_cast< TypeVector<T>&
>(*(layout()->attributeVector()[avIndex]));
229 return typeVector.at(m_arrayIndex);
231 return *(T *)(m_hpLayout->voidAccess(aLocator, m_arrayIndex));
234 inline void *WeakRecordAV::rawAttribute(FE_UWORD aLocator)
const 237 const FE_UWORD &avIndex = layout()->locatorTable()[aLocator];
239 return baseVector->raw_at(m_arrayIndex);
241 return (m_hpLayout->voidAccess(aLocator, m_arrayIndex));
244 inline FE_UWORD WeakRecordAV::idr(
void)
const 246 return m_hpLayout->idr(m_arrayIndex);
255 inline void WeakRecordAV::cacheSerialNumber(
void)
257 U32 index = m_hpLayout->serialIndex();
258 m_serialLocator = index;
259 m_serialNumber = readSerialNumber();
261 #if FE_CODEGEN <= FE_DEBUG 262 demandSerialNumber();
Homogeneous collection of Records.
Definition: RecordArrayAV.h:32
sp< Layout > layout(void) const
Return the Layout.
Definition: RecordAV.h:174
kernel
Definition: namespace.dox:3
BWORD operator!=(const DualString &s1, const DualString &s2)
Compare two DualString's (reverse logic)
Definition: DualString.h:229
BWORD operator==(const DualString &s1, const DualString &s2)
Compare two DualString's.
Definition: DualString.h:208
Automatically reference-counted string container.
Definition: String.h:128
const sp< LayoutAV > & layout(void) const
Return the Layout.
Definition: WeakRecordAV.h:249
bool isValid(void) const
Return true if the record points to the original valid state block.
Definition: WeakRecordAV.h:180
Reference to an instance of a Layout.
Definition: RecordAV.h:25
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Layout namespace.
Definition: Scope.h:71
bool isValid(void) const
Return true if the Record points to a valid state block.
Definition: RecordAV.h:195
Record "type" definition.
Definition: LayoutAV.h:30
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordAV.h:17
LayoutAV * rawLayout(void) const
Return a raw pointer to the Layout.
Definition: WeakRecordAV.h:151