473,387 Members | 1,722 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,387 software developers and data experts.

Help with RogueWave RWHashDictionary

I have an RWHashDictionary that I am inserting keys and values into. I
really need duplicate keys, but I know that I can't have them. This is
what I am going to do instead:

RWCollectableString* key1;
RWCollectableString* val1;

key1 = new RWCollectableString(wholemeas); //wholemeas is an RWCString
that contains values like ABC:DEF and RGG:DEF and TRE:DEF)

The first problem I am encountering is where the user wants to put
ABC:DEF in as a key with the value of CT0 and ABC:DEF in as a key with
a value of PN0. I know I can't do that in a hash dictionary so I am
going to add a :# (# will come from a loop and be distinct) to the end
of each key before adding it to the dictionary.

The second problem I am encountering is getting these key/value pairs
back out. I only know the ABD:DEF part and not the :1, :2, etc. part
of the key. I don't even know if there are any :1, :2, etc. keys in
the dictionary.

Is there a way to do a substring on the key to get all the key/values
back out of the dictionary without exactly knowing the keys? I can't
find a way to do it and maybe I need to change this to something that
can take duplicates. But then I have another problem, when trying to
get them out one at a time. If I am searching on the key, how will it
know which value to get?

If you understand what I am trying to do, thanks. And thanks for any
help.

Allyson
Apr 8 '08 #1
1 2349
On Apr 8, 10:05*am, eskg...@gmail.com wrote:
I have an RWHashDictionary that I am inserting keys and values into. I
really need duplicate keys, but I know that I can't have them. This is
what I am going to do instead:
[snip]

Ok, first off, possibly there are better places to talk
about a specific library. Here we do standard C++. It may
be that there are news groups, or even specialized forums,
where folks know a lot more about a specific custom lib.

Anyway: What you are doing sounds a lot like a one-to-many
type relationship. As you say you "can't have them."

If you are only going to have one or two out of many 1000's
of entries, maybe what you really need to do is rethink how
you are approaching the probelm. That is, maybe you let a
bad requirement sneak into your specification, and a little
bit of careful refactoring would get rid of this for you.

If you are going to have many of these cases, maybe what
you need is to have a collection as the item the key
points at rather than a single item. That is, instead
of a single item pointed at by each key, put in another
layer of abstraction, and have each key point at a
collection of items. That's why I talked about there
only being a small number of these. The extra overhead
of the new layer will be a lot of extra pain if you
only have one or two. But if it's common, it may be
worthwhile.

I've no idea what an RWCollectableString is. (does it
come in the bottom of a box of cereal?) But if you
were doing something like an std::map then you could
have the key be a string and the value be a std::vector
or some such.
Socks
Apr 8 '08 #2

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

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
1
by: nimrod | last post by:
When running inserter and selector on the same connection (using binding expressions) on the second iteration the insertion/selection fails, receiving failure message: CT-Lib problem: sever=1...
5
by: Simon Pryor | last post by:
I am having some strange problems using std::ostringstream. The simple stuff works okay, but trying to use: std::ostringstream::str(const std::string&) or:...
4
by: Mark P | last post by:
In my code I use something like: typedef std::list<Edge*,g_mm_Alloc<Edge*> > EdgeList; and then instantiate some EdgeList objects. Here Edge is a previously defined class and g_mm_Alloc<T> is...
2
by: Alfonso Morra | last post by:
Hi, I am writing a timer class that I want to be able to get to notify me (via a callback func), when a specified interval has elapsed. I have most of the timer functionality figured - however,...
8
by: akira2x3x | last post by:
Hello, I get this error while compiling with visualc++ and STL roguewave. With STL microsoft everything work fine. XXXData.cpp f:\xxxxx\product\rw\rcb1.2.0\rm\include\rw\_pair.h(63) : error...
0
by: Naresh | last post by:
Hi Experts, I am migrating from RogueWave to STL. I am facing some problem over RWCollectable class. Some Background: Since RWCollectable is a base class implementing polymorpic...
5
by: prakash.mirji | last post by:
I am using evaluation copy of RW 9.0 for porting one of C++ application on RHEL4 (x86 platform). We are getting some issues into RW template classes. Please need assistance on this issue. Here...
0
by: tejaswini.ks | last post by:
Hi All, I am using RogueWave libraries for an application. However, the following snippet of code fails during DST. struct tm* osTime; time(&temp); osTime = localtime(&temp);
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.