File indexing completed on 2025-08-03 08:20:36
0001 #include "oncsSub_idcstr.h"
0002 #include <string.h>
0003
0004 oncsSub_idcstr::oncsSub_idcstr(subevtdata_ptr data)
0005 :oncsSubevent_w1 (data)
0006 {
0007 sarray = 0;
0008 allocated_length = 0;
0009 }
0010
0011
0012 oncsSub_idcstr::~oncsSub_idcstr()
0013 {
0014 if ( sarray) delete [] sarray;
0015 }
0016
0017 int oncsSub_idcstr::iValue ( const int i)
0018 {
0019 int n;
0020 if ( ! sarray ) decode ( &n);
0021
0022 if ( i < 0 || i >= allocated_length)
0023 {
0024 return 0;
0025 }
0026
0027 int c = sarray[i];
0028 return c;
0029
0030 }
0031
0032 void oncsSub_idcstr::dump ( OSTREAM &os)
0033 {
0034
0035 int n;
0036 if ( ! sarray ) decode ( &n);
0037
0038
0039 os.write( (const char *) sarray, allocated_length);
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 os << std::flush;
0051
0052 }
0053
0054
0055 int *oncsSub_idcstr::decode ( int *nwout)
0056
0057 {
0058 int dlength = ( getLength()-4)*4 - getPadding();
0059 unsigned char *SubeventData = ( unsigned char * ) &SubeventHdr->data;
0060 sarray = new unsigned char[dlength+1];
0061 memcpy ( sarray, SubeventData,dlength);
0062 sarray[dlength] = 0;
0063 allocated_length = dlength;
0064
0065 return 0;
0066 }
0067