Hi,
On Tue, 2006-04-04 at 11:54 +0200, Antonio B. wrote:
> Hi,
>
> I wants to change an element in a MField by string.
> There is getValueByStr (std::string &str, UInt32 index), instead
> I need of something as pushValueByStr (std::string &str, UInt32 index).
>
> Really I have:
>
> UInt32 pos = 4;
> std::string str = ".......";
> MFFieldContainerPtr mfptr = (MFFieldContainerPtr *) field;
>
> How can I change the value of 4° element of mfptr with str value???
> The simplest solution is ...
Question what is inside the string an id to retrieve an existing
field container or the complete container description ?
If it is the complete description technically you would have to pass the
string to the corresponding loader. We don't have a different way to
recreate containers from strings right now. You can try to create an
OSGLoader, wrap your string into a string stream, pass it to scanStream
and get the result. A small warning as the loader is implemented right
now your string has to start with the correct header #OSG V1.0 and
adhere to the osg ascii syntax. And I never actually tried this.
If it is an id it depends on what the id looks like. If it is the
field container id convert it to int (e.g
val = TypeTraits<UInt32>::getFromString("...")), retrieve the container
from the FieldContainerFactory and put it into the mfield (e.g
(*mfpr)[val] = ptr). But be careful not to confuse the refcounting
and the parent linking (if it applies).
regards,
gerrit
--
It's Emergent[*], you see.
[*] [adj] A word favored by computer nerds; mandatory for DARPA research
applications; on recent evidence, a synonym for 'doomed'.
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users