Ignore:
Timestamp:
Jun 10, 2008 7:53:44 AM (16 years ago)
Author:
dkearney
Message:

adding the simple buffer object back to the repository because it was accidentally removed in rev 1018

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpBuffer.h

    r1030 r1038  
    55 *  AUTHOR:  Derrick Kearney, Purdue University
    66 *
    7  *  Copyright (c) 2004-2007  Purdue Research Foundation
     7 *  Copyright (c) 2004-2008  Purdue Research Foundation
    88 * ----------------------------------------------------------------------
    99 *  See the file "license.terms" for information on usage and
    1010 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    11  * ======================================================================
    12  *
    13  *  This code is based on the Tcl_DString facility included in the
    14  *  Tcl source release, which includes the following copyright:
    15  *
    16  *  Copyright (c) 1987-1993 The Regents of the University of California.
    17  *  Copyright (c) 1994-1998 Sun Microsystems, Inc.
    18  *  Copyright (c) 2001 by Kevin B. Kenny.  All rights reserved.
    19  *
    20  *  This software is copyrighted by the Regents of the University of
    21  *  California, Sun Microsystems, Inc., Scriptics Corporation,
    22  *  and other parties.  The following terms apply to all files associated
    23  *  with the software unless explicitly disclaimed in individual files.
    24  *
    25  *  The authors hereby grant permission to use, copy, modify, distribute,
    26  *  and license this software and its documentation for any purpose, provided
    27  *  that existing copyright notices are retained in all copies and that this
    28  *  notice is included verbatim in any distributions. No written agreement,
    29  *  license, or royalty fee is required for any of the authorized uses.
    30  *  Modifications to this software may be copyrighted by their authors
    31  *  and need not follow the licensing terms described here, provided that
    32  *  the new terms are clearly indicated on the first page of each file where
    33  *  they apply.
    34  *
    35  *  IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
    36  *  FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
    37  *  ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
    38  *  DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
    39  *  POSSIBILITY OF SUCH DAMAGE.
    40  *
    41  *  THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
    42  *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
    43  *  FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
    44  *  IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
    45  *  NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
    46  *  MODIFICATIONS.
    47  *
    48  *  GOVERNMENT USE: If you are acquiring this software on behalf of the
    49  *  U.S. government, the Government shall have only "Restricted Rights"
    50  *  in the software and related documentation as defined in the Federal·
    51  *  Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
    52  *  are acquiring the software on behalf of the Department of Defense, the
    53  *  software shall be classified as "Commercial Computer Software" and the
    54  *  Government shall have only "Restricted Rights" as defined in Clause
    55  *  252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
    56  *  authors grant the U.S. Government and others acting in its behalf
    57  *  permission to use and distribute the software in accordance with the
    58  *  terms specified in this license.·
    59  *
    6011 * ======================================================================
    6112 */
     
    6415#define RAPPTURE_BUFFER_H
    6516
    66 #define RP_BUFFER_MIN_SIZE    200
    67 
    6817#include <RpOutcome.h>
     18#include <RpSimpleBuffer.h>
    6919
    7020#ifdef __cplusplus
     
    7929namespace Rappture {
    8030
    81 class SimpleBuffer {
    82 public:
    83     SimpleBuffer();
    84     SimpleBuffer(const char* bytes, int nbytes=-1);
    85     SimpleBuffer(const SimpleBuffer& b);
    86     SimpleBuffer& operator=(const SimpleBuffer& b);
    87     SimpleBuffer  operator+(const SimpleBuffer& b) const;
    88     SimpleBuffer& operator+=(const SimpleBuffer& b);
    89     virtual ~SimpleBuffer();
    90 
    91     const char* bytes() const;
    92     unsigned int size() const;
    93 
    94     SimpleBuffer& clear();
    95     int append(const char* bytes, int nbytes=-1);
    96     int read(const char* bytes, int nbytes);
    97     int seek(int offset, int whence);
    98     int tell();
    99     SimpleBuffer& rewind();
    100 
    101     bool good() const;
    102     bool bad() const;
    103     bool eof() const;
    104 
    105     SimpleBuffer& move(SimpleBuffer& b);
    106 
    107 protected:
    108 
    109     void bufferInit();
    110     void bufferFree();
    111 
    112 private:
    113 
    114     /// Pointer to the memory that holds our buffer's data
    115     char* _buf;
    116 
    117     /// Position offset within the buffer's memory
    118     unsigned int _pos;
    119 
    120     /// Size of the used memory in the buffer
    121     unsigned int _size;
    122 
    123     /// Total space available in the buffer
    124     unsigned int _spaceAvl;
    125 
    126     /// State of the last file like operation.
    127     bool _fileState;
    128 };
    12931
    13032/**
     
    13840public:
    13941    Buffer();
     42    Buffer(int nbytes);
    14043    Buffer(const char* bytes, int nbytes=-1);
    14144    Buffer(const Buffer& buffer);
Note: See TracChangeset for help on using the changeset viewer.