7 #ifndef __data_LayoutAV_h__ 8 #define __data_LayoutAV_h__ 48 virtual void initialize(
void);
51 virtual void populate(
const String &attribute_name);
53 virtual void populate(
const String &attribute_name,
54 const String &attribute_type);
64 virtual void setName(
const String &name);
65 virtual const String& name(
void)
const;
66 virtual const String verboseName(
void)
const;
68 virtual void setConstruct(
bool construct);
69 virtual const bool &construct(
void)
const;
74 virtual void peek(Peeker &peeker);
76 virtual FE_UWORD attributeCount(
void)
const;
79 virtual bool checkAttribute(FE_UWORD a_locator)
const;
80 virtual bool checkAttributeStr(
const String &a_name);
81 virtual void resizeLocatorTable(FE_UWORD a_size);
87 void freeArrayIndex(
const FE_UWORD &aArrayIndex);
89 virtual void notifyOfAttributeChange(
sp<Depend> &depend);
91 FE_UWORD avSize(
void) {
return m_avSize; }
92 void *baseOfAV(FE_UWORD a_locatorIndex);
98 void addMissingAttributes(
void);
99 void assignDefaultAttributes(
RecordAV &r_new);
100 void destructAttributes(
const FE_UWORD &a_arrayIndex);
105 const FE_UWORD &idr(
const FE_UWORD &a_index)
const;
107 void acquireArrayIndex(
const FE_UWORD &aArrayIndex);
108 void releaseArrayIndex(
const FE_UWORD &aArrayIndex);
110 unsigned int serialIndex(
void)
const {
return m_serialIndex; }
112 void startUsing(
void);
114 bool isExactlyBitset(
const t_bitset a_bitset)
override;
115 bool containsBitset(
const t_bitset a_bitset)
override;
118 void createRecords(
RecordAV &r_new,U32 a_count);
125 #ifdef FE_AV_FASTITER_ENABLE 126 std::vector< FE_UWORD > m_bounce;
127 std::vector< FE_UWORD > m_bounceback;
129 std::set< FE_UWORD > m_freeList;
131 FE_UWORD m_allocSize;
135 unsigned int m_serialIndex;
137 bool m_need_defaults;
140 void* voidAccess(
const FE_UWORD &a_locatorIndex,
141 const FE_UWORD &a_arrayIndex)
const;
143 #ifdef FE_AV_FASTITER_ENABLE 144 bool existenceCheck(
const FE_UWORD &a_locatorIndex,
145 const FE_UWORD &a_arrayIndex)
const;
150 const FE_DL_PUBLIC FE_UWORD locatorNone = (FE_UWORD)(-1);
152 const FE_DL_PUBLIC FE_UWORD arrayindexNone = (FE_UWORD)(-1);
155 #if FE_DATA_STORE==FE_AV 159 #ifdef FE_AV_FASTITER_ENABLE 160 inline void *LayoutAV::voidAccess(
const FE_UWORD &a_locatorIndex,
161 const FE_UWORD &a_arrayIndex)
const 163 FEASSERT(m_locatorTable[a_locatorIndex]!=locatorNone);
164 FEASSERT(a_arrayIndex!=arrayindexNone);
165 FEASSERT(m_bounce[a_arrayIndex]>=0);
166 FEASSERT(m_locatorTable[a_locatorIndex]<m_attributeVector.size());
167 return (
void *)(m_attributeVector[m_locatorTable[a_locatorIndex]]->raw_at(
168 m_bounce[a_arrayIndex]));
171 inline bool LayoutAV::existenceCheck(
const FE_UWORD &a_locatorIndex,
172 const FE_UWORD &a_arrayIndex)
const 174 if(I32(a_locatorIndex) < 0) {
return FALSE; }
175 if(a_locatorIndex >= m_locatorTable.size()) {
return FALSE; }
176 if(I32(a_arrayIndex) < 0) {
return FALSE; }
177 if(a_arrayIndex >= m_bounce.size()) {
return FALSE; }
178 if(I32(m_bounce[a_arrayIndex]) < 0) {
return FALSE; }
188 inline void *LayoutAV::voidAccess(
const FE_UWORD &a_locatorIndex,
189 const FE_UWORD &a_arrayIndex)
const 191 FEASSERT(m_locatorTable[a_locatorIndex]!=locatorNone);
192 FEASSERT(a_arrayIndex!=arrayindexNone);
193 return (
void *)(m_attributeVector[m_locatorTable[a_locatorIndex]]->raw_at(
198 inline void *LayoutAV::baseOfAV(FE_UWORD a_locatorIndex)
200 return m_attributeVector[m_locatorTable[a_locatorIndex]]->raw_at(0);
203 inline bool LayoutAV::checkAttribute(FE_UWORD aLocator)
const 205 return (m_locatorTable[aLocator] != locatorNone);
208 inline const FE_UWORD &LayoutAV::idr(
const FE_UWORD &aIndex)
const 210 return m_idr[aIndex];
215 return m_attributeVector;
220 return m_locatorTable;
225 inline void LayoutAV::setName(
const String &name)
230 inline const String& LayoutAV::name(
void)
const 235 inline const String LayoutAV::verboseName(
void)
const 237 return "Layout " + name();
240 inline void LayoutAV::setConstruct(
bool construct)
243 m_construct = construct;
245 inline const bool &LayoutAV::construct(
void)
const 257 inline void LayoutAV::acquireArrayIndex(
const FE_UWORD &aArrayIndex)
261 #ifndef FE_AV_FASTITER_ENABLE 262 m_rc->at(aArrayIndex)++;
264 m_rc->at(m_bounce[aArrayIndex])++;
269 feX(
"RC is on by default, should not get here");
273 inline void LayoutAV::releaseArrayIndex(
const FE_UWORD &aArrayIndex)
279 #ifndef FE_AV_FASTITER_ENABLE 280 std::atomic<int> &rc = m_rc->at(aArrayIndex);
282 std::atomic<int> &rc = m_rc->at(m_bounce[aArrayIndex]);
287 destructAttributes(aArrayIndex);
288 freeArrayIndex(aArrayIndex);
Homogeneous collection of Records.
Definition: RecordArrayAV.h:32
Class level locking for thread safety.
Definition: Safe.h:213
kernel
Definition: namespace.dox:3
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Type inspecific Accessor.
Definition: Accessor.h:26
Safe handle for shared pointer.
Definition: Handled.h:61
Automatically reference-counted string container.
Definition: String.h:128
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordAV.h:25
Layout namespace.
Definition: Scope.h:71
Record "type" definition.
Definition: LayoutAV.h:30
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordAV.h:17