13 OksDataInfo::Map::const_iterator x = cl->
p_data_info->find(
a->p_name);
14 return (x == cl->
p_data_info->end()) ? 0 : x->second->offset;
23 const char * fname =
"OksIndex::OksIndex(OksClass *, OksAttribute *";
30 if(
c->get_is_abstract()) {
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";
41 if(
c->find_attribute(
a->get_name()) == 0) {
43 <<
"Can't find attribute \"" << a->p_name <<
"\" in class \""
44 << c->get_name() <<
"\" to build index.\n";
48 if(
c->p_indices &&
c->p_indices->find(
a) !=
c->p_indices->end()) {
50 <<
"Class \"" << c->get_name() <<
"\" already has index for attribute \""
51 << a->p_name <<
"\".\n";
55 offset = ((*
c->p_data_info)[
a->p_name])->offset;
60 (*
c->p_indices)[
a] =
this;
62 if(
c->p_objects && !
c->p_objects->empty()) {
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";
83 c->p_indices->erase(
a);
85 if(
c->p_indices->empty()) {
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);
OksDataInfo::Map * p_data_info
static size_t get_offset(OksClass *, OksAttribute *)
std::multiset< OksObject *, OksObjectSortBy >::const_iterator ConstPosition
std::multiset< OksObject *, OksObjectSortBy >::iterator Position
OksObject * FindFirst(OksData *d) const
std::map< const OksAttribute *, OksIndex *, SortByName > Map
OksObject * remove_obj(OksObject *)
OksObject::List * find_all(OksData *, OksQuery::Comparator) const
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 *)
static bool greater_or_equal_cmp(const OksData *, const OksData *)
static bool less_cmp(const OksData *, const OksData *)
bool(* Comparator)(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