summaryrefslogtreecommitdiff
path: root/src/smt/command.i
blob: ff8094165c840f212440ca4b6fd052e488783427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%{
#include "smt/command.h"

#ifdef SWIGJAVA

#include "bindings/java_iterator_adapter.h"
#include "bindings/java_stream_adapters.h"

#endif /* SWIGJAVA */
%}

%ignore CVC4::operator<<(std::ostream&, const Command&);
%ignore CVC4::operator<<(std::ostream&, const Command*);
%ignore CVC4::operator<<(std::ostream&, const CommandStatus&);
%ignore CVC4::operator<<(std::ostream&, const CommandStatus*);
%ignore CVC4::operator<<(std::ostream&, BenchmarkStatus status);
%ignore CVC4::operator<<(std::ostream&, CommandPrintSuccess);

%ignore CVC4::GetProofCommand;

#ifdef SWIGJAVA

// Instead of CommandSequence::begin() and end(), create an
// iterator() method on the Java side that returns a Java-style
// Iterator.
%ignore CVC4::CommandSequence::begin();
%ignore CVC4::CommandSequence::end();
%ignore CVC4::CommandSequence::begin() const;
%ignore CVC4::CommandSequence::end() const;
%extend CVC4::CommandSequence {
  CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*> iterator()
  {
    return CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*>(
        *$self);
  }
}

// CommandSequence is "iterable" on the Java side
%typemap(javainterfaces) CVC4::CommandSequence "java.lang.Iterable<edu.nyu.acsys.CVC4.Command>";

// the JavaIteratorAdapter should not be public, and implements Iterator
%typemap(javaclassmodifiers) CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*> "class";
%typemap(javainterfaces) CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*> "java.util.Iterator<edu.nyu.acsys.CVC4.Command>";
// add some functions to the Java side (do it here because there's no way to do these in C++)
%typemap(javacode) CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*> "
  public void remove() {
    throw new java.lang.UnsupportedOperationException();
  }

  public edu.nyu.acsys.CVC4.Command next() {
    if(hasNext()) {
      return getNext();
    } else {
      throw new java.util.NoSuchElementException();
    }
  }
"
// getNext() just allows C++ iterator access from Java-side next(), make it private
%javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*>::getNext() "private";

#endif /* SWIGJAVA */

%include "smt/command.h"

#ifdef SWIGJAVA

%include "bindings/java_iterator_adapter.h"
%include "bindings/java_stream_adapters.h"

%template(JavaIteratorAdapter_CommandSequence) CVC4::JavaIteratorAdapter<CVC4::CommandSequence, CVC4::Command*>;

#endif /* SWIGJAVA */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback