Re: [ C++API ] ostream ?

Date : Thu, 29 Sep 2005 11:58:49 +0200
To : XSI(at)Softimage.COM
From : Daniel Collin <emoon(at)home.se>
Subject : Re: [ C++API ] ostream ?
One (not very nice) way that springs to mind directly is to imlement a "logout" operator (similar to what you do with the other classes)
so like:


std::cout << xsiout << ...

and

ostream& XsiOut::operator<<(...)
{
 // output to log here.
}

Thats the quick and dirty way but doesnt look very nice.

Daniel


How do I get "xsiout" is the question that pops up. Having classes with stream operators is exactly what I'm after as I have to do a lot of formatted output. Pivoting matrix values at the fraction seperator for example.



Daniel Collin wrote:

What I did is to implement my own iostream alike class that handles similar things to iostream.
Its really simple to implement and that way I can redirect all my logging to for example the XSI logwindow.


Im not very familiar with how iostream works but maybe you can implement somthing like

std::xsiout << "using standard iostream here" << std::endl;

You should check out what kind of class cout/cerr is and it might be possible to inharit that class
and write the output to the logconsole instead.


Hope this helps.

Daniel


OK, I see. I guess I stick with good ol' LogMessage and XSI's CString then.



Luc-Eric Rousseau wrote:

we're re-directing stdin/out/err in XSI,
however this will work for plug-ins only
if you use the multi-treaded DLL version of the VC++ dotNet 2003 run-time library, in Release mode. In other words the same version that XSI is using.
This is because the C Run-time library
is not using the operating system's handle
but rather each do their own private setup.
It also can't work from a shader because
the std handlers are local to each thread.


------------------
Luc-Eric Rousseau
Team Leader, User Interface
Softimage|XSI




-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of Felix Gebhardt
Posted At: Wednesday, September 28, 2005 9:36 AM
Posted To: xsi
Conversation: [ C++API ] ostream ?
Subject: Re: [ C++API ] ostream ?




From a plugin or an operator it doesn't work here. I even tried all wide specialisations.

F.

Halfdan Ingvarsson wrote:



I believe we also capture everything written to stdout



and/or stderr. For example, this *should* work:


cout << "monkey\n";

mental ray has a special capture system that pipes directly



into the history log after some massaging.


I don't know if this has changed recently. YMMV.

- 1/2

________________________________

From: owner-xsi(at)Softimage.COM on behalf of Felix Gebhardt
Sent: Wed 28-Sep-05 09:03
To: XSI(at)Softimage.COM
Subject: Re: [ C++API ] ostream ?




Hi Aloys,

Yes, I have such utility inlines. It's actually even called



Log() :) I


was just a bit tired of carrying it around for a second and



was hoping


I'm missing something obvious as I had that Python print()



in the back


of my head. I guess Jacko is right and someone put that up specially for Python and Mental Ray but not for the C++ API,

Thanks anyway,
F.


Aloys Baillet wrote:





Hi,

Actually you can shorten things a little bit:

Application app;
app.LogMessage(L"huhu");

will work.

And you can also make a macro for that:

#define log(x) Application().LogMessage(x) #define errx) Application().LogMessage(x, siErrorMsg)

log(L"huhu")
err(L"Bad!")


Hope this helps!

Aloys

On 28/09/05, Felix Gebhardt <gebhardt(at)betacarotin.de> wrote:




Hi,

Is there a way to directly write to the History Window's stream? I mean something more direct than Application().LogMessage(CString(L"huhu"));

Maybe my memory is playing tricks on me but I think





---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi




--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.