00001 /* Copyright (C) 2002 Dominic Letourneau (dominic.letourneau@usherbrooke.ca) 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 #ifndef _EXPLOITATIONENTRY_H_ 00018 #define _EXPLOITATIONENTRY_H_ 00019 00020 #include "Object.h" 00021 #include "Node.h" 00022 #include <string> 00023 #include <list> 00024 00025 00026 namespace RobotFlow { 00027 00028 /** 00029 * 00030 * \brief ExploitationEntry refers to a certain output (from a node) calculated at a certain iteration count. 00031 * 00032 * Higher intelligence modules need to know which node have produced an output at a certain iteration count. 00033 * ExploitationEntry contains the node, output_id and count required to process data from the exploitation mechanism. 00034 * 00035 * \author Dominic Létourneau 00036 * \version $Revision: 1.3 $ 00037 * $Date: 2005/03/29 15:20:19 $ 00038 * \par History: 00039 * $Revision: 1.3 $ 00040 * <ul> 00041 * <li>12/05/2003 Added doxygen documentation. 00042 * <li>12/05/2003 Created new file ExploitationEntry.h, class extracted from Exploitation.h 00043 * </ul> 00044 */ 00045 class ExploitationEntry { 00046 00047 public: 00048 00049 /** 00050 * Constructor with count, node, output_id args. 00051 * 00052 * \param count The iteration count of the entry 00053 * \param node The node (behavior) where the exploitation occurs 00054 * \param output_id The output_id from the exploited node (behavior) 00055 */ 00056 ExploitationEntry(int count, FD::Node *node, int output_id) 00057 : m_node(node), m_count(count), m_output_id(output_id) { 00058 00059 } 00060 00061 /** 00062 * Copy constructor. 00063 * 00064 * \param cpy The ExploitationEntry to copy 00065 */ 00066 ExploitationEntry (const ExploitationEntry& cpy) { 00067 m_node = cpy.m_node; 00068 m_count = cpy.m_count; 00069 m_output_id = cpy.m_output_id; 00070 } 00071 00072 00073 /** 00074 * = operator between two ExploitationEntr(ies) 00075 * 00076 * \param eqs The ExploitationEntry to copy 00077 * \retval ExploitationEntry & self reference 00078 */ 00079 ExploitationEntry & operator= (const ExploitationEntry &eqs) { 00080 m_node = eqs.m_node; 00081 m_count = eqs.m_count; 00082 m_output_id = eqs.m_output_id; 00083 00084 return *this; 00085 } 00086 00087 /** 00088 * Node accessor from the ExploitationEntry class 00089 * 00090 * \retval Node* The node pointer corresponding to the entry 00091 */ 00092 FD::Node* getNode() {return m_node;} 00093 00094 00095 /** 00096 * Iteration count accessor from the ExploitationEntry class 00097 * 00098 * \retval int The iteration count corresponding to the entry 00099 */ 00100 int getCount() {return m_count;} 00101 00102 00103 /** 00104 * Output ID accessor from the ExploitationEntry class 00105 * 00106 * \retval int The output identification of corresponding to the entry (related to the node) 00107 */ 00108 int getOutputID() {return m_output_id;} 00109 00110 00111 /** 00112 * Printing object to an output stream in the Overflow format. 00113 * 00114 * \param out The output stream to write to. 00115 */ 00116 void printOn(std::ostream &out = std::cout) const { 00117 out<<"<ExploitationEntry "; 00118 out<<"<Node "<<m_node<<" ("<<m_node->getName()<<")"<<" >"<<std::endl; 00119 out<<"<Count "<<m_count<<" >"<<std::endl; 00120 out<<"<OutputID "<<m_output_id<<" >"<<std::endl; 00121 out<<" >"<<std::endl; 00122 } 00123 00124 private: 00125 00126 ///The node pointer where the exploitation entry is related 00127 FD::Node *m_node; 00128 00129 ///The iteration counter where the exploitation occured 00130 int m_count; 00131 00132 ///The output_id of the exploitation output 00133 int m_output_id; 00134 00135 }; 00136 00137 }//namespace RobotFlow 00138 00139 #endif