14 return (x == cl->
p_data_info->end()) ? 0 : x->second->offset;
23 const char * fname =
"OksIndex::OksIndex(OksClass *, OksAttribute *";
32 <<
"Can't build index for ABSTRACT class \"" << c->get_name() <<
"\"\n";
37 Oks::error_msg(fname) <<
"Can't build index for NIL attribute\n";
43 <<
"Can't find attribute \"" << a->p_name <<
"\" in class \""
44 << c->get_name() <<
"\" to build index.\n";
50 <<
"Class \"" << c->get_name() <<
"\" already has index for attribute \""
51 << a->p_name <<
"\".\n";
63 for(OksObject::Map::iterator i = c->p_objects->begin(); i != c->p_objects->end(); ++i)
67 std::cout <<
"Build index for attribute \'" <<
a->
p_name <<
"\' in class \'" <<
c->
get_name()
68 <<
"\' for " <<
size() <<
" instances\n";
71 for(
int j=0; j<entries(); j++) {
74 std::cout << j <<
".\tobject id \'" << obj->GetId() <<
"\' "
75 <<
"\tvalue: \'" << obj->data[
offset] <<
"\'\n";
96 std::pair<Position, Position> positions = equal_range(o);
100 for(; i != i2; ++i) {
118 if(pos != end())
return *pos;
134 i1 = lower_bound(&test_o);
137 if((*i1)->data[
offset] == *d) {
138 i2 = upper_bound(&test_o);
149 i2 = lower_bound(&test_o);
152 i2 = upper_bound(&test_o);
159 i1 = upper_bound(&test_o);
162 i1 = lower_bound(&test_o);
179 for(;pos1 != pos2; ++pos1) olist->push_back(*pos1);
195 if((andOperation ==
true) && (a1 == b1))
return 0;
201 if(andOperation ==
true) {
202 if(a2 == b2)
return 0;
215 if((b2 != end()) && ((*b2)->data[
offset] < (*a1)->data[
offset]))
return 0;
219 if((b1 != end()) && (*a2)->data[
offset] > (*b1)->data[
offset])
return 0;
223 if(b2 == end() || b1 == end()) {
224 pos2 = (b2 != end()) ? b2 : b1;
227 pos2 = ((*b2)->data[
offset] <= (*b1)->data[
offset]) ? b2 : b1;
230 for(;pos1 != pos2; ++pos1) olist->push_back(*pos1);
233 if(a1 != b1 && a2 == b2) {
235 for(;a1 != b1; ++a1) olist->push_back(*a1);
237 else if(a2 != b2 && a1 == b1) {
239 for(;a2 != b2; ++a2) olist->push_back(*a2);
241 else if(a1 != b1 && a2 != b2) {
255 if(b2 != end() && (*b2)->data[
offset] < (*a1)->data[
offset]) {
256 for(;a2 != b2; ++a2) olist->push_back(*a2);
257 for(;a1 != b1; ++a1) olist->push_back(*a1);
265 if(b1 != end() && (*a2)->data[
offset] > (*b1)->data[
offset]) {
266 for(;a1 != b1; ++a1) olist->push_back(*a1);
267 for(;a2 != b2; ++a2) olist->push_back(*a2);
275 if(b2 == end() || b1 == end()) {
276 pos2 = (b2 == end()) ? b2 : b1;
279 pos2 = ((*b2)->data[
offset] >= (*b1)->data[
offset]) ? b2 : b1;
281 for(;pos1 != pos2; ++pos1) olist->push_back(*pos1);
const std::string & get_name() const noexcept
out stream operator
bool get_is_abstract() const noexcept
OksObject::Map * p_objects
OksIndex::Map * p_indices
const std::string & get_name() const noexcept
OksAttribute * find_attribute(const std::string &name) const noexcept
Find attribute (search in this and base classes).
OksDataInfo::Map * p_data_info
std::map< const OksAttribute *, OksIndex *, SortByName > Map
static size_t get_offset(OksClass *, OksAttribute *)
OksObject * FindFirst(OksData *d) const
OksObject * remove_obj(OksObject *)
std::multiset< OksObject *, OksObjectSortBy >::iterator Position
OksObject::List * find_all(OksData *, OksQuery::Comparator) const
std::multiset< OksObject *, OksObjectSortBy >::const_iterator ConstPosition
OksIndex(OksClass *, OksAttribute *)
void find_interval(OksData *, OksQuery::Comparator, ConstPosition &, ConstPosition &) const
OksObject describes instance of OksClass.
std::list< OksObject * > List
static bool equal_cmp(const OksData *, const OksData *)
static bool greater_cmp(const OksData *, const OksData *)
static bool less_or_equal_cmp(const OksData *, const OksData *)
bool(*) Comparator(const OksData *, const OksData *)
static bool greater_or_equal_cmp(const OksData *, const OksData *)
static bool less_cmp(const OksData *, const OksData *)
static std::ostream & error_msg(const char *)
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size
the structure to pass common parameters to various read() methods of OksData and OksObject class