clipsmm - C++ CLIPS Interface Library

clipsmm logo
fact.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2006 by Rick L. Vinyard, Jr. <rvinyard@cs.nmsu.edu> *
3  * Copyright (C) 2013 by Tim Niemueller <tim@niemueller.de> *
4  * *
5  * This file is part of the clipsmm library. *
6  * *
7  * The clipsmm library is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU General Public License *
9  * version 3 as published by the Free Software Foundation. *
10  * *
11  * The clipsmm library is distributed in the hope that it will be *
12  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this software. If not see <http://www.gnu.org/licenses/>. *
18  ***************************************************************************/
19 #ifndef CLIPSFACT_H
20 #define CLIPSFACT_H
21 
22 #include <string>
23 #include <vector>
24 
26 #include <clipsmm/template.h>
27 #include <clipsmm/factory.h>
28 
29 namespace CLIPS {
30 
34 class Fact: public EnvironmentObject {
35 public:
36  typedef CLIPSPointer<Fact> pointer;
37 
38  Fact( Environment& environment, void* cobj=NULL );
39 
40  static Fact::pointer create( Environment& environment, void* cobj=NULL );
42 
43  ~Fact();
44 
49  bool assign_slot_defaults();
50 
53 
58  bool exists() const;
59 
64  long int index() const;
65 
67  std::vector<std::string> slot_names();
68 
70  Values slot_value(const std::string& slot_name);
71 
74 
76  bool set_slot(const std::string& slot_name, const Values& values);
77 
79  bool set_slot(const std::string& slot_name, const Value& value);
80 
82  bool retract();
83 
84  bool operator==(const Fact &other) const;
85  bool operator==(const Fact::pointer &other) const;
86 
87  unsigned int refcount() const;
88 
89  protected:
90 
91 };
92 
93 }
94 
95 #endif
Template::pointer get_template()
Returns the template associated with a fact.
Definition: fact.cpp:57
bool exists() const
Indicates whether a fact is still in the fact list or has been retracted.
Definition: fact.cpp:69
bool operator==(const Fact &other) const
Definition: fact.cpp:168
bool assign_slot_defaults()
Assigns default values to a fact.
Definition: fact.cpp:51
~Fact()
Definition: fact.cpp:46
Fact::pointer next()
Returns the next fact in the fact list.
Definition: fact.cpp:112
static Fact::pointer create(Environment &environment, void *cobj=NULL)
Definition: fact.cpp:37
bool set_slot(const std::string &slot_name, const Values &values)
Sets the named slot to a specific value or values.
Definition: fact.cpp:152
Definition: fact.h:34
Definition: environment.h:57
Definition: value.h:44
std::vector< Value > Values
Definition: value.h:278
std::vector< std::string > slot_names()
Returns the slot names associated with this fact.
Definition: fact.cpp:81
long int index() const
Returns the fact index of a fact.
Definition: fact.cpp:75
Environment & environment() const
Definition: environmentobject.cpp:33
unsigned int refcount() const
Definition: fact.cpp:179
Definition: activation.cpp:29
void * cobj() const
Returns a pointer to the underlying CLIPS C object.
Definition: object.cpp:33
CLIPSPointer< Fact > pointer
Definition: fact.h:36
bool retract()
Retracts a fact from the fact list.
Definition: fact.cpp:130
Fact(Environment &environment, void *cobj=NULL)
Definition: fact.cpp:30
Values slot_value(const std::string &slot_name)
Return the values contained within a slot.
Definition: fact.cpp:92
CLIPSPointer< Template > pointer
Definition: template.h:44
Definition: environmentobject.h:31

Generated on Fri Jul 17 2015 17:07:10 for clipsmm by doxygen 1.8.9.1