- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Stub/DCStub.cpp

    00001
    00002 //
    00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #include <cstdlib>
    00015 #include <ctime>
    00016
    00017 #include "DCStub.h"
    00018
    00019 #include <Mers/Executives/DeductiveController/Task.h>
    00020 #include <Mers/Models/Base/BaseModelVariable.h>
    00021 #include <Mers/Models/Base/BaseModelValue.h>
    00022 #include <Mers/Utils/Containers/intList.h>
    00023
    00025
    00026 using namespace Mers::Executives::DeductiveController::Stub;
    00027 using Mers::Utils::Containers::intList;
    00028 using Mers::Interfaces::TaskFactory;
    00029 using Mers::Models::Base::BaseModel;
    00030 using Mers::Executives::DeductiveController::Task;
    00031 using std::set;
    00032 using std::cout;
    00033 using std::endl;
    00034
    00036
    00037 DCStub::DCStub(BaseModel * model)
    00038         : DCInterface(model)
    00039 {
    00040 }
    00041
    00043
    00044 int DCStub::step(bool block)
    00045 {
    00046         (void) block;
    00047         // Fake MR-ME cycle - take the active goals and make them all the
    00048         // active state.
    00049         //cout << "Stepping DC" << endl;
    00050         set<t_TaskSharedPointer>::iterator iSet;
    00051         for(iSet = mActiveGoals.begin(); iSet != mActiveGoals.end(); ++iSet) {
    00052                 t_DCTaskSharedPointer task =
    00053                         ::Mers::Utils::Containers::dynamic_pointer_cast
    00054                         < Task, ::Mers::Interfaces::Task >( *iSet );
    00055
    00056                 cout << "DCStub Observing (" << task->getVariable()->getName() << " = " <<
    00057                         task->getValue()->getName() << ")" << endl;
    00058                 post_observation(task->getVariable()->getUID(),
    00059                         task->getValue()->getUID());
    00060         }
    00061
    00062         // Normal step taken.
    00063         return 0;
    00064 }
    00065
    00067
    00068 void DCStub::setInitialState(unsigned int state_index,
    00069         unsigned int value_index)
    00070 {
    00071         post_observation(state_index, value_index);
    00072 }
    00073
    00075
    00076 void DCStub::requestAbort()
    00077 {
    00078 }
    00079
    00081
    00082 void DCStub::requestFullState()
    00083 {
    00084 }
    00085
    00087
    00088 void DCStub::requestMR()
    00089 {
    00090 }
    00091