473,320 Members | 2,003 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,320 software developers and data experts.

Taking values from Queue

Hello

I am working on a design in which there is a Queue which will read
data from a database. This happens in one particular class.

Class CRecieveData
{
std::queue<unsigned charm_RxQueue;
}

Here the data is added into Queue using "push" function.

Now as per the design i have to extract the data from Queue in another
Class using Deque.

class CDecodeData
{
// Need to add code here to extract data from Queue declared
in another class, using Deque Iterator
}

ie, by using an Iterator of Deque.

Can anyone tell me how to do this?

Thanks.

Oct 18 '07 #1
6 1523
Donos wrote:
I am working on a design in which there is a Queue which will read
data from a database. This happens in one particular class.

Class CRecieveData
{
std::queue<unsigned charm_RxQueue;
}

Here the data is added into Queue using "push" function.

Now as per the design i have to extract the data from Queue in another
Class using Deque.

class CDecodeData
{
// Need to add code here to extract data from Queue declared
in another class, using Deque Iterator
}

ie, by using an Iterator of Deque.

Can anyone tell me how to do this?
Nobody can tell you. There is no way to extract an object from
a std::queue using an object of an unrelated type (iterator to some
std::deque). Even though 'std::queue' can be implemented using
'std::deque' as its underlying container, there is no standard way
to go from an iterator to a 'deque' to the 'queue' the 'deque' is
used to implement. Make sure the reference to the actual 'queue'
is passed to your scope.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 18 '07 #2
Ok. Like i said, the Queue is declared as,

std::queue<unsigned charm_RxQueue;

and the data is pushed into Queue using,

m_RxQueue.push(*pBuf++);

Where pBuf is a unsigned char*

---------------------------------------------

And my question is, Now how can i extract the data back?

If not a Deque::Iterator, what other approach i can use to extract
data from Queue?

Oct 18 '07 #3
On 2007-10-18 20:19, Donos wrote:
Ok. Like i said, the Queue is declared as,

std::queue<unsigned charm_RxQueue;

and the data is pushed into Queue using,

m_RxQueue.push(*pBuf++);

Where pBuf is a unsigned char*

---------------------------------------------

And my question is, Now how can i extract the data back?

If not a Deque::Iterator, what other approach i can use to extract
data from Queue?
front() and pop(), if they are not enough then a queue is not what you want.

--
Erik Wikström
Oct 18 '07 #4
Erik Wikström wrote:
On 2007-10-18 20:19, Donos wrote:
>Ok. Like i said, the Queue is declared as,

std::queue<unsigned charm_RxQueue;

and the data is pushed into Queue using,

m_RxQueue.push(*pBuf++);

Where pBuf is a unsigned char*

---------------------------------------------

And my question is, Now how can i extract the data back?

If not a Deque::Iterator, what other approach i can use to extract
data from Queue?

front() and pop(), if they are not enough then a queue is not what
you want.
I am really trying hard not to use "RTFM" in my replies, yet they
do sometimes trickle through. How do you manage?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 18 '07 #5
On 2007-10-18 21:06, Victor Bazarov wrote:
Erik Wikstr�m wrote:
>On 2007-10-18 20:19, Donos wrote:
>>Ok. Like i said, the Queue is declared as,

std::queue<unsigned charm_RxQueue;

and the data is pushed into Queue using,

m_RxQueue.push(*pBuf++);

Where pBuf is a unsigned char*

---------------------------------------------

And my question is, Now how can i extract the data back?

If not a Deque::Iterator, what other approach i can use to extract
data from Queue?

front() and pop(), if they are not enough then a queue is not what
you want.

I am really trying hard not to use "RTFM" in my replies, yet they
do sometimes trickle through. How do you manage?
I got a lot of spare time at the moment, so I can afford to be patient.

--
Erik Wikström
Oct 18 '07 #6
Erik Wikström wrote:
On 2007-10-18 21:06, Victor Bazarov wrote:
>Erik Wikstr�m wrote:
>>On 2007-10-18 20:19, Donos wrote:
Ok. Like i said, the Queue is declared as,

std::queue<unsigned charm_RxQueue;

and the data is pushed into Queue using,

m_RxQueue.push(*pBuf++);

Where pBuf is a unsigned char*

---------------------------------------------

And my question is, Now how can i extract the data back?

If not a Deque::Iterator, what other approach i can use to extract
data from Queue?
front() and pop(), if they are not enough then a queue is not what
you want.
I am really trying hard not to use "RTFM" in my replies, yet they
do sometimes trickle through. How do you manage?

I got a lot of spare time at the moment, so I can afford to be patient.
You've got a lot more patience than me, alas.
Oct 18 '07 #7

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

Similar topics

9
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place,...
1
by: Jim Geissman | last post by:
Help, please. I am trying to update a table with this structre: CREATE TABLE Queue (PropID int, EffDate smalldatetime, TxnAmt int) INSERT Queue (PropID) SELECT 1 INSERT Queue (PropID)...
9
by: Brian Henry | last post by:
If i inherite a queue class into my class, and do an override of the enqueue member, how would i then go about actually doing an enqueue of an item? I am a little confused on this one... does over...
3
by: Kceiw | last post by:
Dear all, When I use #include "queue.h", I can't link it. The error message follows: Linking... G:\Projects\Datastructure\Queue\Debug\main.o(.text+0x136): In function `main':...
4
by: metaperl | last post by:
Hi, I wrote a Forms program which toggles a label each time you click it: private void button1_Click(object sender, EventArgs e) { label1.Text = (label1.Text == "hello") ? "goodbye" : "hello" ;...
2
by: Timothy Smith | last post by:
say i'm issuing t = Thread(target=lambda: WeeklyReportPDF.MakeReport(self.UserNameValue, self.PassWordValue,ReportType,self.db)) t.start() which works just fine, BUT how do i get access to...
3
by: jrpfinch | last post by:
I have a script which is based on the following code. Unfortunately, it only works on Python 2.3 and not 2.5 because there is no esema or fsema attribute in the 2.5 Queue. I am hunting through...
4
by: j_depp_99 | last post by:
Thanks to those guys who helped me out yesterday. I have one more problem; my print function for the queue program doesnt work and goes into an endless loop. Also I am unable to calculate the...
2
by: Kumarswamy | last post by:
Hi, I have a problem, i have used one condition in where clause ..... but it is taking some time to return values....... so my procedure is taking lot of time....... for the same table if i query...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.