7 #ifndef __data_AccessorSet_h__ 8 #define __data_AccessorSet_h__ 33 if(m_hpScope.isValid())
35 m_hpScope->removeAccessorSet(
this);
38 virtual FE_UWORD size(
void)
const {
return m_accessors.size(); }
41 return m_accessors[index];
46 if(!m_hpScope.isValid()) { feX(
"AccessorSet::==",
"invalid left scope"); }
47 if(!a_aset.m_hpScope.isValid()) { feX(
"AccessorSet::==",
"invalid right scope"); }
49 if(m_hpScope != a_aset.m_hpScope) {
return false; }
51 return (m_bitset == a_aset.m_bitset);
56 if(!m_hpScope.isValid()) { feX(
"AccessorSet::<",
"invalid left scope"); }
57 if(!a_aset.m_hpScope.isValid()) { feX(
"AccessorSet::<",
"invalid right scope"); }
58 if(m_hpScope != a_aset.m_hpScope) { feX(
"AccessorSet::<",
"scope mismatch"); }
60 return (m_bitset < a_aset.m_bitset);
66 if(!a_record.
isValid()) {
return false; }
67 bind(a_record.
layout()->scope());
68 bool rv = check(a_record);
71 m_optional_record = a_record;
72 for(
unsigned int i = 0; i < m_accessors.size(); i++)
74 m_accessors[i]->bind(a_record);
81 if(!spScope.isValid())
83 feX(
"AccessorSet::bind",
84 "given invalid scope");
86 if(m_hpScope==spScope)
90 if(m_hpScope.isValid())
92 feX(
"AccessorSet::bind",
"changed scope\n");
96 t_bitset bitset(m_hpScope->attributes().size());
97 for(
unsigned int j = 0; j < size(); j++)
99 bitset.set((*
this)[j]->index());
103 m_hpScope->addAccessorSet(
this);
110 if(!spLayout.isValid())
112 feX(
"AccessorSet::populate",
"has invalid layout\n");
114 bind(spLayout->scope());
115 for(
unsigned int i = 0; i < size(); i++)
117 spLayout->populate(*((*
this)[i]));
122 if(!m_hpScope.isValid())
124 feX(
"AccessorSet::populate",
"unset scope\n");
128 for(
unsigned int i = 0; i < size(); i++)
130 self_set.push_back((*
this)[i]->name());
133 for(
unsigned int i = 0; i < a_other.size(); i++)
135 m_hpScope->enforce(self_set, a_other.m_accessors[i]->name());
140 bind(spLayout->scope());
141 return m_bitset.is_subset_of(spLayout->bitset());
143 for(
unsigned int i = 0; i < size(); i++)
145 if(!((*
this)[i]->check(spLayout))) {
return false; }
152 return m_bitset.is_subset_of(spLayout->bitset());
156 return m_bitset.is_subset_of(spLayout->bitset());
161 bind(spRA->layout()->scope());
162 for(
unsigned int i = 0; i < size(); i++)
164 if(!((*
this)[i]->check(spRA))) {
return false; }
171 return m_bitset.is_subset_of(spRA->layout()->bitset());
173 for(
unsigned int i = 0; i < size(); i++)
175 if(!((*
this)[i]->check(spRA)))
185 return m_bitset.is_subset_of(a_record.
layout()->bitset());
187 for(
unsigned int i = 0; i < size(); i++)
189 if(!((*
this)[i]->check(a_record)))
198 bool check(
const Record &a_record)
200 return m_bitset.is_subset_of(a_record.
layout()->bitset());
202 for(
unsigned int i = 0; i < size(); i++)
204 if(!((*
this)[i]->check(a_record)))
214 const char *a_annotation)
216 for(
unsigned int i = 0; i < size(); i++)
218 if(!((*
this)[i]->check(a_record)))
220 feX(
"AccessorSet::assert",
221 "%s | %s | missing %s",
222 (a_annotation!=NULL)?a_annotation:
"",
223 a_record.
layout()->name().c_str(),
224 (*this)[i]->attribute()->name().c_str());
228 void enforce(
const String &a_ifHas)
230 for(
unsigned int i = 0; i < size(); i++)
232 m_hpScope->enforce(a_ifHas, (*
this)[i]->attribute()->name());
239 i_in != rg_input->end(); i_in++)
241 bind((*i_in)->layout()->scope());
244 for(
int i = (*i_in)->length() - 1; i >= 0; i--)
246 rg_output->
add((*i_in)->getRecord(i));
251 hp<Scope> scope(
void) {
return m_hpScope; }
256 i_in != rg_input->end(); i_in++)
258 bind((*i_in)->layout()->scope());
261 for(
int i = (*i_in)->length() - 1; i >= 0; i--)
263 a_records.push_back((*i_in)->getRecord(i));
269 void filter(std::vector<WeakRecord> &a_records,
sp<RecordGroup> rg_input)
272 i_in != rg_input->end(); i_in++)
274 bind((*i_in)->layout()->scope());
277 for(
int i = (*i_in)->length() - 1; i >= 0; i--)
279 a_records.push_back((*i_in)->getRecord(i));
284 const t_bitset &bitset(
void)
const {
return m_bitset; }
285 void setBitset(
const t_bitset &a_bs) { m_bitset = a_bs; }
290 if(m_hpScope.isValid())
292 a_accessor.
setup(m_hpScope, a_attribute);
293 m_accessors.push_back(&a_accessor);
294 t_bitset bitset(m_hpScope->attributes().size());
295 for(
unsigned int j = 0; j < size(); j++)
297 bitset.set((*
this)[j]->index());
301 if(m_optional_record.isValid())
303 a_accessor.
bind(m_optional_record);
308 if(m_hpScope.isValid())
310 m_accessors.push_back(&a_accessor);
311 t_bitset bitset(m_hpScope->attributes().size());
312 for(
unsigned int j = 0; j < size(); j++)
314 bitset.set((*
this)[j]->index());
318 if(m_optional_record.isValid())
320 a_accessor.
bind(m_optional_record);
325 for(
unsigned int i = 0; i < m_accessors.size(); i++)
327 m_accessors[i]->bind(a_record);
Set of accessors.
Definition: AccessorSet.h:18
virtual void add(const Record &record)
Add record to the collection.
Definition: RecordGroup.cc:77
kernel
Definition: namespace.dox:3
const sp< LayoutSB > & layout(void) const
Return the Layout.
Definition: WeakRecordSB.h:251
sp< Layout > layout(void) const
Return the Layout.
Definition: RecordSB.h:189
void bind(const WeakRecord &a_record)
optionally bind to a record
Definition: Accessor.h:111
Type inspecific Accessor.
Definition: Accessor.h:26
Safe handle for shared pointer.
Definition: Handled.h:61
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
STL style iterator.
Definition: RecordGroup.h:124
Wrapper for std::vector.
Definition: Array.h:21
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
void setup(sp< Scope > spScope, const String &attribute)
setup functions setup the accessor and also setup the Scope.
Definition: Accessor.cc:113
Populate a layout with attributes.
Definition: PopulateI.h:14
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192
Non-persistent reference to an instance of a Layout.
Definition: WeakRecordSB.h:17