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 );
41  static Fact::pointer create( Environment& environment, Template::pointer temp );
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.h
CLIPS::Object::cobj
void * cobj() const
Returns a pointer to the underlying CLIPS C object.
Definition: object.cpp:50
factory.h
CLIPS::Fact::slot_names
std::vector< std::string > slot_names()
Returns the slot names associated with this fact.
Definition: fact.cpp:98
CLIPS::Fact::assign_slot_defaults
bool assign_slot_defaults()
Assigns default values to a fact.
Definition: fact.cpp:68
CLIPS::Fact::retract
bool retract()
Retracts a fact from the fact list.
Definition: fact.cpp:147
CLIPS::EnvironmentObject::m_environment
Environment & m_environment
Definition: environmentobject.h:58
CLIPS::Template::create
static Template::pointer create(Environment &environment, void *cobj=NULL)
Definition: template.cpp:50
CLIPS::Fact::slot_value
Values slot_value(const std::string &slot_name)
Return the values contained within a slot.
Definition: fact.cpp:109
utility.h
CLIPS::Value
Definition: value.h:61
CLIPS::value_to_data_object
dataObject * value_to_data_object(const Environment &env, const Value &value, dataObject *obj)
Definition: factory.cpp:132
CLIPS::Fact::refcount
unsigned int refcount() const
Definition: fact.cpp:196
CLIPS::Fact
Definition: fact.h:51
CLIPS::Fact::get_template
Template::pointer get_template()
Returns the template associated with a fact.
Definition: fact.cpp:74
CLIPS::Fact::~Fact
~Fact()
Definition: fact.cpp:63
CLIPS::data_object_to_values
Values data_object_to_values(dataObject *clipsdo)
TODO Move to utility, since these are no longer factory methods.
Definition: factory.cpp:49
CLIPS::Fact::operator==
bool operator==(const Fact &other) const
Definition: fact.cpp:185
CLIPS::EnvironmentObject::environment
Environment & environment() const
Definition: environmentobject.cpp:50
CLIPS::Fact::index
long int index() const
Returns the fact index of a fact.
Definition: fact.cpp:92
CLIPS::Values
std::vector< Value > Values
Definition: value.h:295
CLIPS::Fact::next
Fact::pointer next()
Returns the next fact in the fact list.
Definition: fact.cpp:129
fact.h
CLIPS::Fact::set_slot
bool set_slot(const std::string &slot_name, const Values &values)
Sets the named slot to a specific value or values.
Definition: fact.cpp:169
CLIPS::Fact::exists
bool exists() const
Indicates whether a fact is still in the fact list or has been retracted.
Definition: fact.cpp:86
CLIPS
Definition: activation.cpp:29
CLIPS::Fact::Fact
Fact(Environment &environment, void *cobj=NULL)
Definition: fact.cpp:47
environment.h
environmentobject.h
CLIPS::Template::pointer
CLIPSPointer< Template > pointer
Definition: template.h:61
CLIPS::Fact::create
static Fact::pointer create(Environment &environment, void *cobj=NULL)
Definition: fact.cpp:54
CLIPS::Fact::pointer
CLIPSPointer< Fact > pointer
Definition: fact.h:70
CLIPS::data_object_to_strings
std::vector< std::string > data_object_to_strings(dataObject *clipsdo)
Definition: utility.cpp:51
CLIPS::Object::m_cobj
void * m_cobj
The underlying CLIPS C object.
Definition: object.h:79

Generated on Mon Jul 27 2020 00:00:00 for clipsmm by doxygen 1.8.18