Hi,
Thanks a lot for the suggestions.

I have this plan that I am trying to work out. I am planning to use
OBSetData() and use SetAttribute() to set a string (converted from a float
number that I want to associate the molecule with).

Here is the code:

//Float to String conversion
  ostringstream buffer;
    double temp=0.987;
    buffer << temp;
    string strTemp = buffer.str();
//End

//Storing data using OBSetData()
    OBSetData *sim = new OBSetData();
    sim->SetAttribute(strTemp.c_str());
    mol.SetData(sim);
//End

So now the 'mol' should have the attribute data?

I am not sure how I can access such attribute data. I tried to use
mol.getData() but it seems not working.

Thanks!
Rob

On Mon, Jun 7, 2010 at 2:48 PM, Geoffrey Hutchison <[email protected]
> wrote:

> > You need create an OBPairData (a subclass of OBGenericData), and apply
> > it to the molecule using OBMol.SetData. I usually grep the OpenBabel
> > source for examples of things.
>
> There are also working examples in the API documentation, e.g. (see the
> Detailed Description):
>
> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBGenericData.shtml
>
> Cheers,
> -Geoff
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to