7 #ifndef __data_WeakRecordSB_h__ 8 #define __data_WeakRecordSB_h__ 41 bool isValid(
void)
const;
43 void set(
void *datablock);
45 FE_UWORD idr(
void)
const;
52 void demandSerialNumber(
void)
const;
55 T &accessAttribute(FE_UWORD aLocator)
const;
57 void *rawAttribute(FE_UWORD aLocator)
const;
60 void *
data(
void)
const;
67 void cacheSerialNumber(
void);
68 I32 readSerialNumber(
void)
const;
76 class WeakRecordSBInfo :
public BaseType::Info
79 virtual String print(
void *instance);
80 virtual IWORD output(std::ostream &ostrm,
void *instance, t_serialMode mode);
81 virtual void input(std::istream &istrm,
void *instance, t_serialMode mode);
82 virtual IWORD iosize(
void);
83 virtual bool getConstruct(
void);
84 virtual void construct(
void *instance);
85 virtual void destruct(
void *instance);
88 inline WeakRecordSB::WeakRecordSB(I32):
94 inline WeakRecordSB::WeakRecordSB(
const RecordSB& other)
98 m_spLayout = other.
layout();
99 m_pStateBlock = other.
data();
110 inline WeakRecordSB::WeakRecordSB(
const WeakRecordSB &other)
114 m_spLayout = other.m_spLayout;
115 m_pStateBlock = other.m_pStateBlock;
116 m_serialOffset = other.m_serialOffset;
117 m_serialNumber = other.m_serialNumber;
134 inline WeakRecordSB::~WeakRecordSB(
void)
138 inline WeakRecordSB::operator
RecordSB(
void)
143 record.
set(m_pStateBlock);
148 inline I32 WeakRecordSB::readSerialNumber(
void)
const 150 return (m_serialOffset==LayoutSB::offsetNone)?
151 -1: *((I32 *)((
char *)(m_pStateBlock) + m_serialOffset));
156 return m_spLayout.raw();
163 m_spLayout = other.m_spLayout;
164 m_pStateBlock = other.m_pStateBlock;
165 m_serialOffset = other.m_serialOffset;
166 m_serialNumber = other.m_serialNumber;
171 inline bool WeakRecordSB::operator==(
const WeakRecordSB &other)
const 173 return (m_pStateBlock == other.m_pStateBlock);
176 inline bool WeakRecordSB::operator!=(
const WeakRecordSB &other)
const 178 return (m_pStateBlock != other.m_pStateBlock);
185 if(m_serialNumber<0 || m_serialNumber==readSerialNumber())
199 m_pStateBlock = datablock;
200 m_spLayout = FE_SB_TO_HDR(m_pStateBlock)->m_pStore->getLayout();
203 #ifdef FE_MAKE_RECORD_FOR_WEAKRECORD 205 record.
set(datablock);
211 if(isValid() && m_serialNumber<0)
213 feLog(
"WeakRecordSB::set layout \"%s\"" 214 " doesn't support \":SN\" attribute -> refusing assignment\n",
215 m_spLayout->name().c_str());
223 inline T &WeakRecordSB::accessAttribute(FE_UWORD aLocator)
const 225 #if FE_CODEGEN<=FE_DEBUG 226 return *((T *)((
char *)(
data()) + layout()->offsetTable()[aLocator]));
228 return *((T *)((
char *)(
data()) + rawLayout()->offsetTable()[aLocator]));
232 inline void *WeakRecordSB::rawAttribute(FE_UWORD aLocator)
const 234 #if FE_CODEGEN<=FE_DEBUG 235 return (
void *)((
char *)(
data()) + layout()->offsetTable()[aLocator]);
237 return (
void *)((
char *)(
data()) + rawLayout()->offsetTable()[aLocator]);
241 inline void *WeakRecordSB::data(
void)
const 243 return m_pStateBlock;
248 return reinterpret_cast<FE_UWORD
>(m_pStateBlock);
256 inline void WeakRecordSB::cacheSerialNumber(
void)
258 U32 index = m_spLayout->serialIndex();
259 m_serialOffset = m_spLayout->offsetTable()[index];
260 m_serialNumber = readSerialNumber();
262 #if FE_CODEGEN <= FE_DEBUG 263 demandSerialNumber();
bool isValid(void) const
Return true if the Record points to a valid state block.
Definition: RecordSB.h:184
kernel
Definition: namespace.dox:3
const sp< LayoutSB > & layout(void) const
Return the Layout.
Definition: WeakRecordSB.h:251
void * data(void) const
Return the state block.
Definition: RecordSB.h:163
sp< Layout > layout(void) const
Return the Layout.
Definition: RecordSB.h:189
BWORD operator!=(const DualString &s1, const DualString &s2)
Compare two DualString's (reverse logic)
Definition: DualString.h:229
void set(void *datablock)
Set the state block.
Definition: RecordSB.h:194
FE_UWORD idr(void) const
Return the state block.
Definition: WeakRecordSB.h:246
BWORD operator==(const DualString &s1, const DualString &s2)
Compare two DualString's.
Definition: DualString.h:208
LayoutSB * rawLayout(void) const
Return a raw pointer to the Layout.
Definition: WeakRecordSB.h:154
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
bool isValid(void) const
Return true if the record points to the original valid state block.
Definition: WeakRecordSB.h:181
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Record "type" definition.
Definition: LayoutSB.h:32
Homogeneous collection of Records.
Definition: RecordArraySB.h:40
void set(void *datablock)
Set the state block.
Definition: WeakRecordSB.h:197
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17