I need to fetch the Slot Names from CLIPS for a Multislot Field (which is a part of a USER defined class) from C/C++ code.
I tried to use EnvSend/a sample deffunction which prints the Slot Names, but none of them produced the desired result, might be I am missing something.
So is there any way through which I can retrieve the Slot Names/Values for a MultiSlot.
Now I need to have some output through C function which returns like this, which has both Class Name and Object Names in that Multislot.
(send print)
or,
of Card
(CardNumber "AT210000001234")
(Card CardInfo<Instance-Name of CardInfo class Object1 i.e. cardinfo> ClassName2<Instance-Name of class Object2>)
Any guidance in this matter would be appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The ClassSlots function can be used to retrieve the names of a slot for a specified class. Given the name of the class, you can use the FindDefclass function to get a pointer to the class data structure which you can pass to ClassSlots. With the names of the slots, you can then use the Send function to retrieve the slot values for a particular instance. For example, if one of the slot names was height, construct the string value "get-height" and pass that value to the instance using the Send function. Without any information on what you attempted in your C code, it's not possible to say why it didn't work properly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi All,
I need to fetch the Slot Names from CLIPS for a Multislot Field (which is a part of a USER defined class) from C/C++ code.
I tried to use EnvSend/a sample deffunction which prints the Slot Names, but none of them produced the desired result, might be I am missing something.
So is there any way through which I can retrieve the Slot Names/Values for a MultiSlot.
Eg:
(defclass Card (is-a USER)
(role concrete)
(pattern-match reactive)
( slot CardNumber (type STRING) )
( multislot InfoList (type INSTANCE) )
)
(defclass CardInfo (is-a USER)
(role concrete)
(pattern-match reactive)
( slot BinRange (type STRING) )
)
(defrule Abc
?card<-(object (is-a Card)(CardNumber ?card.CardNumber))
(test (starts-with ?card.CardNumber "AT2"))
=>
(make-instance of CardInfo)
(slot-insert$ ?card InfoList (+ 1 (length$ (send ?card get-InfoList))) (instance-address ))
)
Now I need to have some output through C function which returns like this, which has both Class Name and Object Names in that Multislot.
(send print)
or,
of Card
(CardNumber "AT210000001234")
(Card CardInfo<Instance-Name of CardInfo class Object1 i.e. cardinfo> ClassName2<Instance-Name of class Object2>)
Any guidance in this matter would be appreciated.
The ClassSlots function can be used to retrieve the names of a slot for a specified class. Given the name of the class, you can use the FindDefclass function to get a pointer to the class data structure which you can pass to ClassSlots. With the names of the slots, you can then use the Send function to retrieve the slot values for a particular instance. For example, if one of the slot names was height, construct the string value "get-height" and pass that value to the instance using the Send function. Without any information on what you attempted in your C code, it's not possible to say why it didn't work properly.