00001 00002 //---------------------------------------------------------------------------------------------------------------- 00003 // Class definition include 00004 //---------------------------------------------------------------------------------------------------------------- 00005 #include "ExecutableCommand.h" 00006 00007 //---------------------------------------------------------------------------------------------------------------- 00008 // Class implementation 00009 //---------------------------------------------------------------------------------------------------------------- 00012 //------------------------------------------------------------------------------------------------------------ 00013 // Constructors & Destructors 00014 //------------------------------------------------------------------------------------------------------------ 00015 00016 /* 00017 * Creates a command with the given text 00018 * @param aText Is the text to assign to the command 00019 * @return Returns the created ExecutableCommand pointer 00020 */ 00021 ExecutableCommand :: ExecutableCommand(std::string aText) 00022 { 00023 setText(aText); 00024 std::cout<<"execComm created "<< aText.data()<<std::endl;//SIL 00025 } 00026 00027 /* 00028 * Destroys the command 00029 */ 00030 ExecutableCommand :: ~ExecutableCommand() 00031 { 00032 clear(); 00033 } 00034 00035 00036 00037 //------------------------------------------------------------------------------------------------------------ 00038 // Methods 00039 //------------------------------------------------------------------------------------------------------------ 00040 00041 /* 00042 * Gets the text of the command 00043 * @return text Is the text of the command 00044 */ 00045 std::string ExecutableCommand :: getText() 00046 { 00047 return text; 00048 } 00049 00050 /* 00051 * Sets the text of the command 00052 * @param theText Is the text of the command 00053 */ 00054 void ExecutableCommand :: setText(std::string theText) 00055 { 00056 text = theText; 00057 } 00058 00059 /* 00060 * Includes the command into the given queue for execution 00061 * @param executionQueue Is the queue in which is included the command 00062 */ 00063 void ExecutableCommand :: includeToExecute(std::deque<CommandObject *> & executionQueue) 00064 { 00065 executionQueue.push_back( this ); 00066 } 00067 00068 00069 /* 00070 * Virtual method implementation that returns 1 as the ExecutableCommand is just one command effective 00071 * @return The value of commands that represents this 00072 */ 00073 int ExecutableCommand :: count() 00074 { 00075 return 1; 00076 } 00077 00078 /* 00079 * Method that clears the command 00080 */ 00081 void ExecutableCommand :: clear() 00082 { 00083 00084 }