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

# /Users/fpy/titan-1-5-MBARI/Mers/Interfaces/Stub/Stub/TaskStub.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 #define PREFIX "TaskStub : "
    00015 #define TRACE(x) { LOG4CPLUS_TRACE ( logger, PREFIX << x ); }
    00016 #define INFO(x)  { LOG4CPLUS_INFO  ( logger, PREFIX << x ); }
    00017
    00018 #include "TaskStub.h"
    00019
    00020 #include <Mers/Utils/Lang/String.h>
    00021 #include <Mers/Utils/Logging/logger.h>
    00022
    00023 using Mers::Interfaces::Stub::TaskStub;
    00024 using Mers::Utils::Lang::String;
    00025 using log4cplus::Logger;
    00026 using std::vector;
    00027
    00028 Logger TaskStub::logger( Logger::getInstance( "Mers.Interfaces.Stub.TaskStub" ) );
    00029
    00030 // Constructor
    00031 TaskStub::TaskStub(const String &taskName ) :
    00032         Task( taskName ), complete( false )
    00033 {
    00034         setControllable( true );
    00035         TRACE( "TaskStub() : Created task " << toString() );
    00036 }
    00037
    00038 TaskStub::TaskStub( const String &taskName, vector< const String * > const &parameters ) :
    00039         Task( taskName, parameters ), complete( false )
    00040 {
    00041         setControllable( true );
    00042         TRACE( "TaskStub() : Created task " << toString() );
    00043 }
    00044
    00045 // Start the task
    00046 bool TaskStub::Start( void )
    00047 {
    00048         INFO( "Starting task " << toString() );
    00049         return true;
    00050 }
    00051
    00052 // Stop the task
    00053 bool TaskStub::Stop( void )
    00054 {
    00055         INFO( "Stopping task " << toString() );
    00056         complete = true;
    00057         return true;
    00058 }
    00059
    00060 // Test if the task is done
    00061 bool TaskStub::Completed( void )
    00062 {
    00063         return complete;
    00064 }
    00065
    00066 // Test if the task has failed
    00067 bool TaskStub::Failed( void )
    00068 {
    00069         return false;
    00070 }