//****************************************************************************************************** // ISupportBinaryImage.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 12/04/2008 - J. Ritchie Carroll // Generated original version of source code. // 09/14/2009 - Stephen C. Wills // Added new header and license agreement. // 11/22/2011 - J. Ritchie Carroll // Converted interface to use a write based image method instead of a property as an optimization. // 12/14/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** namespace GSF.Parsing { /// /// Specifies that an object can support production or consumption of a binary image that represents the object. /// public interface ISupportBinaryImage { /// /// Gets the length of the binary image. /// int BinaryLength { get; } /// /// Initializes object by parsing the specified containing a binary image. /// /// Buffer containing binary image to parse. /// 0-based starting index in the to start parsing. /// Valid number of bytes within to read from . /// The number of bytes used for initialization in the (i.e., the number of bytes parsed). /// /// Implementers should validate and against length. /// The method can be used to perform this validation. /// int ParseBinaryImage(byte[] buffer, int startIndex, int length); /// /// Generates binary image of the object and copies it into the given buffer, for bytes. /// /// Buffer used to hold generated binary image of the source object. /// 0-based starting index in the to start writing. /// The number of bytes written to the . /// /// Implementers should validate and against length. /// The method can be used to perform this validation. /// int GenerateBinaryImage(byte[] buffer, int startIndex); } }