Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

RodPrimitive.cxx

00001 // File: RodPrimitive.cxx
00002 // $Header: /afs/cern.ch/user/s/sctpixel/private/cvsroot/RodDaq/RodCrate/RodPrimitive.cxx,v 1.2.6.1 2005/10/08 16:36:02 sctroddq Exp $
00003 
00004 // Description:
00005 // This class contains the primitives which are sent as a list to the RODs. They control 
00006 // almost all aspects of the ROD DSP behavior. New primitives can be defined to perform
00007 // user-defined actions, but corresponding DSP code must also be written, compiled and
00008 // loaded into the DSPs before the primitive can be executed.
00009 //
00010 // @author Tom Meyer (meyer@iastate.edu) - originator
00011 
00013 
00014 #include "RodPrimitive.h"
00015 
00016 namespace SctPixelRod {
00017 
00018 // Constructors
00019     /*
00020     The default constructor, provided explicitly.
00021     */
00022     RodPrimitive::RodPrimitive()
00023     {
00024       m_length = 0;
00025       m_index = 0;
00026       m_id = 0;
00027           m_version = 100;
00028       m_body = 0;
00029     }
00030 
00031     /*
00032     An alternate constructor, which initializes the data members from arguments.
00033     */
00034     RodPrimitive::RodPrimitive( long length, long index, long id, long
00035                                     version, long* body)
00036     {
00037       m_length = length;
00038       m_index = index;
00039       m_id = id;
00040           m_version = version;
00041       m_body = body;
00042     }
00043 
00044     /*
00045     The copy constructor, which uses a deep copy since one data member is referenced
00046     by a pointer.
00047     */
00048     RodPrimitive::RodPrimitive( const RodPrimitive& rhs)
00049     {
00050       if (this == &rhs) return;
00051       m_length = rhs.getLength();
00052       m_index = rhs.getIndex();
00053       m_id = rhs.getId();
00054           m_version = rhs.getVersion();
00055       m_body = rhs.getBody();
00056       return;
00057     }
00058 
00059 // Destructor
00060     /*
00061     The destructor. We MUST be sure to delete the space allocated on the heap for m_body.
00062     For safety, we also set the pointer to zero to avoid pointers into la-la land.
00063     */
00064     RodPrimitive::~RodPrimitive() 
00065     {
00066       m_body = 0;
00067     }
00068 
00069 // Overload = operator
00070     /*
00071     Overload the assignment operator to allow us to equate objects of this class. Note the
00072     special case to handle assigning an object to itself (i.e. A=A).
00073     */
00074     RodPrimitive& RodPrimitive::operator=( const RodPrimitive& rhs)
00075     {
00076       if (this == &rhs) return *this;
00077       m_length = rhs.getLength();
00078       m_index = rhs.getIndex();
00079       m_id = rhs.getId();
00080           m_version = rhs.getVersion();
00081       m_body = rhs.getBody();
00082       return *this;
00083     }
00084 
00085 } // End namespace SctPixelRod

Generated on Thu Dec 22 20:17:08 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5