00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <clipsmm/rule.h>
00020
00021 extern "C" {
00022 #include <clips/clips.h>
00023 };
00024
00025 #include <clipsmm/environment.h>
00026
00027 namespace DACLIPS {
00028
00029 Rule::Rule( Environment& environment, void* cobj ):
00030 EnvironmentObject( environment, cobj )
00031 {
00032 }
00033
00034 Rule::pointer Rule::create( Environment & environment, void * cobj )
00035 {
00036 return Rule::pointer( new Rule( environment, cobj ) );
00037 }
00038
00039 Rule::~Rule()
00040 {
00041 }
00042
00043 bool Rule::is_breakpoint_set( )
00044 {
00045 if (!m_cobj)
00046 return false;
00047 return EnvDefruleHasBreakpoint( m_environment.cobj(), m_cobj );
00048 }
00049
00050 std::string Rule::module_name( )
00051 {
00052 if ( !m_cobj )
00053 return std::string();
00054 return EnvDefruleModule( m_environment.cobj(), m_cobj );
00055 }
00056
00057 std::string Rule::name( )
00058 {
00059 if ( !m_cobj )
00060 return std::string();
00061 return EnvGetDefruleName( m_environment.cobj(), m_cobj );
00062 }
00063
00064 std::string Rule::formatted( ) {
00065 if ( !m_cobj )
00066 return std::string();
00067 return EnvGetDefrulePPForm( m_environment.cobj(), m_cobj );
00068 }
00069
00070 bool Rule::activations_watched( )
00071 {
00072 if ( !m_cobj )
00073 return false;
00074 return EnvGetDefruleWatchActivations( m_environment.cobj(), m_cobj );
00075 }
00076
00077 bool Rule::firings_watched( )
00078 {
00079 if ( !m_cobj )
00080 return false;
00081 return EnvGetDefruleWatchFirings( m_environment.cobj(), m_cobj );
00082 }
00083
00084 Rule::pointer Rule::next( )
00085 {
00086 void* nxt;
00087
00088 if ( !m_cobj )
00089 return Rule::pointer();
00090
00091 nxt = EnvGetNextDefrule( m_environment.cobj(), m_cobj );
00092 if ( nxt )
00093 return Rule::create( m_environment, nxt );
00094 else
00095 return Rule::pointer();
00096 }
00097
00098 bool Rule::is_deletable( )
00099 {
00100 if ( !m_cobj )
00101 return false;
00102 return EnvIsDefruleDeletable( m_environment.cobj(), m_cobj );
00103 }
00104
00105 void Rule::refresh( )
00106 {
00107 if ( m_cobj )
00108 EnvRefresh( m_environment.cobj(), m_cobj );
00109 }
00110
00111 bool Rule::remove_break( )
00112 {
00113 if ( !m_cobj )
00114 return false;
00115 return EnvRemoveBreak( m_environment.cobj(), m_cobj );
00116 }
00117
00118 void Rule::set_break( )
00119 {
00120 if ( m_cobj )
00121 EnvSetBreak( m_environment.cobj(), m_cobj );
00122 }
00123
00124 void Rule::set_watch_activations( bool set )
00125 {
00126 if ( m_cobj )
00127 EnvSetDefruleWatchActivations( m_environment.cobj(), set, m_cobj );
00128 }
00129
00130 void Rule::set_watch_firings( bool set )
00131 {
00132 if ( m_cobj )
00133 EnvSetDefruleWatchFirings( m_environment.cobj(), set, m_cobj );
00134 }
00135
00136 bool Rule::retract( )
00137 {
00138 if ( m_cobj )
00139 return EnvUndefrule( m_environment.cobj(), m_cobj );
00140 else
00141 return false;
00142 }
00143
00144 }
00145