00001 #ifndef FAULTSTATE_H_ 00002 #define FAULTSTATE_H_ 00003 00004 /******************************************************************************* 00005 * ALMA - Atacama Large Millimeter Array 00006 * Copyright (c) ESO - European Southern Observatory, 2011 00007 * (in the framework of the ALMA collaboration). 00008 * All rights reserved. 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 *******************************************************************************/ 00024 #include <iostream> 00025 #include <memory> 00026 #include "Properties.h" 00027 #include "Timestamp.h" 00028 00029 namespace acsalarm 00030 { 00031 /* 00032 * Class representing a single fault state for use by cpp alarm source clients 00033 * which wish to send an alarm to the laser alarm server. 00034 */ 00035 class FaultState 00036 { 00037 public: 00038 00042 FaultState(); 00043 00047 FaultState(const FaultState &); 00048 00052 FaultState(std::string family, std::string member, int code); 00053 00054 /* 00055 * Destructor 00056 */ 00057 virtual ~FaultState(); 00058 00059 FaultState & operator=(const FaultState & rhs); 00060 00065 void setCode(const int faultCode) { 00066 code=faultCode; 00067 } 00068 00073 int getCode() const { 00074 return code; 00075 } 00076 00081 void setDescriptor(const std::string & newDescriptor) { 00082 descriptor=newDescriptor; 00083 } 00084 00088 std::string getDescriptor() const { 00089 return descriptor; 00090 } 00091 00096 std::string getFamily() const { 00097 return family; 00098 } 00099 00104 std::string getMember() const { 00105 return member; 00106 } 00107 00108 00113 void setFamily(const std::string & faultFamily); 00114 00119 void setMember(const std::string & newFaultMember); 00120 00124 virtual void setUserProperties(std::auto_ptr<acsalarm::Properties> theProperties) { userProperties = theProperties; } 00125 00129 const virtual acsalarm::Properties & getUserProperties() const { return *userProperties; } 00130 00134 virtual void setUserTimestamp(std::auto_ptr<acsalarm::Timestamp> theTimestamp) { userTimestamp = theTimestamp; } 00135 00139 const virtual acsalarm::Timestamp & getUserTimestamp() const { return *userTimestamp; } 00140 00141 virtual bool getActivatedByBackup() const { return activatedByBackup; } 00142 virtual void setActivatedByBackup(bool newActivatedByBackup) { activatedByBackup = newActivatedByBackup; } 00143 00144 virtual bool getTerminatedByBackup() const { return terminatedByBackup; } 00145 virtual void setTerminatedByBackup(bool newTerminatedByBackup) { terminatedByBackup = newTerminatedByBackup; } 00146 00147 private: 00148 00149 std::string member; 00150 std::string family; 00151 std::string descriptor; 00152 int code; 00153 bool activatedByBackup; 00154 bool terminatedByBackup; 00155 std::auto_ptr<acsalarm::Properties> userProperties; 00156 std::auto_ptr<acsalarm::Timestamp> userTimestamp; 00157 }; 00158 }; 00159 #endif /*FAULTSTATE_H_*/