rel-op.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <gecode/set/rel-op.hh>
00038
00039 namespace Gecode {
00040 using namespace Gecode::Set;
00041 using namespace Gecode::Set::Rel;
00042 using namespace Gecode::Set::RelOp;
00043
00044 void
00045 rel(Home home, SetOpType op, const SetVarArgs& x, SetVar y) {
00046 GECODE_POST;
00047 ViewArray<SetView> xa(home,x);
00048 switch (op) {
00049 case SOT_UNION:
00050 GECODE_ES_FAIL((RelOp::UnionN<SetView,SetView>::post(home, xa, y)));
00051 break;
00052 case SOT_DUNION:
00053 GECODE_ES_FAIL(
00054 (RelOp::PartitionN<SetView,SetView>::post(home, xa, y)));
00055 break;
00056 case SOT_INTER:
00057 {
00058 GECODE_ES_FAIL(
00059 (RelOp::IntersectionN<SetView,SetView>
00060 ::post(home, xa, y)));
00061 }
00062 break;
00063 case SOT_MINUS:
00064 throw IllegalOperation("Set::rel");
00065 break;
00066 default:
00067 throw UnknownOperation("Set::rel");
00068 }
00069 }
00070
00071 void
00072 rel(Home home, SetOpType op, const SetVarArgs& x, const IntSet& z, SetVar y) {
00073 GECODE_POST;
00074 Set::Limits::check(z, "Set::rel");
00075 ViewArray<SetView> xa(home,x);
00076 switch (op) {
00077 case SOT_UNION:
00078 GECODE_ES_FAIL((RelOp::UnionN<SetView,SetView>::post(home, xa, z, y)));
00079 break;
00080 case SOT_DUNION:
00081 GECODE_ES_FAIL(
00082 (RelOp::PartitionN<SetView,SetView>::post(home, xa, z, y)));
00083 break;
00084 case SOT_INTER:
00085 {
00086 GECODE_ES_FAIL(
00087 (RelOp::IntersectionN<SetView,SetView>
00088 ::post(home, xa, z, y)));
00089 }
00090 break;
00091 case SOT_MINUS:
00092 throw IllegalOperation("Set::rel");
00093 break;
00094 default:
00095 throw UnknownOperation("Set::rel");
00096 }
00097 }
00098
00099 }
00100
00101