Scopira 20080306

tree.h

00001 
00002 /*
00003  *  Copyright (c) 2002-2003    National Research Council
00004  *
00005  *  All rights reserved.
00006  *
00007  *  This material is confidential and proprietary information of
00008  *  National Research Council Canada ("Confidential Information").
00009  *  This Confidential Information may only be used and reproduced
00010  *  in accordance with the terms of the license agreement.
00011  *
00012  */
00013 
00014 #ifndef __INCLUDED_SCOPIRA_TOOL_TREE_H__
00015 #define __INCLUDED_SCOPIRA_TOOL_TREE_H__
00016 
00017 #include <map>
00018 #include <string>
00019 
00020 #include <scopira/tool/object.h>
00021 #include <scopira/tool/iterator.h>
00022 #include <scopira/tool/object.h>
00023 #include <scopira/tool/export.h>
00024 
00025 namespace scopira
00026 {
00027   namespace tool
00028   {
00029     class treenode;
00030   }
00031 }
00032 
00040 class scopira::tool::treenode : public scopira::tool::object
00041 {
00042   public:
00043     typedef scopira::tool::iterator_g< const std::string& > key_iterator;
00044 
00045   private:
00046     typedef std::map<std::string, scopira::tool::count_ptr<treenode> > nodemap_t;
00047 
00048   public:
00050     SCOPIRA_EXPORT treenode(scopira::tool::object *o = 0);
00052     SCOPIRA_EXPORT virtual ~treenode();
00053 
00055     SCOPIRA_EXPORT scopira::tool::object * get_object(void) { return dm_data.get(); }
00056 
00058     SCOPIRA_EXPORT void set(const std::string &name, treenode *nd);
00060     SCOPIRA_EXPORT treenode * get(const std::string &name);
00061 
00070     SCOPIRA_EXPORT void set_path(const std::string &path_name, treenode *nd);
00071 
00077     SCOPIRA_EXPORT key_iterator get_key_iterator(void);
00078 
00079   protected:
00080     nodemap_t dm_nodes;
00081     scopira::tool::count_ptr<scopira::tool::object> dm_data;
00082 };
00083 
00084 #endif
00085