00001
00010 /*00011 * Copyright 2008. Los Alamos National Security, LLC. This material00012 * was produced under U.S. Government contract DE-AC52-06NA25396 for00013 * Los Alamos National Laboratory (LANL), which is operated by Los00014 * Alamos National Security, LLC, for the Department of Energy. The00015 * U.S. Government has rights to use, reproduce, and distribute this00016 * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,00017 * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL00018 * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to00019 * produce derivative works, such modified software should be clearly00020 * marked, so as not to confuse it with the version available from LANL.00021 *00022 * Additionally, this program is free software; you can redistribute00023 * it and/or modify it under the terms of the GNU General Public00024 * License as published by the Free Software Foundation; version 2 of00025 * the License. Accordingly, this program is distributed in the hope00026 * it will be useful, but WITHOUT ANY WARRANTY; without even the00027 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR00028 * PURPOSE. See the GNU General Public License for more details.00029 *00030 * You should have received a copy of the GNU General Public License00031 * along with this program; if not, write to the Free Software00032 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00033 */00034
00035 #ifndef _TRACKING_H_00036 #define _TRACKING_H_00037
00038 #include "avl.h"00039 #include <stdint.h>00040 #include "sensingC.h"00041
00042
00043 namespace sensix {
00044class TaskImpl : Task {
00045 public:
00046 TaskImpl(Functor *prev, Functor *f, Response *cb);
00047 ~TaskImpl();
00048
00049 Functor *f();
00050 Functor *superf();
00051 Response *callback();
00052 ReqList *subtasks();
00053 voidaddSubtask(Request *r, Functor *f);
00054 intnumPeers();
00055 voidnumPeers(int p);
00056 boolcancelled();
00057 voidcancelled(bool c);
00058
00059 private:
00060 Functor *funct;
00061 Functor *parent;
00062 Response *passup;
00063 ReqList *subs;
00064
00065 int num_peers;
00066 bool cancel;
00067 };
00068
00069
00070class CapabilityTracker {
00071 public:
00072 voidinsertCapability(uint8_t cap, Capability *obj);
00073 Capability* getCapability(uint8_t key);
00074
00075 private:
00076 avl_tree_t tree;
00077 };
00078
00079
00080 class TaskTracking {
00081 public:
00082 voidaddTask(TaskImpl *ti);
00083 TaskImpl* getTask(Functor *f);
00084 voidremoveTask(Functor *f);
00085 intnumTaskPeers(Functor *f);
00086 voidnumTaskPeers(Functor *f, int p);
00087 boolcancelledTask(Functor *f);
00088 voidcancelledTask(Functor *f, bool c);
00089
00090 private:
00091 avl_tree_ttree;
00092 };
00093 }
00094
00095
00096 #endif // _TRACKING_H_