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

baciBACIAction.h

Go to the documentation of this file.
00001 #ifndef baciBACIAction_H 00002 #define baciBACIAction_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: baciBACIAction.h,v 1.7 2008/06/03 09:14:47 bjeram Exp $" 00023 * 00024 * who when what 00025 * -------- -------- ---------------------------------------------- 00026 * bgustafs 2001-07-12 changed name of parameter in setCompletion 00027 * msekoran 2001/03/04 modified 00028 */ 00029 00035 #ifndef __cplusplus 00036 #error This is a C++ include file and cannot be used from plain C 00037 #endif 00038 00039 #include "baciExport.h" 00040 #include "baciValue.h" 00041 00042 #include <deque> 00043 00044 namespace baci { 00045 00046 00047 // forwards 00048 class BACIComponent; 00049 00053 enum ActionRequest { reqNone=0, 00054 reqInvokeWorking=1, 00055 reqInvokeDone=2, 00056 reqDestroy=3 }; 00057 00065 class baci_EXPORT ActionImplementator 00066 { 00067 public: 00090 virtual ActionRequest invokeAction(int function, 00091 BACIComponent* component_p, 00092 const int &callbackID, 00093 const CBDescIn& descIn, 00094 BACIValue* value, 00095 Completion& completion, 00096 CBDescOut& descOut) = 0; 00097 00098 virtual ~ActionImplementator() {} 00099 00100 }; /* ActionImplementator */ 00101 00102 /* ------------------------------------------------------------------------ */ 00103 00112 class baci_EXPORT BACIAction 00113 { 00114 00115 public: 00116 00120 BACIAction() : actionFunction_m(0), actionImplementator_mp(0), 00121 callbackID_m(-1), value_m(BACIValue::NullValue), completed_m(false) {} 00122 00128 BACIAction(ActionImplementator* actionImplementator_, 00129 int actionFunction_, 00130 int callbackID_) : 00131 actionFunction_m(actionFunction_), 00132 actionImplementator_mp(actionImplementator_), 00133 callbackID_m(callbackID_), 00134 value_m(BACIValue(BACIValue::NullValue)), 00135 completed_m(false) 00136 { 00137 } 00138 00146 BACIAction(ActionImplementator* actionImplementator_, 00147 int actionFunction_, 00148 int callbackID_, const BACIValue& value_): 00149 actionFunction_m(actionFunction_), 00150 actionImplementator_mp(actionImplementator_), 00151 callbackID_m(callbackID_), 00152 value_m(value_), 00153 completed_m(false) 00154 { 00155 } 00156 00160 BACIAction& operator=(const BACIAction& action) 00161 { 00162 if (this!=&action) 00163 { 00164 actionFunction_m=action.actionFunction_m; 00165 actionImplementator_mp=action.actionImplementator_mp; 00166 callbackID_m=action.callbackID_m; 00167 value_m=action.value_m; 00168 completed_m=action.completed_m; 00169 completion_m=action.completion_m; 00170 } 00171 return *this; 00172 } 00173 00177 bool operator==(const BACIAction& action) const { return callbackID_m==action.callbackID_m; } 00178 00189 ActionRequest invoke(BACIComponent* component_p, 00190 int callbackID_, 00191 const CBDescIn& descIn, 00192 BACIValue* value, 00193 Completion& completion, 00194 CBDescOut& descOut) 00195 { 00196 return actionImplementator_mp->invokeAction(actionFunction_m, component_p, callbackID_, descIn, 00197 value, completion, descOut); 00198 } 00199 00204 int getActionFunction() const { return actionFunction_m; } 00205 00210 ActionImplementator* getActionImplementator() const { return actionImplementator_mp; } 00211 00216 int getCallbackID() const { return callbackID_m; }; 00217 00222 BACIValue getValue() const { return value_m; } 00223 00228 BACIValue* getValueRef() const { return const_cast<BACIValue*>(&value_m); } 00229 00234 bool isCompleted() const { return completed_m; } 00235 00240 Completion getCompletion() const { return completion_m; } 00241 00245 void setCompletion(const Completion& c) 00246 { 00247 completed_m = true; 00248 completion_m = c; 00249 } 00250 00251 private: 00252 00256 int actionFunction_m; 00257 00261 ActionImplementator* actionImplementator_mp; 00262 00266 int callbackID_m; 00267 00271 BACIValue value_m; 00272 00276 bool completed_m; 00277 00281 Completion completion_m; 00282 00286 BACIAction(const BACIAction&); 00287 00288 }; /* BACIAction */ 00289 00293 typedef std::deque<BACIAction*> BACIActionQueue; 00294 00295 /* ------------------------------------------------------------------------ */ 00296 00297 }; 00298 00299 #endif /* baci_H */

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