00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <clipsmm/function.h>
00020
00021 extern "C" {
00022 #include <clips/clips.h>
00023 };
00024
00025 #include <clipsmm/environment.h>
00026
00027 namespace DACLIPS {
00028
00029 Function::Function( Environment& environment, void* cobj ) :
00030 EnvironmentObject( environment, cobj ) {}
00031
00032 Function::pointer Function::create( Environment & environment, void * cobj ) {
00033 return Function::pointer( new Function( environment, cobj ) );
00034 }
00035
00036 Function::~Function()
00037 {
00038 }
00039
00040 std::string Function::name( )
00041 {
00042 if ( m_cobj )
00043 return EnvGetDeffunctionName( m_environment.cobj(), m_cobj );
00044 else
00045 return std::string();
00046 }
00047
00048 std::string Function::formatted( )
00049 {
00050 if ( m_cobj )
00051 return EnvGetDeffunctionPPForm( m_environment.cobj(), m_cobj );
00052 else
00053 return std::string();
00054 }
00055
00056 std::string Function::module_name() {
00057 if ( m_cobj )
00058 return EnvDeffunctionModule( m_environment.cobj(), m_cobj );
00059 else
00060 return std::string();
00061 }
00062
00063 bool Function::is_watched() {
00064 if ( m_cobj )
00065 return EnvGetDeffunctionWatch( m_environment.cobj(), m_cobj );
00066 else
00067 return false;
00068 }
00069
00070 void Function::set_watch( bool watch ) {
00071 if ( m_cobj )
00072 EnvSetDeffunctionWatch( m_environment.cobj(), watch, m_cobj );
00073 }
00074
00075 Function::pointer Function::next() {
00076 void* nxt;
00077 if ( m_cobj ) {
00078 nxt = EnvGetNextDeffunction( m_environment.cobj(), m_cobj );
00079 if ( nxt )
00080 return Function::create( m_environment, nxt );
00081 }
00082 return Function::pointer();
00083 }
00084
00085 bool Function::is_deletable() {
00086 if ( m_cobj )
00087 return EnvIsDeffunctionDeletable( m_environment.cobj(), m_cobj );
00088 return false;
00089 }
00090
00091 bool Function::undefine() {
00092 if ( m_cobj )
00093 return EnvUndeffunction( m_environment.cobj(), m_cobj );
00094 return false;
00095 }
00096
00097 }