ct_common  1.0.1
Common library for combinatorial testing
src/ct_common/common/tree_node.h
Go to the documentation of this file.
00001 //===----- ct_common/common/tree_node.h -------------------------*- C++ -*-===//
00002 //
00003 //                      The ct_common Library
00004 //
00005 // This file is distributed under the MIT license. See LICENSE for details.
00006 //
00007 //===----------------------------------------------------------------------===//
00008 //
00009 // This header file contains the base class for expressions and constraints
00010 //
00011 //===----------------------------------------------------------------------===//
00012 
00013 #ifndef CT_COMMON_TREE_NODE_H_
00014 #define CT_COMMON_TREE_NODE_H_
00015 
00016 #include <vector>
00017 #include <set>
00018 #include <iostream>
00019 #include <boost/shared_ptr.hpp>
00020 #include <ct_common/common/utils.h>
00021 
00022 namespace ct {
00023 namespace common {
00024 class ParamSpec;
00025 
00029 class DLL_EXPORT TreeNode {
00030 public:
00031   TreeNode(void);
00033   TreeNode(const TreeNode &from);
00035   TreeNode &operator = (const TreeNode &right);
00036   virtual ~TreeNode(void) = 0;
00037 
00039   virtual std::string get_class_name(void) const;
00041   static std::string class_name(void);
00043   bool is_leaf(void) const { return this->oprds_.empty(); }
00044 
00049   void touch_pids(const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00050                   std::set<std::size_t> &pids_to_touch) const;
00051 
00053   virtual void inner_touch_leaf_pids( const std::vector<boost::shared_ptr<ParamSpec> > &param_specs,
00054                                       std::set<std::size_t> &pids_to_touch) const;
00055 
00057   const std::vector<boost::shared_ptr<TreeNode> > &get_oprds() const { return this->oprds_; }
00058 
00060   virtual const std::string &get_str_value(void) const;
00061 
00063   virtual void dump(std::ostream &os, const std::vector<boost::shared_ptr<ParamSpec> > &param_specs) const = 0;
00064 
00065 protected:
00066   std::vector<boost::shared_ptr<TreeNode> > oprds_;  
00067 };
00068 }  // namespace common
00069 }  // namespace ct
00070 
00071 #endif // CT_COMMON_TREE_NODE_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines