00001 /* 00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico 00003 00004 This file is part of MeRMaID. 00005 00006 MeRMaID is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 MeRMaID is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with MeRMaID. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 00021 00022 /** 00023 * @Filename SemanticNode.hpp 00024 * @Description SemanticNode class definition. 00025 * @Status Implementing 00026 * @Version $Id: SemanticNode.hpp 1 2011-03-04 18:13:18Z jreis $ 00027 * @Maintainer Marco Barbosa + Nelson Ramos 00028 */ 00029 00030 00031 #ifndef __DATASEMANTICS_SEMANTICNODE_H_ 00032 #define __DATASEMANTICS_SEMANTICNODE_H_ 00033 00034 #include <string> 00035 #include <vector> 00036 #include <boost/shared_ptr.hpp> 00037 00038 namespace mermaid 00039 { 00040 namespace support 00041 { 00042 namespace data 00043 { 00044 using boost::shared_ptr; 00045 00046 class SemanticNode; 00047 typedef std::vector<shared_ptr<SemanticNode> > SemanticNodeVector; 00048 00049 /** 00050 * @Class SemanticNode SemanticNode.hpp "SemanticNode.hpp" 00051 * @Description Class representing a semantic node 00052 * @Author Marco Barbosa + Nelson Ramos 00053 */ 00054 class SemanticNode 00055 { 00056 00057 friend class SemanticTree; 00058 friend class SemanticTreeFactory; 00059 00060 public: 00061 00062 /** 00063 * @Description Constructor. 00064 * @Description Default SemanticNode constructor. 00065 * @Description Should not be used directly. 00066 */ 00067 SemanticNode(); 00068 00069 /** 00070 * @Description Constructor. 00071 * @Description Builds a SemanticNode with a name. 00072 * @Argument name Node name. 00073 */ 00074 SemanticNode (std::string name); 00075 00076 /** 00077 * @Description Children getter. 00078 * @Returns The children nodes of the current SemanticNode 00079 */ 00080 SemanticNodeVector getChildren(); 00081 00082 /** 00083 * @Description Name getter. 00084 * @Returns The name of the current SemanticNode 00085 */ 00086 std::string getName(); 00087 00088 /** 00089 * 00090 */ 00091 //bool aContainsB(string a, string b); 00092 00093 private: 00094 std::string name_; 00095 SemanticNodeVector children_; 00096 void addChild (shared_ptr<SemanticNode> child); 00097 shared_ptr<SemanticNode> getChildWithName (std::string name); 00098 00099 }; // SemanticTree 00100 } // namespace data 00101 } // namespace support 00102 } // namespace mermaid 00103 00104 #endif // __DATASEMANTICS_SEMANTICNODE_H_