From: <ro...@us...> - 2009-06-05 17:55:14
|
Revision: 2148 http://nscldaq.svn.sourceforge.net/nscldaq/?rev=2148&view=rev Author: ron-fox Date: 2009-06-05 17:55:08 +0000 (Fri, 05 Jun 2009) Log Message: ----------- - Fix CSourceExcpeption typo that defined operator!= twice. - Create (uncompiled) CInvalidObjectType code. - Separate out the constants into a BuilderConstants header/class. Modified Paths: -------------- trunk/nextgen/daq/builder/CFragmentSource.h trunk/nextgen/daq/builder/CSourceException.cpp trunk/nextgen/daq/builder/CSourceException.h trunk/nextgen/daq/builder/Makefile.am Added Paths: ----------- trunk/nextgen/daq/builder/BuilderConstants.h trunk/nextgen/daq/builder/CInvalidObjectType.cpp trunk/nextgen/daq/builder/CInvalidObjectType.h Added: trunk/nextgen/daq/builder/BuilderConstants.h =================================================================== --- trunk/nextgen/daq/builder/BuilderConstants.h (rev 0) +++ trunk/nextgen/daq/builder/BuilderConstants.h 2009-06-05 17:55:08 UTC (rev 2148) @@ -0,0 +1,40 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2009. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ +#ifndef __BUILDERCONSTANTS_H +#define __BUILDERCONSTANTS_H + + +class CBuilderConstant { +public: + typedef enum _EventType_ { + PHYSICS, + SCALER, + BEGIN, + END, + PAUSE, + RESUME, + PACKETDOCS, + VARIABLES, + TRIGGERCOUNT, + NOEVENT + } EventType; +}; + +typedef enum _ExceptionReasonCodes { + INVALID_OBJECT_TYPE_EXCEPTION +} ExceptionReasonCode; + +#endif Modified: trunk/nextgen/daq/builder/CFragmentSource.h =================================================================== --- trunk/nextgen/daq/builder/CFragmentSource.h 2009-06-05 16:50:36 UTC (rev 2147) +++ trunk/nextgen/daq/builder/CFragmentSource.h 2009-06-05 17:55:08 UTC (rev 2148) @@ -1,6 +1,6 @@ /* This software is Copyright by the Board of Trustees of Michigan - State University (c) Copyright 2005. + State University (c) Copyright 2009. You may use this software under the terms of the GNU public license (GPL). The terms of this license are described at: @@ -41,25 +41,9 @@ #include <CConfigurableObject.h> #endif -/*! - TODO: This does not belong here but in a separate file along with other - constants etc: -*/ -class CBuilderConstant { -public: - typedef enum _EventType_ { - PHYSICS, - SCALER, - BEGIN, - END, - PAUSE, - RESUME, - PACKETDOCS, - VARIABLES, - TRIGGERCOUNT, - NOEVENT - } EventType; -}; +#ifndef __BUILDERCONSTANTS_H +#include <BuilderConstants.h> +#endif /*! Abstract base class for a source of event fragments. Event fragment Added: trunk/nextgen/daq/builder/CInvalidObjectType.h =================================================================== --- trunk/nextgen/daq/builder/CInvalidObjectType.h (rev 0) +++ trunk/nextgen/daq/builder/CInvalidObjectType.h 2009-06-05 17:55:08 UTC (rev 2148) @@ -0,0 +1,66 @@ +#ifndef __CINVALIDOBJECTTYPE_H +#define __CINVALIDOBJECTTYPE_h +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2009. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +#ifndef __CSOURCEEXCEPTION_H +#include "CSourceException.h" +#endif + +#ifndef __STL_STRING +#include <string> +#ifndef __STL_STRING +#define __STL_STRING +#endif +#endif + +// Forward classes: + +class CFragmentSource; + +/*! + This class reports an invalid object type. This is typically thrown by + a driver manager when it is asked to operate on a driver that it is not + managing. Note that this implies an expectation that all driver managers + will maintain a record of the set of driver instances they are currently managing. +*/ +class CInvalidObjectType : public CSourceException +{ +private: + CFragmentSource* m_pSource; + mutable std::string m_reasonText; + +public: + // Constructors and other canonical functions: + + CInvalidObjectType(CFragmentSource* pSource, + const char* pDoing, + std::string manager = std::string(""), + std::string instance = std::string("")); + CInvalidObjectType(const CInvalidObjectType& rhs); + CInvalidObjectType& operator=(const CInvalidObjectType& rhs); + int operator==(const CInvalidObjectType& rhs) const; + int operator!=(const CInvalidObjectType& rhs) const; + + + // Implementation of the pure virtual interface of the ultimate base class: + + virtual int ReasonCode() const; + virtual const char* ReasonText() const; + +}; + +#endif Modified: trunk/nextgen/daq/builder/CSourceException.cpp =================================================================== --- trunk/nextgen/daq/builder/CSourceException.cpp 2009-06-05 16:50:36 UTC (rev 2147) +++ trunk/nextgen/daq/builder/CSourceException.cpp 2009-06-05 17:55:08 UTC (rev 2148) @@ -79,10 +79,11 @@ Logical inverse of equality: */ int -CSourceException::operator==(const CSourceException& rhs) +CSourceException::operator!=(const CSourceException& rhs) { return !(*this == rhs); } +/ /*! Return the name of the manager. This could be a blank string if the @@ -92,4 +93,35 @@ CSourceException::getManager() const { return m_managerName; -}y +} +/*! + Return the name of the driver instance associated with the exception. + If this is not known, or if this is inapproprioate, an empty string can + be returned. +*/ + std::string +CSourceExceptiongetInstance() const + { + return m_instanceName; + } + + +/*! + Most error messages in this exception hierarchy will use the same + trailer string. This function is utility that provides that string. +*/ +std::string +CSourceException messageTrailer() const +{ + string resultString; + resultString = "Manager name(if known): "; + resultString += m_managerName; + resultString += '\n'; + resultString += "Instance name (if known): "; + resultString += m_instanceName; + resultString += '\n'; + resultString += "While: : "; + resultString += WasDoing(); + + return resultString; +} Modified: trunk/nextgen/daq/builder/CSourceException.h =================================================================== --- trunk/nextgen/daq/builder/CSourceException.h 2009-06-05 16:50:36 UTC (rev 2147) +++ trunk/nextgen/daq/builder/CSourceException.h 2009-06-05 17:55:08 UTC (rev 2148) @@ -1,8 +1,8 @@ #ifndef __CSOURCEEXCEPTION_H -#define __CSOURCEEXCEPTION_h +#define __CSOURCEEXCEPTION_H /* This software is Copyright by the Board of Trustees of Michigan - State University (c) Copyright 2005. + State University (c) Copyright 2009. You may use this software under the terms of the GNU public license (GPL). The terms of this license are described at: @@ -53,8 +53,13 @@ // Selectors (getters to the java folks) std::string getManager() const; + std::string getInstance() const; + // Message formatting utility for derived classes: +protected: + std::string messageTrailer() const; + }; Modified: trunk/nextgen/daq/builder/Makefile.am =================================================================== --- trunk/nextgen/daq/builder/Makefile.am 2009-06-05 16:50:36 UTC (rev 2147) +++ trunk/nextgen/daq/builder/Makefile.am 2009-06-05 17:55:08 UTC (rev 2148) @@ -1,10 +1,13 @@ lib_LTLIBRARIES = libBuilder.la libBuilder_la_SOURCES = CFragmentSource.cpp \ - CSourceException.cpp + CSourceException.cpp \ + CInvalidObjectType.cpp -include_HEADERS = CFragmentSource.h \ - CSourceException.h +include_HEADERS = BuilderContants.h \ + CFragmentSource.h \ + CSourceException.h \ + CInvalidObjectType.h INCLUDES = -I@top_srcdir@/base/thread This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |