src/GamIO/ML5Tag.cc
/* These are the functions which will output a tag in MATLAB ".mat" binary
   format, version 5.  Note that in a valid MATLAB MAT file, this tag will
   be associated with a "Data Element" or a "Sub-Element".
 
                Input           ML5H    : MAT version 5 tag (this)
                                fp      : Output file stream
                Output          void    : Output file stream is modified
                                          by having the ML5H written to it
                Note                    : No care is taken to insure the
                                          tag is written tothe top of the
                                          file (as it should be in MATLAB)   */
These are the functions which will output a tag in MATLAB ".mat" binary
format, version 5.  Note that in a valid MATLAB MAT file, this tag will
be associated with a "Data Element" or a "Sub-Element".

Input           ML5H    : MAT version 5 tag (this)
fp      : Output file stream
Output          void    : Output file stream is modified
by having the ML5H written to it
Note                    : No care is taken to insure the
tag is written tothe top of the
file (as it should be in MATLAB)
These are the functions which will output a tag in MATLAB " . mat " binary format version 5 . Note that in a valid MATLAB MAT file this tag will be associated with a " Data Element " or a " Sub - Element " . Input ML5H : MAT version 5 tag ( this ) fp : Output file stream Output void : Output file stream is modified by having the ML5H written to it Note : No care is taken to insure the tag is written tothe top of the file ( as it should be in MATLAB )
int MatLab5Tag::write(std::fstream& fp) const                                       
  {
  if(!Compressed)				
    {						
    int32_t LI = DType;				
    fp.write((char*)&LI, sizeof(int32_t));		
    LI = NBytes;				
    fp.write((char*)&LI, sizeof(int32_t));
    }
  else						
    {						
    short NB = NBytes; 				
    short DT = DType; 				
    if(WeRBigEnd()) 				
      {
      fp.write((char*)&NB, sizeof(short));		
      fp.write((char*)&DT, sizeof(short));		
      }
    else					
      {						
      fp.write((char*)&DT, sizeof(short));
      fp.write((char*)&NB, sizeof(short));
      }
    }
  return 1;
  }
int MatLab5Tag :: write ( std :: fstream & fp ) const { if ( ! Compressed ) { int32_t LI = DType ; fp . write ( ( char * ) & LI , sizeof ( int32_t ) ) ; LI = NBytes ; fp . write ( ( char * ) & LI , sizeof ( int32_t ) ) ; } else { short NB = NBytes ; short DT = DType ; if ( WeRBigEnd ( ) ) { fp . write ( ( char * ) & NB , sizeof ( short ) ) ; fp . write ( ( char * ) & DT , sizeof ( short ) ) ; } else { fp . write ( ( char * ) & DT , sizeof ( short ) ) ; fp . write ( ( char * ) & NB , sizeof ( short ) ) ; } } return 1 ; }
These are the functions which will output a tag in MATLAB ".mat" binary
format, version 5.
These are the functions which will output a tag in MATLAB " . mat " binary format version 5 .
// Output format is simple if // the tag isn't compressed. // Two int32_t integers (8 bytes), // data type followed by the // size of data in bytes // If the tag is compressed // we just write two short // data followed by the data // 4 bytes which MUST BE // WRITTEN by whoever called us // If we write big endian then // output shorts NB DT // If we write small endian // then output shorts DT NB