MOOSE - Multiscale Object Oriented Simulation Environment
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
PrepackedBuffer.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
16 {
17  public:
26  PrepackedBuffer( const char* data, unsigned int dataSize,
27  unsigned int numEntries = 0 );
28 
29  PrepackedBuffer( const PrepackedBuffer& other );
30 
36  PrepackedBuffer( const char* buf );
37 
39 
41 
42  const char* data() const {
43  return data_;
44  }
45 
51  const char* operator[]( unsigned int index ) const;
52 
56  unsigned int dataSize() const {
57  return dataSize_;
58  }
59 
63  unsigned int size() const {
64  return dataSize_ + 2 * sizeof( unsigned int );
65  }
66 
70  unsigned int conv2buf( char* buf ) const;
71 
75  unsigned int numEntries() const {
76  return numEntries_;
77  }
78 
82  bool isVector() const {
83  return numEntries_ > 0;
84  }
85  private:
86  unsigned int dataSize_; // Size of data.
87  unsigned int numEntries_; // Number of data entries, if array.
88  unsigned int individualDataSize_; // size of each entry.
89  char* data_; // Converted data.
90 };
unsigned int numEntries_
unsigned int size() const
const char * data() const
const char * operator[](unsigned int index) const
unsigned int numEntries() const
bool isVector() const
unsigned int dataSize_
unsigned int individualDataSize_
unsigned int conv2buf(char *buf) const
unsigned int dataSize() const