Author Topic: qbstdoutstream question  (Read 5810 times)

methodhai

  • Sr. Member
  • ****
  • Posts: 28
qbstdoutstream question
« on: November 06, 2007, 03:11:07 AM »
I should have combined this with the previous post - but I forgot...in the function:

QB_INT qbstdoutstream(QB_INT jobid, QB_INT subid, QB_INT pos, QbString& data);

What is the purpose of the 'pos' parameter - and what criteria should I use to determine what to pass to it?

Thanks,
Hai

anthony

  • Senior Software Engineer
  • Hero Member
  • *****
  • Posts: 183
Re: qbstdoutstream question
« Reply #1 on: November 09, 2007, 10:23:50 PM »
Hey Hai,

    The qbstdoutstream is actually a routine used to pull data off of the local disk.  The qbstdout routine is probably better for most purposes.  I suspect you picked the qbstdoutstream routine because it looks simpler to use.  In replacement to that, you can do the following:

QbCommand cmd;
cmd.jobids().push(new QbJobId(jobid, subid));

QbLogList logs;
qbstdout(cmd, logs)

for (QB_INT i = 0; i < logs.length(); i++) {
     QbLog* log = logs.get(i);
     if (log == NULL)
           continue;
     cout << log->data() << endl;
}


methodhai

  • Sr. Member
  • ****
  • Posts: 28
Re: qbstdoutstream question
« Reply #2 on: November 10, 2007, 03:12:56 AM »
Thanks for the reply Anthony.

Just one more question...the parameter for QbLogList::get is the subjob id right?

anthony

  • Senior Software Engineer
  • Hero Member
  • *****
  • Posts: 183
Re: qbstdoutstream question
« Reply #3 on: November 10, 2007, 04:26:36 AM »
Actually no, the QbLogList::get(QB_INT i) parameter is based on an interator, starting at 0 and ending at QbLogList::length() - 1

As a matter of common naming withint Qube! you'll find that all objects ending with "List" are based on a list object, and all objects ending with Hash are hash objects.  The "get" and "length" routines are common to both.

methodhai

  • Sr. Member
  • ****
  • Posts: 28
Re: qbstdoutstream question
« Reply #4 on: November 12, 2007, 05:26:50 PM »
But one thing that still isn't clear to me is:  what's exactly is stored in the list? Is it different line groups of the log? Or does it correspond to a frame within the sub job? Or is it just an arbitrary collection of data that comprises the log?

I assume there is some kind of correspondence to a parameter or property of some type since you're looping through it.

anthony

  • Senior Software Engineer
  • Hero Member
  • *****
  • Posts: 183
Re: qbstdoutstream question
« Reply #5 on: November 12, 2007, 07:05:18 PM »
Ah I see.  Each QbLog object normally corresponds to individual subjob log data.  You can get which subjob the log belongs to by looking at the subid() method.  There is no requirement for the supervisor to return them in order.  So checking that method is recommended rather than relying on get(i) to determine the order.


methodhai

  • Sr. Member
  • ****
  • Posts: 28
Re: qbstdoutstream question
« Reply #6 on: November 12, 2007, 08:50:05 PM »
Thanks anthony!

It's all starting to make sense now...I think.

methodhai

  • Sr. Member
  • ****
  • Posts: 28
Re: qbstdoutstream question
« Reply #7 on: November 13, 2007, 02:06:44 AM »
Another question...hopefully one of the last...

Is there a way to get at the logs via jobid/agenda name - as opposed to jobid/subjobid?

Could I potential do something like this:

QbCommand cmd;
cmd.jobids().push(new QbJobId(jobid) );
cmd.workids().push( new QbWorkId(workid) );

?
« Last Edit: November 13, 2007, 02:15:12 AM by methodhai »

anthony

  • Senior Software Engineer
  • Hero Member
  • *****
  • Posts: 183
Re: qbstdoutstream question
« Reply #8 on: November 13, 2007, 03:37:56 AM »
Actually, you are allowed to do this:

cmd.workids().push(new QbWorkId(jobid, workname));

and the routine will return back the agenda item's log data.

the QbLog objects will be initialized with that data and the  workname method also
initialized with the data you asked for.