This changes the signature of the
AssetManager.AssetReceivedCallbackdelegate, so any handlers you have
registered for the OnAssetReceived event
will need to have an extra Asset parameter.

On 7/14/07, Christopher Omega <[EMAIL PROTECTED]> wrote:

Made no-parameter constructor public, removed constructor that takes an
asset ID. AssetID can now only be set internally by the AssetManager.
_AssetData initilized to a zero-length byte[].
-Chris

On 7/14/07, Christopher Omega <[EMAIL PROTECTED]> wrote:
>
> Added internal constructor which takes no parameters.
>
> On 7/14/07, Christopher Omega < [EMAIL PROTECTED]> wrote:
> >
> > Renaming:
> > EncodeNeeded = !EncodedFresh
> > DecodeNeeded = !DecodedFresh
> > GetEncodedData = ExportAssetData
> > SetEncodedData = ImportAssetData
> >
> > Derived classes should call DecodeIfNeeded before setting the value in
> > their properties' setters.
> >
> > On 7/14/07, Christopher Omega < [EMAIL PROTECTED]> wrote:
> > >
> > > Yup, the Asset class has that kind of lazy synchronization built in.
> > > Derived assets invalidate the byte array using InvalidateAssetData() after
> > > any of their properties are modified. The Asset class provides to external
> > > classes access to the byte array using ExportAssetData and 
ImportAssetData.
> > > The DecodedFresh flag is true if the class has decoded its properties from
> > > the latest copy of AssetData, false if AssetData has changed since the 
last
> > > decoding. The EncodedFresh flag is true if the class has regenerated
> > > AssetData from its properties, false if the properties have changed since
> > > the last encoding.
> > >
> > > ImportAssetData (in this new revision) sets the EncodedFresh flag to
> > > true and DecodedFresh flag to false. So if someone calls ImportAssetData 
and
> > > then calls ExportAssetData, without modifying any properties, no decoding 
or
> > > encoding occurs.
> > >
> > > All derived class's properties should call DecodeIfNeeded() before
> > > returning a value from their getters. This allows for lazy decoding.
> > > Similarly, they should call InvalidateAssetData() in their properties'
> > > setters, which allows for lazy encoding.
> > >
> > > A derived class must implement the Decode(byte[] assetData) method,
> > > that decodes the values of their properties from the assetData parameter.
> > > Derived classes must also implement the Encode(out byte[] newAssetData) 
that
> > > regenerates the byte[] from the properties of the class. All the stuff 
that
> > > allows for lazy encoding and decoding is handled in the Asset superclass,
> > > provided that the subclass follows this spec.
> > >
> > > ***New Version*** btw :-)
> > > Implements ExportAssetData(byte[] dest, int off) that lets you pass
> > > a preconstructed byte[] to the class to copy its asset data to.
> > > ExportAssetData now calls EncodeIfNeeded()
> > > ImportAssetData now sets EncodedFresh = true.
> > >
> > >
> > > On 7/14/07, John Hurliman < [EMAIL PROTECTED]> wrote:
> > > >
> > > > Still reading through the discussion, but I wanted to comment on
> > > > the
> > > > asset wrappers. We had them before, we definitely need them, and
> > > > they
> > > > are coming back soon. The previous InventoryManager and
> > > > AssetManager
> > > > classes were intrinsically coupled together, and passed everything
> > > >
> > > > around as high level objects. Immediately problems arose as people
> > > > tried
> > > > to do "outside of the box" things like sharing UUIDs between bots,
> > > > analyzing inventory security, or work on proxy and caching code
> > > > outside
> > > > of the libsecondlife assembly.
> > > >
> > > > To handle human readable vs raw byte data and keeping it
> > > > synchronized,
> > > > you might setup something like this:
> > > >
> > > > public class NotecardAsset : IAsset
> > > >     {
> > > >         private byte[] _Data;
> > > >         private string _NotecardText;
> > > >         private bool _DataExpired;
> > > >         private bool _TextExpired;
> > > >
> > > >         public byte[] Data
> > > >         {
> > > >             get
> > > >             {
> > > >                 if (_DataExpired)
> > > >                     EncodeBytes();
> > > >
> > > >                 return _Data;
> > > >             }
> > > >
> > > >             set
> > > >             {
> > > >                 _Data = value;
> > > >                 _DataExpired = false;
> > > >             }
> > > >         }
> > > >
> > > >         public string NotecardText
> > > >         {
> > > >             get
> > > >             {
> > > >                 if (_TextExpired)
> > > >                     DecodeBytes();
> > > >
> > > >                 return _NotecardText;
> > > >             }
> > > >
> > > >             set
> > > >             {
> > > >                 _NotecardText = value;
> > > >                 _TextExpired = false;
> > > >             }
> > > >         }
> > > >
> > > >         private bool EncodeBytes()
> > > >         {
> > > >             // Fill in _Data here
> > > >
> > > >             _DataExpired = false;
> > > >         }
> > > >
> > > >         private bool DecodeBytes()
> > > >         {
> > > >             // Fill in _NotecardText here
> > > >
> > > >             _TextExpired = false;
> > > >         }
> > > >     }
> > > >
> > > >
> > > > That way the data is always externally accessed through only two
> > > > publically exposed properties and it does lazy synchronization,
> > > > but
> > > > always stays in sync when needed. If the interface IAsset enforced
> > > > get
> > > > and set methods for a byte[] called Data the AssetManager would
> > > > just say
> > > > "upload someAsset.Data" and each asset type would be responsible
> > > > for
> > > > encoding the byte array. It also lets you upload raw assets by
> > > > setting
> > > > someAsset.Data = myBytes; without doing any encoding/decoding.
> > > > Thoughts?
> > > >
> > > > John Hurliman
> > > > _______________________________________________
> > > > libsl-dev mailing list
> > > > libsl-dev@opensecondlife.org
> > > > http://opensecondlife.org/cgi-bin/mailman/listinfo/libsl-dev
> > > >
> > >
> > >
> > >
> > > --
> > > "Anyone that would give up a little liberty for a little security,
> > > deserves neither and loses both." -Ben Franklin
> > >
> >
> >
> >
> > --
> > "Anyone that would give up a little liberty for a little security,
> > deserves neither and loses both." -Ben Franklin
> >
> >
>
>
> --
> "Anyone that would give up a little liberty for a little security,
> deserves neither and loses both." -Ben Franklin
>
>


--
"Anyone that would give up a little liberty for a little security,
deserves neither and loses both." -Ben Franklin




--
"Anyone that would give up a little liberty for a little security, deserves
neither and loses both." -Ben Franklin

Attachment: AssetTypes support.patch
Description: Binary data

_______________________________________________
libsl-dev mailing list
libsl-dev@opensecondlife.org
http://opensecondlife.org/cgi-bin/mailman/listinfo/libsl-dev

Reply via email to