473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reg C++ implementation for in memory database

Hi,
I have a container that holds objects of same type (user defined
class), where each object has multiple attributes. These objects have
primary key (similar to a database) formed by combination of two
attributes, but I want to support multiple views of data by looking at
different combination of attributes and in some cases I might want to
combine these. For instance, lets say the class has four attributes
a1,a2,a3,a4; and primary key is a1+a4, now I can construct a view that
has subset of objects of this class by doing a search on these objects
that have specific values for attribute a3, and this can give me back
multiple objects and I want to combine the objects that have same
value for a2 into one ; this looks like a classic database
implementation but I dont have real database in my case, instead I have
set of objects and the query I am doing is on these objects based on
combination of attributes of the class. Any pointers on how to do this
using STL classes would be appreciated. I am looking into using
associative containers.. Is this already implemented by someone? I dont
care too much about efficiency since I wont have more than 100 of these
objects...
Thanks,
Sunil.

May 7 '06 #1
10 5270
Try a STL map type, keyed on an object that is a combination of a1 and
a4.

May 8 '06 #2
sunil wrote:
I have a container that holds objects of same type (user defined
class), where each object has multiple attributes. These objects have
primary key (similar to a database) formed by combination of two
attributes, but I want to support multiple views of data by looking at
different combination of attributes and in some cases I might want to
combine these. For instance, lets say the class has four attributes
a1,a2,a3,a4; and primary key is a1+a4...


sqlite is trivial to install and run. It works off a data file and can do
arbitrarily complex SQL statements, such as joins.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
May 8 '06 #3
sunil wrote:
Hi,
I have a container that holds objects of same type (user defined
class), where each object has multiple attributes. These objects have
primary key (similar to a database) formed by combination of two
attributes, but I want to support multiple views of data by looking at
different combination of attributes and in some cases I might want to
combine these.
[...]
this looks like a classic database
implementation but I dont have real database in my case, instead I have
set of objects and the query I am doing is on these objects based on
combination of attributes of the class. Any pointers on how to do this
using STL classes would be appreciated. I am looking into using
associative containers.. Is this already implemented by someone? I dont
care too much about efficiency since I wont have more than 100 of these
objects...
Thanks,
Sunil.


Boost.MultiIndex library can do this sort of thing:
http://www.boost.org/libs/multi_index/doc/index.html

Also there is relational Template Library (RTL) in boost sandbox:
http://tinyurl.com/zwe2o

regards
Andy Little

May 8 '06 #4

an**@servocomm.freeserve.co.uk wrote:
Boost.MultiIndex library can do this sort of thing:
http://www.boost.org/libs/multi_index/doc/index.html

Also there is relational Template Library (RTL) in boost sandbox:
http://tinyurl.com/zwe2o


Also forgot about fusion, though you would need to implement your data
as tuples for this library:

http://spirit.sourceforge.net/dl_mor...tml/index.html

regards
Andy Little

May 8 '06 #5
On 8 May 2006 01:39:13 -0700, an**@servocomm.freeserve.co.uk wrote:
an**@servocomm.freeserve.co.uk wrote:
Boost.MultiIndex library can do this sort of thing:
http://www.boost.org/libs/multi_index/doc/index.html
Also there is relational Template Library (RTL) in boost sandbox:
http://tinyurl.com/zwe2o

Also forgot about fusion, though you would need to implement your data
as tuples for this library:
http://spirit.sourceforge.net/dl_mor...tml/index.html


Have you actually used one of those libraries?
May 10 '06 #6
On Tue, 09 May 2006 17:56:39 GMT, I waved a wand and this message
magically appeared from Roland Pibinger:

[ Boost stuff snipped ]
Have you actually used one of those libraries?


All I got was a headache!
--
http://www.munted.org.uk

Take a nap, it saves lives.
May 10 '06 #7

Roland Pibinger wrote:
On 8 May 2006 01:39:13 -0700, an**@servocomm.freeserve.co.uk wrote:
an**@servocomm.freeserve.co.uk wrote:
Boost.MultiIndex library can do this sort of thing:
http://www.boost.org/libs/multi_index/doc/index.html
Also there is relational Template Library (RTL) in boost sandbox:
http://tinyurl.com/zwe2o

Also forgot about fusion, though you would need to implement your data
as tuples for this library:
http://spirit.sourceforge.net/dl_mor...tml/index.html


Have you actually used one of those libraries?


No.

regards
Andy Little

May 10 '06 #8
Roland Pibinger wrote:
On 8 May 2006 01:39:13 -0700, an**@servocomm.freeserve.co.uk wrote:
an**@servocomm.freeserve.co.uk wrote:
Boost.MultiIndex library can do this sort of thing:
http://www.boost.org/libs/multi_index/doc/index.html
Also there is relational Template Library (RTL) in boost sandbox:
http://tinyurl.com/zwe2o

Also forgot about fusion, though you would need to implement your
data as tuples for this library:
http://spirit.sourceforge.net/dl_mor...tml/index.html


Have you actually used one of those libraries?


Yes, those and many more.

Jeff Flinn
May 10 '06 #9
Thank you all for input, I looked at boost multi-index library and they
seem to have done a nice job. I cannot use it though due to some
restrictions on third party software. I think I can implement for my
case using maps and multimaps.....
Sunil

May 11 '06 #10
sunil wrote:
Thank you all for input, I looked at boost multi-index library and they
seem to have done a nice job. I cannot use it though due to some
restrictions on third party software.


Excuse me? Boost's license is free with no restrictions. Our lawyer just
recently approved it for our shrink-wrap and turn-key solutions.

Maybe your boss likes paying expensive programmers to sit around reinventing
wheels all day. How's your C++ compiler coming along?

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
May 12 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Yves Dhondt | last post by:
Hello, I've got the following UML design : C | A _____|______ B So 2 objects A and B are connected through a relation C. (For example an employment scheme : person A1 worked for company...
22
by: xixi | last post by:
hi, we are using db2 udb v8.1 for windows, i have changed the buffer pool size to accommadate better performance, say size 200000, if i have multiple connection to the same database from...
20
by: Sushil | last post by:
Hi gurus I was reading FAQ "alloca cannot be written portably, and is difficult to implement on machines without a conventional stack." I understand that the standard does not mandate...
8
by: Strange Cat | last post by:
Hi everyone! I'm about to start a new project and I'd like to hear from someone more experienced than me. What I'm requested to do is: Display an autorefreshing page that gets data from a...
11
by: tomgee | last post by:
I saw it many times, // T.h: class T { public: static T* instance(); private: T() {}
6
by: Ralph | last post by:
Hi, I was reading effictive C++ and some other books again and they all tell you about hiding implementation details (proxy/pimpl/inheritance) but they never really explain when to use it. I...
5
by: iaminsik | last post by:
I implemented a TRIE in memory by myself in C. But, as you know, when a size of data increases, loading time of data becomes longer. I want to implement a TRIE in file, which means division of...
3
by: C++Liliput | last post by:
Hi, I was looking at the implementation of operator new and operator new in gcc source code and found that the implementation is exactly the same. The only difference is that the size_t argument...
1
by: bizt | last post by:
Hi, I have a process where every so often I refresh a table's data using a setTimeout() .. and when its no longer needed, a clearTimeout(). The following is a simple example of how this is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.