Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

baciBACICallback.h

Go to the documentation of this file.
00001 #ifndef baciBACICallback_H 00002 #define baciBACICallback_H 00003 00004 /******************************************************************* 00005 * ALMA - Atacama Large Millimiter Array 00006 * (c) European Southern Observatory, 2003 00007 * 00008 *This library is free software; you can redistribute it and/or 00009 *modify it under the terms of the GNU Lesser General Public 00010 *License as published by the Free Software Foundation; either 00011 *version 2.1 of the License, or (at your option) any later version. 00012 * 00013 *This library is distributed in the hope that it will be useful, 00014 *but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 *Lesser General Public License for more details. 00017 * 00018 *You should have received a copy of the GNU Lesser General Public 00019 *License along with this library; if not, write to the Free Software 00020 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 * "@(#) $Id: baciBACICallback.h,v 1.5 2006/09/01 02:20:54 cparedes Exp $" 00023 * 00024 * who when what 00025 * -------- -------- ---------------------------------------------- 00026 * dfugate 2005-01-17 created 00027 */ 00028 00034 #ifndef __cplusplus 00035 #error This is a C++ include file and cannot be used from plain C 00036 #endif 00037 00038 #include "baciExport.h" 00039 #include "baciValue.h" 00040 #include "baciRegistrar.h" 00041 00042 namespace baci { 00043 00044 00045 // forwards 00046 class BACIComponent; 00047 00055 class baci_EXPORT BACICallback 00056 { 00057 00058 public: 00059 00068 BACICallback(const int& id_, Callback_ptr callback_, 00069 const BACIValue::Type type_, 00070 const CBDescIn& descIn_, BACIComponent* component_p): 00071 id_m(id_), type_m(type_), descIn_m(descIn_), component_mp(component_p), 00072 failureCount_m(0), removeOnFailure_m(true) 00073 { 00074 callback_mp = Callback::_duplicate(callback_); 00075 } 00076 00080 ~BACICallback() { 00081 CORBA::release(callback_mp); 00082 } 00083 00087 BACICallback& operator=(const BACICallback& cb) 00088 { 00089 if (this!=&cb) 00090 { 00091 id_m=cb.id_m; 00092 type_m=cb.type_m; 00093 callback_mp=Callback::_duplicate(cb.callback_mp); 00094 descIn_m=cb.descIn_m; 00095 component_mp=cb.component_mp; 00096 failureCount_m=cb.failureCount_m; 00097 removeOnFailure_m=cb.removeOnFailure_m; 00098 } 00099 return *this; 00100 } 00101 00105 bool operator==(const BACICallback& cb) const { return id_m==cb.id_m; } 00106 00111 int getID() const { return id_m; } 00112 00117 void succeeded() { 00118 //ACS_TRACE("baci::BACICallback::succeeded"); 00119 failureCount_m=0; 00120 } 00121 00122 00128 void failed(); 00129 00134 bool isOK() { return (failureCount_m <= failureLimitCount_m); } 00135 00140 void setRemoveOnFailure(bool removeOnFailure_) { removeOnFailure_m=removeOnFailure_; } 00141 00146 bool doRemoveOnFailure() const { return removeOnFailure_m; } 00147 00152 Callback_ptr getCallback() const { return callback_mp; } 00153 00158 BACIValue::Type getType() const { return type_m; } 00159 00164 CBDescIn getDescIn() const { return descIn_m; } 00165 00170 BACIComponent* getComponent() const { return component_mp; } 00171 00172 private: 00173 00177 int id_m; 00178 00182 Callback_ptr callback_mp; 00183 00187 BACIValue::Type type_m; 00188 00192 CBDescIn descIn_m; 00193 00197 BACIComponent* component_mp; 00198 00202 int failureCount_m; 00203 00207 bool removeOnFailure_m; 00208 00212 static const int failureLimitCount_m; 00213 00217 BACICallback(const BACICallback&); 00218 00219 }; /* BACICallback */ 00220 00221 /* ------------------------------------------------------------------------ */ 00227 typedef Registrar<int, BACICallback*> BACICallbackTable; 00230 /* ------------------------------------------------------------------------ */ 00231 00232 }; 00233 00234 #endif /* baciBACICallback_H */ 00235 00236 00237 00238

Generated on Thu Apr 30 02:30:49 2009 for ACS C++ API by doxygen 1.3.8