xorp

master_template_tree.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 
00003 // Copyright (c) 2001-2009 XORP, Inc.
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License, Version 2, June
00007 // 1991 as published by the Free Software Foundation. Redistribution
00008 // and/or modification of this program under the terms of any other
00009 // version of the GNU General Public License is not permitted.
00010 // 
00011 // This program is distributed in the hope that it will be useful, but
00012 // WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00014 // see the GNU General Public License, Version 2, a copy of which can be
00015 // found in the XORP LICENSE.gpl file.
00016 // 
00017 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00018 // http://xorp.net
00019 
00020 // $XORP: xorp/rtrmgr/master_template_tree.hh,v 1.11 2008/10/02 21:58:23 bms Exp $
00021 
00022 #ifndef __RTRMGR_MASTER_TEMPLATE_TREE_HH__
00023 #define __RTRMGR_MASTER_TEMPLATE_TREE_HH__
00024 
00025 class XRLdb;
00026 
00027 #ifdef DEBUG_XRLDB
00028 #include "xrldb.hh"
00029 #endif
00030 
00031 #include "template_tree.hh"
00032 #include "master_template_tree_node.hh"
00033 
00034 class MasterTemplateTree : public TemplateTree {
00035 public:
00036     MasterTemplateTree(const string& xorp_root_dir,
00037                XRLdb* xrldb,
00038                bool verbose)  throw (InitError);
00039 
00040     bool load_template_tree(const string& config_template_dir,
00041                 string& error_msg);
00042 
00043     void add_cmd(char* cmd) throw (ParseError);
00044     void add_cmd_action(const string& cmd, const list<string>& action)
00045     throw (ParseError);
00046     const XRLdb* xrldb() const { return _xrldb; }
00047 
00048     const MasterTemplateTreeNode* find_node(const list<string>& path_segments) 
00049     const 
00050     {
00051     return (const MasterTemplateTreeNode*)
00052         (TemplateTree::find_node(path_segments));
00053     }
00054 
00055     MasterTemplateTreeNode* root_node() const { 
00056     return (MasterTemplateTreeNode*)_root_node; 
00057     }
00058 private:
00059     bool expand_master_template_tree(string& error_msg);
00060     bool check_master_template_tree(string& error_msg);
00061 
00062     XRLdb*      _xrldb;
00063 };
00064 
00065 #endif // __RTRMGR_MASTER_TEMPLATE_TREE_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations