Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

LCD_detector_ID.cc

Go to the documentation of this file.
00001 // CVS $Id: LCD_detector_ID.cc,v 1.8 2003/11/29 20:02:42 uid561 Exp $
00002 
00003 // => Organizes the output of the detector ID header block.
00004 //
00005 // General Description:
00006 //
00007 // Organize the output of the detector ID header block.
00008 //
00009 
00010 #include "SIO_definitions.h"
00011 #include "SIO_functions.h"
00012 
00013 #include "LCD_detector_ID.hh"
00014 
00015 // Constructor.
00016 
00017 /*
00018  * Comment
00019  */
00020 LCD_detector_ID::LCD_detector_ID( const char* i_name ) : SIO_block( i_name )
00021 {
00022 
00023   type  = "<unknown>";
00024   major = -1;
00025   minor = -1;
00026 
00027 }
00028 
00029 // Destructor.
00030 
00031 /*
00032  * Comment
00033  */
00034 LCD_detector_ID::~LCD_detector_ID() {}
00035 
00036 // Get major number.
00037 
00038 /*
00039  * Comment
00040  */
00041 int LCD_detector_ID::getMajor() { return major; }
00042 
00043 // Get minor number.
00044 /*
00045  * Comment
00046  */
00047 int LCD_detector_ID::getMinor() { return minor; }
00048 
00049 // Get type.
00050 /*
00051  * Comment
00052  */
00053 const char* LCD_detector_ID::getType() { return type.c_str(); }
00054 
00055 // Set major number.
00056 
00057 /*
00058  * Comment
00059  */
00060 void LCD_detector_ID::setMajor( int i_major ) { major = i_major; return; }
00061 
00062 // Set minor number.
00063 
00064 /*
00065  * Comment
00066  */
00067 void LCD_detector_ID::setMinor( int i_minor ) { minor = i_minor; return; }
00068 
00069 // Set type.
00070 /*
00071  * Comment
00072  */
00073 void LCD_detector_ID::setType
00074 (
00075  char*    i_type
00076  )
00077 {
00078 
00079   //
00080   // Check for presence of input string.
00081   //
00082   if( i_type == NULL )
00083     return;
00084 
00085   //
00086   // Save it!
00087   //
00088   type = i_type;
00089 
00090   //
00091   // That's all folks!
00092   //
00093   return;
00094 }
00095 
00096 // Transfer.
00097 /*
00098  * Comment
00099  */
00100 unsigned int LCD_detector_ID::xfer
00101 (
00102  SIO_stream*     stream,
00103  SIO_operation   op,
00104  unsigned int    version
00105  )
00106 {
00107   if(version) ; // make compiler happy
00108   int
00109     nchr;
00110 
00111   char
00112     *temp;
00113 
00114   unsigned int
00115     status;
00116 
00117   //
00118   // Determine the length of the type name.
00119   //
00120   if( op == SIO_OP_WRITE )
00121     nchr = type.size();
00122 
00123   SIO_DATA( stream, &nchr, 1 );
00124 
00125   //
00126   // Transfer the type name.
00127   //
00128   if(      op == SIO_OP_WRITE )
00129     {
00130       SIO_DATA( stream, const_cast<char*>(type.c_str()), nchr );
00131     }
00132 
00133   else if( op == SIO_OP_READ  )
00134     {
00135       temp = static_cast<char*>(malloc( nchr + 1 ));
00136       SIO_DATA( stream, temp, nchr );
00137       temp[nchr] = '\0';
00138       type = temp;
00139       free( temp );
00140     }
00141 
00142   //
00143   // The rest is easy.
00144   //
00145   SIO_DATA( stream, &major, 1 );
00146   SIO_DATA( stream, &minor, 1 );
00147 
00148   //
00149   // That's all folks!
00150   //
00151   return( SIO_BLOCK_SUCCESS );
00152 }
00153 
00154 // Return version number (encoded).
00155 
00156 #define LCD_DETECTOR_ID_MAJOR 1
00157 #define LCD_DETECTOR_ID_MINOR 0
00158 
00159 /*
00160  * Comment
00161  */
00162 unsigned int LCD_detector_ID::version()
00163 { return( SIO_VERSION_ENCODE( LCD_DETECTOR_ID_MAJOR,
00164                               LCD_DETECTOR_ID_MINOR ) ); }

Generated on Thu Oct 7 18:44:46 2004 for LCDG4 by doxygen 1.3.4