00001 #ifndef wali_WITNESS_COMBINE_GUARD 00002 #define wali_WITNESS_COMBINE_GUARD 1 00003 00004 /*! 00005 * @author Nicholas Kidd 00006 */ 00007 00008 #include "wali/Common.hpp" 00009 #include "wali/witness/Witness.hpp" 00010 #include <list> 00011 00012 namespace wali 00013 { 00014 namespace witness 00015 { 00016 class WitnessCombine : public Witness 00017 { 00018 public: 00019 //! Passes weight to base class Witness 00020 WitnessCombine( sem_elem_t weight ); 00021 00022 //! Destructor does nothing. 00023 virtual ~WitnessCombine(); 00024 00025 /*! 00026 * @brief Override Witness::combine 00027 * 00028 * Overriding Witness::combine here allows for Witness::combine 00029 * to not have to check if "this" is actually of type 00030 * WitnessCombine b/c if it were they dynamic dispatch would have 00031 * ended up here. 00032 */ 00033 virtual sem_elem_t combine( SemElem * se ); 00034 00035 //! Override Witness::accept 00036 virtual void accept( Visitor& v, bool visitOnce=false ); 00037 00038 //! Override Witness::reset_marks 00039 virtual void reset_marks() const; 00040 00041 //! Override Witness::pretty_print 00042 virtual std::ostream& prettyPrint( std::ostream& o, size_t depth ) const; 00043 00044 //! Add a child to this 00045 void addChild( witness_t w ); 00046 00047 /*! 00048 * The combine of all the weights of the children should (must) 00049 * equal the weight of this WitnessCombine object. 00050 * 00051 * @return reference to list of Witness children. 00052 */ 00053 std::list< witness_t >& children(); 00054 00055 //! absorb param wc's children into this 00056 void absorb( WitnessCombine * wc ); 00057 00058 protected: 00059 std::list< witness_t > kids; 00060 00061 }; // class WitnessCombine 00062 00063 } // namespace witness 00064 00065 } // namespace wali 00066 00067 #endif // wali_WITNESS_COMBINE_GUARD 00068